Page 1 of 1
ESP8266 + DHT... Temperature conversion
Posted: Fri Jun 28, 2019 3:13 pm
by jovosm
In a sketch for ESP8266 + DHT, how to change temperature from Celsius to Fahrenheit?
Re: ESP8266 + DHT... Temperature conversion
Posted: Fri Jun 28, 2019 11:11 pm
by AskGuru
Hi jovosm,
Thanks for trying AskSensors. Could you please specify the ESP8266+DHT sketch do you use?
Thanks
Re: ESP8266 + DHT... Temperature conversion
Posted: Tue Jul 02, 2019 3:07 pm
by jovosm
It's example sketch how to connect ESP8266 and DHT sensor and how to connect to asksensor.com and see temperature and humidity.
https://github.com/asksensors/AskSensors-ESP8266-DHT
Re: ESP8266 + DHT... Temperature conversion
Posted: Thu Jul 04, 2019 11:49 am
by Guru
jovosm,
You can convert the temperature from degrees Celsius to Fahrenheit just after reading it from the sensor and before sending it to the AskSensors cloud: by multiplying by 1.8 (or 9/5) and adding 32.
here is an example:
Code: Select all
// Get temperature event and print its value.
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
Serial.println("Error reading temperature!");
}
else {
// Update temperature and humidity
myTemperature = (float)event.temperature;
myTemperature = (float) (32 + myTemperature * 9/5);
Serial.print("Temperature: ");
Serial.print(myTemperature);
Serial.println(" C");
}
Re: ESP8266 + DHT... Temperature conversion
Posted: Fri Jul 05, 2019 3:14 pm
by jovosm
It works now.
Thank You!
Re: ESP8266 + DHT... Temperature conversion
Posted: Thu Jul 11, 2019 10:23 pm
by Guru
Great!
ESP8266 DHT Temperature conversion
Posted: Tue Sep 03, 2019 8:35 pm
by BeJimmieCligo
Hi,
I am working with a DHT22 Humidity Temperature Sensor and an OLED screen on a Ether Ten.
I have the OLED wired exactly like the first example on the oled128-quickstart-guide page, using just the 7 pins required for the OLED not the SD
I initially used pin 4 for the DHT22, but could not get it to work..
When I move the DHT22 to pin 5 it does work.
Can anyone advise why it doesnt work on pin 4 ?
Is it because the OLED pin 6, MOSI is connected to ICSP 4 ?
Thanks
Sean
Re: ESP8266 + DHT... Temperature conversion
Posted: Tue Sep 03, 2019 10:57 pm
by Guru
Hello,
Could you please provide the connection diagram of your DHT22 and Oled.
Thanks.