Wind Directio Sensor Values Not Changing

I am using a wind direction sensor which uses an arrangement of resistors based on which one should be able to measure different values based on the direction. However, my input is not changing. Pretty basic but I do not see the problem. Any help appreciated. I am using this setup (except for a Mega Board I use a MKR):

and the following code:

int analogPin = A0; // potentiometer wiper (middle terminal) connected to analog pin 3
                    // outside leads to ground and +5V
int val = 0;  // variable to store the value read

void setup() {
  Serial.begin(9600);
  pinMode(A0, INPUT);           //  setup serial
}

void loop() {
  val = analogRead(analogPin);  // read the input pin
  Serial.println(val);          // debug value
}

Did you select the correct wires for the wind vane?

Do you have a meter capable of measuring Ohm's?

10 Ohm is not a lot of resistance.

Anyways do you have a meter to measure Ohms'?

I used a 5.1K ohm resistor between ground and the wind vane. I tied the other wind vane pin to Vcc. I take the reading from the top of the 5.1K resistor and send that to the A:D pin.

2 Likes

Please post a link to some documentation of that wind item.

1 Like

As @Idahowalker says, 10 ohms is not enough. My system with the same sensor running at 3V3 uses 10K.

1 Like

What non-changing value do you get? Zero would mean one thing. 1023 would mean something else.

2 Likes

It's most likely some variant of this.

1 Like

Thanks. Some variant of this..... You need to find the resistanses in the exact unit You have. Verifying the principle is also needed.
As already told, change that 10 Ohm to 10 000 Ohm.
Lock the wing in different directions and measure the resistans. Use a digital multimeter.

1 Like

It's possible for two resistors to be activated at a time so you need to take that into consideration in the code. I found it difficult to hold the wing steady enough to make the measurements so I disassembled mine and measured the resistors directly.

Okay, the 10 to 10k swap did the trick. Thanks for all your replies!

Good luck identifying/verifying the angles. Eventually the 10k might have to be different. Note the max and min readings in the controller. min voltage minus GND ( 0 ) and Vcc volt minus max ought to be similar but don't need to be exact the same. This gives You the best resolution being good for the coding. Measure the actual Vcc!

I don't understand what you're saying here. Can you elaborate?

As an aside, I coded my project in Python and used a function from the math module called "isclose" which made the direction lookup really simple. There may be a C++ equivalent.

Also, I fiddled around with the divider resistor value before settling on 10K. Some of the voltage steps are pretty small and I used a 12-bit ADC to get more resolution. I also used a voltage reference chip to improve the stability. It was a challenge getting all the possible directions indicated reliably.

Theory doesn't look like what You need.

Try using 5k, 10k, 22k and see which resistor gives You the best detection of the angles.

The circuit You have is a voltage divider. If the stationary resistor, the 5, 10 or 20k resistor matches the average of the sensor resistors the detection gives the most useful data.

Ah, okay.

That's basically what I did and it works fine. Average is around 31K and I don't think I tried that high. That value doesn't help anyway with the directions that are very close together, voltage wise.
I'm not sure how the designer came up with the values they used but I have to believe there is a better set. The resistors in the sensor are SMD so I'm not tempted to swap them out but I might see if I can calculate a better set as a thought experiment.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.