Wind Logic

To find the wind direction

The simplest solution is a weather vane. But for a small model boat can the wind be deduced from the leaning of the boat? Also a small boat requires a tiny weather vane that might break easily.

Logic beginning

Lets assume the wind is from the North. As the boat rotates through 360 degress (whole circule) it is reasonable to assume the boat will lean half the time to starboard and half the time to port. In practice this will not be the case, but it should be fairly close. When the boat leans starboard, store 1 against the heading and 0 for port. To avoid any natural tilt in the boat then the roll left or right can be calculated from the median (the middle reading).

Wind

Wind calculations

Excel to check wind logic click here.

Sequence of 1s

With the wind from the North we would expect a sequence of 1s from degrees 0 to 180, followed by a sequence of 0s. To give another example, lets assume the wind is from the East. Then we would expect a sequence of 1s from 90 to 270 degrees. The wind direction is detected when the sequence of 1s start. The task now is to find where the 1s start. Of course it will be the relative wind direction to the boat, but that is ok.

Wind

In practice

In practice the forces on the boat knock it around so we do not expect a perfect sequence of 1s. We don't look for that. What we look for is the sequence of 180 consecutive degrees that give the closest approximation to a sequence of 1s. This can be done by summing 180 degrees and finding the starting degree that gives the highest sum. In practice rather than 1 degree resolution, I've used a 10 degree resolution.

Wind

Westward

The chart below shows some results. The horizontal axis shows the number of readings. The vertical axis shows degree/10. The flat lines are when the boat is on land doing nothing but there are two separate sails in the middle. The wind changes over time but the chart shows that a wind of around 210 degrees to 350 degrees was experienced, North Westerly.

I am not sure yet if this is accurate enough, but my objective is not to know the exact direction of the wind but just enough that the boat does not sail into the wind.

Wind

Wind calculations

Excel to check wind logic click here.

Wind.h

Wind.cpp