ESP8266 + DHT... Temperature conversion
ESP8266 + DHT... Temperature conversion
In a sketch for ESP8266 + DHT, how to change temperature from Celsius to Fahrenheit?
Re: ESP8266 + DHT... Temperature conversion
Hi jovosm,
Thanks for trying AskSensors. Could you please specify the ESP8266+DHT sketch do you use?
Thanks
Thanks for trying AskSensors. Could you please specify the ESP8266+DHT sketch do you use?
Thanks
Re: ESP8266 + DHT... Temperature conversion
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
https://github.com/asksensors/AskSensors-ESP8266-DHT
Re: ESP8266 + DHT... Temperature conversion
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:
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
It works now.
Thank You!
Thank You!
-
- Noob
- Posts: 1
- Joined: Wed Aug 21, 2019 8:28 pm
ESP8266 DHT Temperature conversion
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
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
Hello,
Could you please provide the connection diagram of your DHT22 and Oled.
Thanks.
Could you please provide the connection diagram of your DHT22 and Oled.
Thanks.