Cheap rate compass

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
One question - why does anyone need to know rate of turn? Have I been missing something?

Rate of turn helps autopilots apply corrections early. By knowing the rate at which the boat is yawing and autopilot can apply or or less helm to correct it.
 

Javelin

Well-known member
Joined
3 Sep 2010
Messages
1,413
Location
Southwold
www.Southwoldboatyard.co.uk
Having delivered boats with and without on numerous occasions it makes a significant difference to reaction times of the autohelm and avoids or at least reduces the incessant over correction especially in a quartering sea.

When do I want one? Well first significant trip will be to Oostende at the end of May.
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
When do I want one? Well first significant trip will be to Oostende at the end of May.

I'll order some bits. Should be plenty of time, but make sure you have a plan B! Do you have a barometer on your network? or WiFi? Would be simple to add these - although I might be concerned that the WiFi would upset the compass a little.
 

Javelin

Well-known member
Joined
3 Sep 2010
Messages
1,413
Location
Southwold
www.Southwoldboatyard.co.uk
I have the B&G wifi system which transmits so I can mirror the Zeus2 to an ipad and will also connect via my phone to download system updates and other stuff I've not really looked into yet.
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
OK - I will skip WiFi then. Have some bits coming in the next day or two, so should be able to piece something together in the next couple of weeks. I have a Triton display here which I can use for testing, and I am already very familiar with the software needed. I'll post an update when I have something working.
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
So I have got most of the bits - just waiting on the voltage regulator, which I can probably manage without for the moment.

This device will output the following PGNs:
127250 - Vessel heading (magnetic)
127251 - Rate of turn
127257 - Attitude (roll, pitch and heading)

That's it! Now I need to heat up the soldering iron.
 

Javelin

Well-known member
Joined
3 Sep 2010
Messages
1,413
Location
Southwold
www.Southwoldboatyard.co.uk
Superb stuff, can't wait to try it out.

We need to get onto the marketing dept.

Something like.

Introducing the ADWUK Sensor
This precision 9 axis sensor competes with the best on the market at a fraction of the cost.
Built in the Cotswolds by our team of electronic wizards.
Tested in the arduous conditions on the North sea.
This fully featured Rate compass will enhance your sailing experience and you will still have enough in your pocket to buy at least 100pints of your favorite ale.

But I'm sure someone in the marketing dept can do better..........
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
I have something working at a basic level. Now I need to refine roll and pitch compensation for the compass as they affect the heading output significantly. The algorithm I have for this allows for a maximum roll and pitch of 40 degrees. I'm guessing that more than that you probably aren't too bothered about compass heading. Once that is done, I can package it up as the NMEA 2000 part is the easy bit. So maybe another week or two at the most and I'll have something for you to try.
 

bats

Member
Joined
28 Oct 2010
Messages
147
Visit site
At the moment I am using OpenPlotter/Pi to generate a heading and passing that to my plotter via a serial cable and NMEA 0183. Great for stabilised radar/MARPA.
OpenPlotter can generate PGNs for N2K.
Adwuk: How do I make the connection with my N2K network without the expense of ActiSense or similar? The CANBUS-N2K converter from Sailoog does not seem to be available at the moment.

Mike
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
Tilt compensation seems to be working well now, up to angles of about 60 degrees in both pitch and roll. I think that should be enough :)
The major trick appears to be calibration of the compass in 3 dimensions, and I have a routine for doing that. I am not sure to what extent the compass will need to be recalibrated to take account of new iron based surroundings. These sensors are pretty sensitive. Anyway, heading, roll, pitch and rate of turn all being measured now at 10Hz, which is the frequency my B&G compass works at, so it should be OK.

Mike, to send data onto the CANBUS you are going to need something with a CAN interface. A PICAN 2 shield will add this to your PI, but then you will need software to convert your 0183 messages to 2K and push them out on the network. The major problem is that you then have to implement the whole N2K protocol such as ID claiming, responding to requests etc etc, which would be a royal pain. Easiest to buy the Actisense cable I think, or a cheap standalone device, which may be available shortly :)

Andrew
 

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,427
Location
Hopefully somewhere warm
Visit site
At the moment I am using OpenPlotter/Pi to generate a heading and passing that to my plotter via a serial cable and NMEA 0183. Great for stabilised radar/MARPA.
OpenPlotter can generate PGNs for N2K.
Adwuk: How do I make the connection with my N2K network without the expense of ActiSense or similar? The CANBUS-N2K converter from Sailoog does not seem to be available at the moment.

