ESP12-F, DHT22-code fails

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
der_kps
Posts: 20
Joined: Sat Feb 22, 2020 6:30 pm

ESP12-F, DHT22-code fails

Post by der_kps » Thu Mar 04, 2021 8:42 pm

Hello,
I've tested my new ESP12-F with the well known 'blink.py'; it works.

In the next step I have this code:

Code: Select all

from machine import Pin
from time import sleep
import dht
sensor = dht.DHT22(Pin(14))
while True:
  try:
    sleep(5)
    sensor.measure()
    temp = sensor.temperature()
    hum = sensor.humidity()
    print('Temperature: %3.1f C' %temp)
    print('Humidity: %3.1f %%' %hum)
  except OSError as e:
    print('Failed to read sensor.')
This code is running well on ESP32 and ESP8266/D1-mini.
It doesn't run on ESP12-F. I get only the message 'Failed to read sensor.'

Why That, what's wrong?

Best regards

der_kps
Posts: 20
Joined: Sat Feb 22, 2020 6:30 pm

Re: ESP12-F, DHT22-code fails

Post by der_kps » Fri Mar 05, 2021 11:28 am

Code update:

Code: Select all

except OSError as e:
    print('Failed to read sensor: ', e)
shows
Failed to read sensor: Errno [110] ETIMEDOUT

Timeout occurs immediately after

Code: Select all

sensor.measure()

der_kps
Posts: 20
Joined: Sat Feb 22, 2020 6:30 pm

Re: ESP12-F, DHT22-code fails

Post by der_kps » Sun Mar 07, 2021 10:22 pm

Solved,
Powersupply causes the Problem!

DHT22: 3.0V >= Vcc <=6V
ESP12: 3.0V >= Vcc <=3.6V
FTDI-Powersupply (PS): a) 3.1V b) 3.5V

I think the accepted low/high potential between both units are in a critical situation.
It works with PS b)
It fails with PS a)

Using 5V (USB) for DHT22 and reducing the voltage at Pin D to 3.3V for ESP12 makes a correct working with PS a)

Post Reply