ESP8266 & DHT22 Lowpower MQTT Sensor

For my project where I control my remote via pnps I want to create a low power sensor which will be able to send humidity & temperature data to my openhab server which is running mosquitto

Since I have some esp8266 chips laying around, this would be great to setup as a wifi mqtt sensor with the dht22, which will periodically (every 10 minutes) send new sensor data to my mqtt broker.

A quick video how to get a basic breadboard setup:

I will need it to be pretty energy efficient, so whenever the esp is done sending data, it will go into deepsleep for 10 minutes, and then wakeup and send again…

My Test setup:

esp-test-setup
Remember on the ESP12-E

  1. in order to be able to upload a sketch, you need to connect GPIO0 to gnd
  2. In order to be able to wakeup the esp you need to :
    • connect GPIO16 <-> RESET
    • connect GPIO0 & GPIO2 To high (with a resistor, if your esp didn’t come with a breakout board with resistors.

Needed libraries:

My test Code:

Because I like to seperate things, my Sensor.h file (which is included in above file)

At this point I’m measuring 88uA with my multimeter, when the esp8266 is sleeping.
current