Error with ESP32 DEVKIT V1 as BLE Gateway with DHT22 sensor

Hello,

i am using an ESP32 DEVKIT V1 as you can see here: Link
I want to use it as an BLE gateway to connect my LYWSD03MMC temperatur and humidity sensors to MQTT and from that to openHAB. Additionally i want to connect a DHT22 to the board to measure temperature and humidity at the board as well.
I have downloaded the sourcecode of the latest release v.0.9.10 from github and edited the following lines in the platformio.ini file:

[env:esp32dev-ble]
platform = ${com.esp32_platform}
board = esp32doit-devkit-v1
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.wifimanager32}
${libraries.ble}
${libraries.decoder}
${libraries.dht}
${libraries.unifiedsensor}
build_flags =
${com-esp.build_flags}
‘-DZgatewayBT=“BT”’
‘-DLED_SEND_RECEIVE=2’
‘-DLED_SEND_RECEIVE_ON=0’
‘-DGateway_Name=“OpenMQTTGateway_ESP32_BLE”’
‘-DZsensorDHT=“DHT”’
‘-DESPWifiManualSetup=true’
‘-Dwifi_ssid=“Mynet”’
‘-Dwifi_password=“Mypassword”’
‘-DMQTT_SECURE_DEFAULT=false’
‘-DMQTT_SERVER=“MyIP”’
‘-DMQTT_PORT=“1883”’

I uncommented the line:

default_envs = esp32dev-ble

above in the platformio.ini file as well. The remaining firmware is completely untouched.

If i compile and upload the code with platformio the software starts and prints the following lines at the beginning over the serial terminal:

************* WELCOME TO OpenMQTTGateway **************
N: OpenMQTTGateway Version: version_tag
N: WiFi ok with manual config credentials
N: BLE scans interval: 55555
N: BLE scans number before connect: 10
N: Publishing only BLE sensors: false
N: minrssi: 100
N: Low Power Mode: 0
N: Reading DHT on pin: 16
N: OpenMQTTGateway modules: [“BT”,“DHT”]
N: ************** Setup OpenMQTTGateway end **************

The BLE connections and the MQTT connections seems to work properly but the DHT22 sensor can not be readed.
I get everytime the failure over the serial terminal:

E: Failed to read from DHT sensor!

The sensor and the ESP is functinonal, i checked booth together with a small testprogramm. I see some communication as well on the data pin of the DHT22 with an logic analyzer but it seems that the transfer stops too early.

Can somebody help me with my problem or do i configure the software the wrong way?

Hi;

Do you have a photo of your setup so that we can check wiring?

This wiring setup is working with a small testcode included in the standard dht library available for the arduino framework.
The data line of the dht is pulled up with 10k resistor. As well the supply is buffered with a 100nF capacitor as near as possible on the VCC pins of the Sensor.

Can you try it with the test code of the library that OMG download. You should have it into .pio/libdeps

Yes i tried it with “DHT sensor library@1.4.2” together with “Adafruit Unified Sensor@1.1.4”. It works perfectly standalone with just a serial connection.