PaulRB / Wemos-Weather-Station

Outdoor Weather Station with Wind Speed, direction &Rainfall sensors
56 stars 7 forks source link

Question about voltage measurement #2

Closed beicnet closed 5 years ago

beicnet commented 6 years ago

What is it represents?

double battLevelNow = analogRead(BATT_LEVEL) / 209.66; // assumes external 180K resistor

209.66 Measured resistor value by multimeter or?

PaulRB commented 6 years ago

It's a value calculated to give a known output voltage in the above formula, compared to my (inexpensive) multimeter. You can adjust the value for you own circuit if required.

beicnet commented 6 years ago

Okay @PaulRB so how did you calculate it and by what formula any explanation?!

Thank you

PaulRB commented 6 years ago

I calculated it with basic School maths!

Connect a voltage to the analog pin (via the 180K resistor). Measure that voltage with your multimeter, let's say that's 3.27V for example. Take the raw analogRead() value, let's say that's 686. Divide one by the other, you get 209.66.