I’m struggling to calibrate the ADC values using the calibration helper example provided in the SparkFun Weather Meter Kit library. The wind vane does not appear to produce unique ADC values for all 16 documented positions. Several different physical angles produce the same ADC reading, so some of the 22.5° increments are not electrically distinguishable. As a result, I can’t create a reliable 16-position calibration table. It’s extremely confusing.
Hi, which microcontroller are you using?
Page 2 on the datasheet might help.
While it’s possible you might see more than 8 unique resistance values from the wind vane, I’d only count on 8. Check the wind vane with an ohm meter, you should see 8 different values that are very close to the values in the table on page 2. More than 8 is a bonus, less than 8 and you have a defective sensor.
Please post the table the table that you get, so that forum members can better understand the problem.
Agree, this is a particularly easy sensor to test. Make sure the passive resistances are measuring close-ish and then move on to the instrumentation measuring ADC values.
@Yolk IF you are talking about their SEN15901 anemometer, it does produce all 16 subordinals. The problem there is that this uses reed valves, so the sub-ordinals are caught only when 2 of the valves are open at once, which is an extremely thin sliver of angle.
I connected a decent multimeter to the station and measured voltage as I was slowly turning the vane by hand.
And when I say slowly, I mean as slow as one whole 360 turn in 5 minutes. There are all 16 positions, but the sub-ordinals (the other 8) are so incredibly thin in range, it is a fraction of a millimeter of movement to catch them. I had to do several turns of the vane to catch all 16 and many times had to back track to catch some. I think my SSW was the absolute worst to catch.
So yes, there are all 16, but in practical life, when I look at my raw data, there is a very very low chace (single digit %) for me to actually catch them.
So for all intents and purposes this vane is for the 4 cardinals (N,S,E,W) and the 4 ordinals (NW, SW, etc…). The subordinals (NNW, NNE, etc…) are technically there, but in real life are useless.
It took me over half hour to calibrate this vane. Works great. I can’t say that about the anemo - I think I have a bad bearing after only 3 months of use and that is sad.
Here is my table - of course this depends on which direction your station is positioned at, but at least you can see my measured voltages as they go in circle.
| Heading | Degrees | Resistance | Voltage Masured |
|---|---|---|---|
| N | 0° | 33K | 2.02v |
| NNE | 22.5° | 6.57K | 2.01V |
| NE | 45° | 8.2K | 3.03V |
| ENE | 67.5° | 891 | 2.83V |
| E | 90° | 1K | 2.84V |
| ESE | 112.5° | 688 | 2.25V |
| SE | 135° | 2.2K | 2.51V |
| SSE | 157.5° | 1.41K | 1.30V |
| S | 180° | 3.9K | 1.47V |
| SSW | 202.5° | 3.14K | 1.48V |
| SW | 225° | 16K | 0.29V |
| WSW | 247.5° | 14.12K | 0.21V |
| W | 270° | 120K | 0.59V |
| WNW | 292.5° | 42.12K | 0.40V |
| NW | 315° | 64.9K | 0.91V |
| NNW | 337.5° | 21.88K | 0.92V |
It does, but they are unusable in real life they are useless.
One would expect 16 ordinals to be 22.5 degrees each, but on this vane, based on my rough measurements, the cardinals and ordinals take 22 degree slices and the subordinals are the remaining 2 degrees, and in some case are rather in minutes than degrees. So, pointless for any meaningful measurement.
@Yolk It appears that that particular sensor is defective. Ask Sparkfun for a replacement. Although, as reported above, you are not alone in being disappointed.
They do hint at the anticipated disappointment in the kit description:
Reports wind direction as a variable voltage produced by a combination of internal resistors. While it can technically indicate up to 16 positions, it reliably resolves eight cardinal directions (N, NE, E, etc.).
I suggest to remove the resistors and read the reed relay switches out directly. By rewiring the switches similar to a matrix keyboard, you can significantly reduce the number of MCU I/O pins required. There will be no ambiguity as to which switches are closed.
I have a similar wind direction sensor (without the resistors) that is wired in a 4x2 matrix, so six pins are required. It is certainly not perfect, as in intermediate positions, the magnet does not reliably close both of the two closest reed relays.
That usually happens because you’re either using the MCU’s loose internal pull-up instead of a proper external 10k resistor (which throws off the divider ratios so the parallel reed-switch steps overlap), or you’re running it into a non-linear ADC like on the ESP32 where the voltages near the rails get squashed into the exact same ADC count, so throw a solid external 10k pull-up to your 3.3V/5V rail and measure the actual voltage on each of the 16 positions slowly by hand.
The library just picks the closest ADC value from the calibration table. So if two positions give almost the same reading, it won’t be able to reliably tell them apart.