I am following a book and I am making a temperature alert system with a RBG led and a DHT-22 sensor. the book says that to get the voltage you use this: Temperature(Celsius)*10 = voltage(mV)-500. I tried this but I got a different answer than what the book had given as an example. Please help me understand this.
Welcome to the forum
What is the voltage referred to in the formula ?
If it is the supply voltage is it 5V or maybe 3.3V and what is it in the example circuit in the book ?
Which Arduino board does the book use and which are you using ?
Please post the code you used that got a different or wrong answer to the code you might post also that got the right or different answer.
Short story: you doing something different one to the other.
We needa see that.
a7
From some quick research... The DHT-22 is digital so there's no analog voltage relationship to temperature or humidity.
Adafruit has a link to some sample code.
And in case you don't know this, when you are using analog the Arduino ADC reads voltage, but not in "volts"... The raw analog readings have to be scaled to get a voltage. The "regular" Arduino with a 5V reference and a 10-bit ADC maxes-out at 1023 with 5V on the ADC input.
...So when you do have an analog temperature sensor you can modify/simplify the formulas to skip the conversion to voltage.
That's the formula for a TMP36, at 25C the TMP36 outputs 750mV, 25 * 10 = 750. 750 - 500 = 25.
Nothing to do with DTH22 which outputs serial data.
I think there is a clue to that in the name of the sensor- DHT stands for Digital Humidity and Temperature.
I think I figured it out thank you all that responded.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.