Analog Pin 5------|
-----------| To weather vane
| (mystery resistance)
the above is a circuit diagram from a bit of example code for SparkFuns weather meters that I have just ordered and hoping to have some fun with.
I am aware they make a arduino board especially for the equipment, but wheres the fun it that?
Basically what I want to know is, how is it that the signal going to pin 5 changes? surely it will remain contant and the read needs to be taken after the weather vane?
parts havn’t arrived yet so cant play (got shipped today)
yes i saw those, but, they go straight over my head in all honesty, so in laymans terms...
how is it that the signal going to pin 5 changes?
Look at the sparkfun datasheet, the resistance on the vane varies with the angle it’s at. The voltage read by the arduino pin varies depending on the proportions of the two resistors in the divider. if the vane resistance is 10K, you’ll get 2.5V. If the vane resistance is 0, you’ll read 0V. If the vane resistance is huge, it’ll be almost 5V. Similarly, other vane resistances will give results in between which the voltage divider pages above should tell you how to calculate.
now i understand, thank you!
Or if you want the math treatment (since i'll feeling patient :) ) -
VOltage across the two resistances = 5V = Voltage drop across Resistance 1 (V1) + Voltage drop across Resistance 2 (V2). V2 is the voltage you'll see on Arduino pin.
Ohm's Law: Voltage (V) = Current (I) * Resistance (R)
Resistance R1 = 10kOhm, Resistance R2 = your weather gizmo.
However, current flowing through the wire from 5V to Ground (neglecting the very very minor amount that will flow through Arduino pin) is the same, ie = I
Therefore, V = V1 + V2 = I*R1 + I*R2 = I*(R1+R2)
ie. "equivalent resistance" of 2 resistors connected in series = R1 + R2
or re-arranging, I = V/(R1 + R2)
Therefore the voltage you'll see at Arduino Pin = V2 = I * R2 = V/(R1 + R2) * R2 = V*R2/(R1 + R2)
And so you see how the voltage you see on Arduino pin is affected by R2
i think i understood that, thank you both
now all i need is Mr FedEx to drop the bits of and dig out a resistor and a new protoboard and play (maybe a new arduino if i think it works well enough)
Go check out the Falstad circuit simulator (Google it, it's easy to find). Build a circuit with a voltage source, gnd, a resistor, a piece of wire (that you can add to a virtual scope) and a potentiometer. Build your vane circuit with those pieces, then change the pot value to see how it changes the voltage in the wire between the two resistors. It's a great visual aid to the math.