Mike

Can-bus converter should be available soon from sailoog..

http://forum.openmarine.net/showthread.php?tid=92&pid=1396#pid1396

We have the new CAN-USB stick back on stock but not for sale yet. We are really busy with the new openplotter image. The new model is isolated. I hope next week we can update the shop. Thanks.


Looks fairly comprehensive both in and out, never played with NMEA2000 so can't comment from experience.

https://sailoog.gitbooks.io/openplotter-documentation/content/en/nmea-2k.html
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
With the onboard accelerometer the device is able to detect taps and double taps. So now I need to figure out how best to use this to assist with the compass calibration. The normal calibration (same for my B&G) is to swing the compass twice by motoring in a circle. I have had better results by calibrating to 2 known headings, which I should be able to do now with the tap/double tap. Just don't drop anything on it :)
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
I have pretty much finished the code for the compass now, with its calibration routine and roll & pitch compensation. The calibration involves getting onto the four headings of 000, 090, 180 and 270 (magnetic) and double tapping the case of the compass. The controller will then blink to confirm that it has registered the heading so that you can move onto the next one. Once all four are done, headings are accurate to + or - 1 degree on the level. Roll and pitch compensation can't be calibrated so accurately, but with my approximations the results appear to be reasonably stable + or - 5 degrees (part of this may be the inaccuracy in my hand held testing). So now to solder it up properly, install it in its box, add the NMEA 2000 code and test it with a Triton display.
 

rgarside

Active member
Joined
24 May 2009
Messages
502
Location
East Coast
Visit site
I have something working at a basic level. Now I need to refine roll and pitch compensation for the compass as they affect the heading output significantly. The algorithm I have for this allows for a maximum roll and pitch of 40 degrees. I'm guessing that more than that you probably aren't too bothered about compass heading. Once that is done, I can package it up as the NMEA 2000 part is the easy bit. So maybe another week or two at the most and I'll have something for you to try.

Have you found Freescale Semiconductor's Application Note 4246? There are quite a few other notes available describing approaches to compass compensation. I think the company is now NXP, and they produce a lot of the integrated motion sensing packages.
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
Thanks - yes, found the notes and they have proved very useful. In essence you need to compensate for hard iron, soft iron, field strength and then roll/pitch. Hard iron, field strength and roll/pitch are relatively easy and can be done without any reference points. The soft iron calibration less so, and I believe that the only way to do that accurately is to calibrate to a number of known headings. Although note 4246 claims that you don't. I'll have to have another read and see why they think that is the case.
 

rgarside

Active member
Joined
24 May 2009
Messages
502
Location
East Coast
Visit site
The way I interpret 4246 is that they envisage continually updating their "cloud" of magnetometer readings for different values of roll, pitch and heading and then re-calculating the corrections periodically. Their concept makes a lot of sense for a magnetometer in a mobile phone, where the definition of heading and up might vary between manufacturers.

In 2D, the hard iron effects result in the 2D magnetometer reading forming a circle with its centre not at the origin - the offset from the origin gives the corrections to be applied. The soft iron effects turn the circle into an ellipse with a more complicated process to make the corrections. In 3D, the corresponding shapes are a sphere and an ellipsoid. Tilt correction requires working in 3D.

In the 2D approach, the corrections can be found by driving the boat in a circle, you can then calculate the offset of the centre of the circle and the corresponding corrections. The 3D bit with a mobile phone is easy, but not so much with a boat. So I think that may be where continually updating the database of reading may come in, so while you are bashing away to windward on your ear the software is making note of the readings to improve the corrections. Until I get to taking some readings on the boat I won't know how much it would matter. However, since I got interested in this I seem to have had better things to do [sailing for one!] so I'll be delighted to hear how you get on.
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
So its all done now - bar some tidying up. Just need to drill a hole in the case so that the NMEA socket can be mounted and then it can all be screwed together. I will post a picture tomorrow at some stage.
I am going to tweak the calibration routine so that it looks at any COG data on the network. That will help a little I think, to make sure that you don't accidentally calibrate to some strange setting. It won't take long as I already have the necessary code.
I have it all working with my Triton at the moment, and the display is fine. The tilt correction appears to be working very well now as well.
 

adwuk

Active member
Joined
10 Jun 2015
Messages
788
Location
Tarbert
Visit site
Picture as promised. Heading is in the direction of the NMEA 2000 cable.

attachment.php
 
Top