In a previous post i wrote about integration of a netatmo weather station into a telegraf/influxdb/grafana stack. The second part of the project was to build a weather sensor for my basement and to integrate it into this stack.
The used esp8266 is a cheap low-power 32bit microcontroller often used for IoT devices. I used a Sparkfun “The Thing” board because it already has a LiPo-charger and a connector for an external antenna on board. But the board has no build in serial/usb connector. You have to connect a USB-RS232 temporary for programming the chip. I used a simple FTDI breakout.
The sensor chip is a DHT22. A digital sensor for temperature and humidity. Since it uses a digital protocol wiring is really easy. Just connect it to 3V3 and GND for power and to a GPIO pin for data.
On the software side i used ESPEasy which is a complete firmware for the esp with everything included. It just must be compiled and falshed. Then everything can be configured by browser. I patched it a little bit to also calculate the value for absolute humidity.
I’m using the build-in “OpenHAB MQTT” connector to upload values to an mosquitto mqtt broker. This format could be read with telegraf with the following configuration:
servers = ["mosquitto:1883"]
qos = 0
topics = [
persistent_session = false
client_id = ""
data_format = "value"
data_type = "float"
username = "<user>"
password = "<secret>"