Arduino Wind Indicator

Arduino Wind Indicator

I worked on my wind indicator app a little bit. I am using an optical encoder to determine wind angle, it has a 3ish degree of precision (kinda). The device has 10 pins, 8 of those being digital pins. These connect to 8 different pins on an Arduino. Then in the schematic there is a translation table to get the correct position.

So in the Arduino, I wanted to avoid having a huge lookup table. Luckily I can use the output code to get an integer and then only look at that. However because there are 128 outputs and 256 possible codes, I need to do some math outside of the table to get the correct values.

I asked ChatGPT to fill in the missing numbers and approximate which code missing numbers from the lookup should flip to. It did OK, but it skipped numbers, it wrote the wrong number in, or it just got the numerical order wrong. It was just good enough to be convincing, but also bad enough to be unuseful. Microsoft copilot yielded similar results.

Finally, I decided on my own solution. I wrote a simple console application. It adds in my missing numbers and gets a close guess at the code to use. It works fairly well. I then output a comma-separated list and use that string to populate an array in my Arduino application.

The solution works pretty code, I take the 128 codes that are possible and multiply that by 2.83 and that gives me a pretty good idea of the angle.

Next, I need to output the code to a structured string broadcast over BLE. Then Optimize it down to limit power usage to as low as possible. Then I will pull that code down to another Arduino and output it to a display.

From that, I will either add a GPS to calculate speed over ground. Because my wind speed will only be giving me apparent wind, I will need to use the GPS speed to calculate true wind. I could also throw in some additional sensors to get temp and humidity.