Tuesday, June 15, 2010

Wind Direction Finder: Building and Coding

I've made steady progress on the small boat wind direction finder. Soon after the magnetic shaft encoder arrived in the mail, I mounted it to a 1/2 inch pvc end cap and attached a phone jack to the 5V, analog, and ground leads. This end cap/sensor configuration will be secured to the boat on the end of a foot long length of 1/2 inch pvc pipe. The pipe will raise the vane above the mast, away from the sails and lines as well as provide a solid, but removable way of attaching the sensor. (see photo below)

Before coding, I connected the sensor to the "analog input 0" pin on the Arduino (female phone jack ->; screw down electrical connector ->; breadboard ->; Arduino... a very round about way of doing things but it works) to feed sensor data to the micro controller. From here it was straight forward to write a code that would map the sensor readings to 360 degrees of wind direction. (see above photo)

Turbulent airflow around the wind vane, vibration in the boat, and the high sensitivity of the sensor will all cause an undesirable rapid change in the readout of wind direction. This can be solved by taking a number of readings within a short period of time and averaging them to provide the wind direction, free from unwanted "noise". Converting the code to produce an average reading proved somewhat problematic. Sensor readings close to "dead ahead" are either large (close to 360) or small (close to 0), but averaging these gives headings around 180, the completely opposite direction! With a bit of math and a few if statements I was able to hash out an averaging system that gives accurate readings in any direction. (for those interested in how this works just e-mail me, I'll explain and send you the code)

The remainder of the project is mostly mechanical in nature. A wind vane needs to be attached to the sensor, the pvc pipe needs to be affixed to the mast, wires run, and a dial created for easier readout. More to come later....

Saturday, June 5, 2010

Arduino METAR Weather Reporter

For those who can't view the video or are looking for a bit more explanation, I'll explain what's going on. The Arduino is wired via breadboard to control the 16x2 LCD character display. The code running on the Arduino scans the incoming data on the (virtual) serial port and when it sees a '#' identifier it loads the subsequent 46 characters into its memory. It then divides the weather data to the two lines of the LCD and discards extra information like the airport identifier and 'remarks' section.

The code running on the computer is written in Processing and controls the data being fed to the Arduino. The program begins by loading Weather Underground and looking for the appropriate airport identifier. Once found, it takes the following text (the current weather information) and sends it to the Arduino through the serial port.

METARs are a good source for uniform weather data. The same METAR standard is used world wide, meaning any weather website (not just Weather Underground) and any airport identifier could be input into the program and used to display current weather.

Thursday, June 3, 2010

A Wind Direction Finder for Small Boats

My dad has been an avid small boat sailor his whole life and has shared his passion with me by taking me sailing many times.  Being a tinkerer, he continually improves his boat, changing cables, removing winches, adding lines, etc. to make sailing easier (and faster).  He recently sold his Coronado 15 and purchased a Holder 20, and as you might expect, many new alterations needed to be made from the get go.

A Holder 20 (not my dad's)
One such improvement was to address an issue all small boat sailors face: how to see the tiny wind vane atop the mast. Knowing the wind direction is crucial because it allows the sails to be set to best take advantage of the wind. The vane needs to be at the top of the mast, clear from interference from lines and sails, but this location is difficult to see being far away, in an awkward location, and more often than not - directly in the sun. (The wind vane in the above photo can be seen as a black speck above the mast)

There are existing systems that will transmit wind speed and direction data to a screen mounted in the cockpit of the boat. However, you've got to be prepared to fork out the cash. This entry level system from Tacktick (http://www.tacktick.com/products/145) costs £459.99... that's over $900 American! ...and cost prohibitive for many small boat sailors.

Enter the Arduino micro-controller solution. I proposed that a practical solution was feasible using an Arduino to detect wind direction and display it in the cockpit for a fraction of the cost of existing products. With my interested father as a corporate backer, I've set out to design and build said instrument.

The R&D for this project will be broken up into a couple stages. First, an appropriate sensor needs to be found that will output angular position over 360 degrees. The sensor shaft also needs to be able to continuously rotate so as not to provide faulty data after reaching an end stop (as would be the case with most potentiometers). After some online research, I found this device (http://www.usdigital.com/products/ma3/) from US Digital that should fit the bill. The sensor must then be mounted to the mast with an appropriate wind vane.

Second, the sensor must be connected to the Arduino (by a small cable through the mast) and a suitable program written to collect the incoming analog data and process it into a usable information. (Note: I imagine some form of averaging needs to be performed to reduce jitter and provide a more stable readout)

Lastly, a display needs to be made to make the wind direction information easily viewable. Ideally, I'll have an LCD screen showing wind direction relative to boat position, but as a simpler prototype I could create a ring of LEDs indicating wind direction.

Once a working system has been developed, further improvements could be made such as: wireless transmitting from wind vane to Arduino, powering the device via solar panel, adding a hot-wire anemometer, temperature gauge, or solid state magnetometer for additional nautical data.

I'd like be able to build the project for under $100 (nearly 1/10 the cost of the TackTick), but knowing how project costs quickly add up (see this blog entry), I think I'll double that and hope for the best. Either way, it should be a great solution! Stay tuned...