Building a NMEA 0183 Wind Instrument

isailor_windUPDATED 09/08/2016. Following on from the last project, where I broadcast NMEA GPS data to iSailor, I wanted to send wind measurements as well. The mast in my Westsail 32 was out, and it was a perfect time to put a new wind vane on. The app iSailor now has an unlockable wind instrument display, meaning I could channel the measurements straight to it. Alternatively I could also send the data to a laptop running OpenCPN. Firstly I needed a wind vane to mount. In the same mind as the excellent Freeboard project, I decided to use a Peet Bros. Anemometer to mount at the top of the mast. The unit seems extremely reliable and simple, having only two magnetic reed switches inside. The timing between the switch pulses gives wind direction, and the frequency of pulses gives wind speed. It really doesn’t get much simpler than that, and this set-up only requires three wires to be run up the mast (eg. an audio cable).

nmea_wind_circuit_v4 With the anemometer installed, I used a 3.3V Arduino Pro Mini (or any other Arduino) to read the pulses. Peet Brothers kindly supplied the calibration data to convert the pulse timings into wind speed. It then took some trials and data analysis to work out the best error rejection and digital filtering for a stable output.

UPDATE: There is some more info on the board I made here (no longer available). The Arduino source code is here. If you find any of this useful, please consider providing a small donation!

Once the wind speed and direction is decoded by the Arduino, it can be sent out as a standard NMEA 0183 string. This string can be read by almost any marine equipment. I piped the data string into my Raspberry Pi NMEA Multiplexer which allows the data to be sent over WiFi. The iSailor app can then be unlocked to read the NMEA sentence and display a wind instrument! The data could also be sent to any existing instrument display that accepts NMEA 0183. So why pay over $1000 for a brand name wind instrument, when you can build a simple and rugged one for a fraction of the price!

EDIT: I should note that I did have some initial problems with the wind vane. I was not receiving all the direction pulses; many were not there. In the plot below the top trace shows what should be received, the bottom was my wind vane.

pulsesObviously the direction reed switch was not being engaged all the time. After some investigation I determined that the small piece of shielding metal in the cup assembly was not large enough to block the direction magnet. I ended up inserting another small piece of metal (in addition to what was there already) to better block the magnet’s effect on the reed switch (see picture below). I’d be curious to know if anyone else has this problem.

IMG_0382

 

Advertisement
This entry was posted in Projects, Sailing and tagged , , , , , , , , , . Bookmark the permalink.

