ESP8266 + DHT... Temperature conversion

Post Reply
jovosm
Noob
Posts: 3
Joined: Fri Jun 28, 2019 3:10 pm

ESP8266 + DHT... Temperature conversion

Post by jovosm » Fri Jun 28, 2019 3:13 pm

In a sketch for ESP8266 + DHT, how to change temperature from Celsius to Fahrenheit?

AskGuru
Site Admin
Posts: 6
Joined: Sat Dec 15, 2018 5:14 pm

Re: ESP8266 + DHT... Temperature conversion

Post by AskGuru » Fri Jun 28, 2019 11:11 pm

Hi jovosm,

Thanks for trying AskSensors. Could you please specify the ESP8266+DHT sketch do you use?

Thanks

jovosm
Noob
Posts: 3
Joined: Fri Jun 28, 2019 3:10 pm

Re: ESP8266 + DHT... Temperature conversion

Post by jovosm » Tue Jul 02, 2019 3:07 pm

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

Guru
Simple
Posts: 20
Joined: Tue Dec 18, 2018 11:36 pm
Contact:

Re: ESP8266 + DHT... Temperature conversion

Post by Guru » Thu Jul 04, 2019 11:49 am

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");
}


jovosm
Noob
Posts: 3
Joined: Fri Jun 28, 2019 3:10 pm

Re: ESP8266 + DHT... Temperature conversion

Post by jovosm » Fri Jul 05, 2019 3:14 pm

It works now.
Thank You!

Guru
Simple
Posts: 20
Joined: Tue Dec 18, 2018 11:36 pm
Contact:

Re: ESP8266 + DHT... Temperature conversion

Post by Guru » Thu Jul 11, 2019 10:23 pm

Great!

BeJimmieCligo
Noob
Posts: 1
Joined: Wed Aug 21, 2019 8:28 pm

ESP8266 DHT Temperature conversion

Post by BeJimmieCligo » Tue Sep 03, 2019 8:35 pm

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

Guru
Simple
Posts: 20
Joined: Tue Dec 18, 2018 11:36 pm
Contact:

Re: ESP8266 + DHT... Temperature conversion

Post by Guru » Tue Sep 03, 2019 10:57 pm

Hello,
Could you please provide the connection diagram of your DHT22 and Oled.
Thanks.

Post Reply