Getting the actual values

From SquidBee

Jump to: navigation, search

Maths to get the values from sensors

Value (in volts) from an analog input is => V (volts) = analogRead(0) * 5 / 1024

Humidity sensor

image: Humidity_value.jpg

Humidity (%) is => H (%) = 32.25 V - 25.81

H(%) = (analogRead(0) * 5 / 1024.0) * 32.25 - 25.81

that matches:

0.8V => 0%

3.9V => 100% (see picture)

Temperature sensor

LM35 Temperature sensor provides 10 mV/ºC

So Temp (ºC) = V (volts) / 0.01

Temp (ºC) = (analogRead(0) * 5 / 1024.0) / 0.01

Light sensor

Light sensor is a LDR (Light dependent resistor) connected with a pull-up resistor

analog sensor connection
analog sensor connection

For this sensor we have to callibrate with 100% light (aprox.) and dark, I got the next values:

From analogRead =>

dark => 0

100 % light (down an UV lamp) => 950

So I can stimate Light (%) = (100 / 950) * analogRead()

Personal tools