37 Responses to Building a NMEA 0183 Wind Instrument

  1. This just gets the mind spinning. A magnet and a reed switch and very similar code could get engine/prop RPM for which there is an NMEA 0183 RPM sentence. There are cheap temperature probes for Arduino, so air (XDR), water (MTW), engine temps could be put into NMEA too. But what I want the most is to fire laser death beams at perched birds on my masthead.

  2. Rob42 says:

    In the freeboard project I also had some users with erratic response from the peet instrument. In the end the addition of 0.01uF caps across the wires (dir wire to gnd, speed wire to gnd) stabilised it a lot. I suspect some cables pick up noise depending on the boat. Also 5V works better than 3.3V

    Have a look at signalk.org too – thats the best solution to getting at boat data

    • Tom says:

      Good idea about adding a cap, that would definitely help with noise. Although I was having these problems on my bench, before it was near the boat.

      I really love the freeboard project and the work you’ve done, nice work!

    • DavePF says:

      +1 On that! It wasn’t working for me, than I add the two 10nF cap and BINGO !

  3. Daniel Marion says:

    If I understand well (I am not very good at this), the multiplexer is necessary to connect multiple instruments. If I have only one instrument, i.e. the Peet wind vane, is it possible to connect it directly to the RPi where it can be decoded as NMEA 0183 string and sent to iSailor via WI-FI? Thanks.

    • Tom says:

      Yes, what you say is correct. The multiplexer just allows multiple inputs and multiple outputs, so you can build the project with only one in and out on the RPi. I have also been playing with a dedicated Arduino with WiFi which may be more reliable than the RPi. Hopefully I’ll have time to post about it soon.

      • Daniel Marion says:

        Excellent! Thanks. I will find or build a routine on the RPi and also wait for your post. Not needed until ice melts on the lake… 🙂

      • Tom says:

        If you use the rather excellent kplex program on the RPi (described in one of my other posts) it will be a simple configuration file change.

  4. Daniel Marion says:

    Excellent suggestion! But maybe I am missing something basic… The Peet just sends pulses. How do we translate them into NMEA sentences? Thanks again and sorry to make you endure my ignorance.

  5. Daniel Marion says:

    OK! I got my answer reading your posts. Thanks.

  6. Pingback: DIY Marine Anemometer System | Mechinations

  7. yachtdrummer says:

    Is there a link anywhere for the software?

  8. Mike Rosendale says:

    It works very well. But I had to wire like this http://www.42.co.nz/freeboard/technical/interfacing/peetbrosanemometer.html
    rather than your diagram above.. Power and ground are reversed in your diagram.

  9. Franklin says:

    Hi
    Great project for little money!

    Would like to get in touch by email we the author. My mail is

    Thank you!
    Franklin

  10. Ole says:

    Wov googled and found this, i would so much like to get fuel flow in ny gps and gph, and when i have fuel flow and mph it is easy to get gph pr hour. There is maney fuel flow readers with puls out but none with nmea out.

    • Tom says:

      I too would like to know fuel flow. There are cheap flow meters on eBay and a very similar setup to the wind circuit would make it straight forward to get NMEA data out. Something I might have to look into…

    • yachtdrummer says:

      Pretty sure fuel flow is an N2k function only and not NMEA 0183

  11. Ben says:

    How feasible do you feel it would be to send the pulses wirelessly via a solar powered RF chip?

    • Tom says:

      A good idea, but not trivial. You need low power circuitry to read the pulses at the masthead and transmit the values down periodically. There are some interesting Bluetooth Low Energy chips out now that could probably manage it.

      • Ben says:

        How much are you charging for your code, I have ordered the parts and Im going to try the Bluetooth idea.

    • Brett Howard says:

      I know you posted this a longer while ago but I’ve got a working version of this that uses Adafruit’s Feather M0 with a 915Mhz LoRA radio. You could also do it with their lower end radio but the LoRA was something I wanted to play with anyway… I don’t have a lot of diagrams and what not but the code is posted here: https://github.com/Brett-Howard/BTHMasthead/blob/master/BTHMasthead.ino. Some of the code present here was based off Tom’s excellent work. Also if you look at my other projects I’ve got the receiver piece that than receives the wireless and makes NMEA0183 and I’ve also got a full wind instrument that does MUCH more than just display the results. Also the NMEA0183 transmitter that I’m about to go and test sends the sentences necessary to make a Raymarine ST1000/ST2000 (and possibly others) able to steer to a wind course.

  12. I have been thinking of this modified to use MQTT as i have a few other things in mind, without using any NMEA system.

  13. Leon says:

    Hi Tom, this is very cool. I would like to ask two questions:
    -How do you manage to read wind direction with only two reed switches? I always thought those wind vanes would work with rotational hall effect sensors…
    -Do you think I can leave my navigation system as it is and just extract NMEA data to send to a web server? Putting the raspberry pi just in the middle, not replacing any device or display.

    • Tom says:

      Hi Leon, many vanes do use hall effect sensors. On the Peet Bros vane, the wind speed is calculated from the time between wind pulses (one period). The direction is calculated by a direction pulse which somewhere between each wind pulse. If the direction pulse comes in at say 50% of the wind pulse period, then this is mapped to 0 to 360 degrees. So 50% = 180 degrees.

      NMEA is a single talker, multiple listener system. So you could definitely set up a Raspberry Pi to listen in. Some good info here: http://www.actisense.com/wp-content/uploads/2017/07/NMEA-0183-Information-sheet-issue-4-1-1.pdf

      • leonlax says:

        Hi Tom, thank you for your quick reply and the explanation. I am quite new to this world, this might have been straightforward for others. I am looking for a sensor that I can hook up to 433 Mhz RF transmitter. Considering the power budget – I guess the Peet Bros vane requires a continuous measurement with continuous current draw. I would probably look more into rotary position hall sensor and sample the absolut position (direction) as well as turn of anemometer (speed) every 1/1000 sec. Or am I missing something here? Thanks for sharing the link, it looks promising. In your IoT Boat Monitor project – did you use the MKR1000 instead of ESP32 or Raspberry pi for any particular reason?

      • Tom says:

        I think the Peet Bros vane could work quite easily with a low power transmitter. Although one disadvantage is that at low wind speeds, you would be waiting longer for dir/speed pulses to arrive. Really the microcontroller does not need to be running most of the time. It can sleep while waiting for the next interrupt, in order to save power.

        No particular reason for using the MKR1000, both ESP32 and RPi could be used just as well.

  14. Thanks so much for your work! How did you mount the anemometer to the mast?

  15. mrarmyant says:

    I donated, how do I get the code?

  16. chevalier ronan says:

    hello very good job i want to make one but i have arduino uno and the code it for arduino mini pro
    i don t understand the programation things what s the road to take the code into arduino uno

    • chevalier ronan says:

      sorry its my ide not pstring librairy thinks a lot test when the anemometer arrive have a good day

    • yachtdrummer says:

      Google the pin deferences change the pin numbers and change your chip on the arduino compiler. Recompile.
      Then upload.

  17. Maurizio says:

    I like to use a standalone indicators with wind speed and direction.

  18. 10nF did it for me – thanks for the tip!

  19. Gabriel says:

    Hi,
    Does anyone know what’s the smallest measurable wind speed?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s