temperature_humidity_and_pressure_meter_to_mqtt_bme280

This is an old revision of the document!


temperature humidity and pressure meter to mqtt (bme280)

i wanted to log temperature and humidity values in my sons room as he caughed a lot during the first winter and we had to buy a humidifier. i therefore ordered a BME280 module off Aliexpress for $2.18 (i know, only the best for my kid ;)). The sensor actually mesures both temperature and humidity at a good accuracy and as a “free” bonus it also measures the airpressure.

my plan is to connect it to a wemos D1 mini and then publish the values via mqtt so i can log them in Home Assistant, Node Red, thingboard or somewhere else.

first try was with the OpenMQTTGateway as i had the arduino IDE ready to go and the code configured and compiled from trying to set up an ble_mqtt_gateway which sadly did not work, probably due to a DOA module. however, read that article on setting up the OpenMQTTGateway software for flashing. for the BME280 to work you need to enable the ZsensorBME280 in User_config.h, the rest is identical.

the hardware wiring by default looks like this:

I2C Module NodeMCU / ESP8266
Vcc Vu (5V)
GND GND
SCL D1
SDAD2
ADD N/C (Not Connected

at least with this sensor it worked right out of the box and reported all sorts of measurements. i could track them using the serial console or via a mqtt client like so:

mosquitto_sub -h 192.168.168.1 -u myuser -P mypass -v -t home/#

i think OpenMQTTGateway is still rough around the edges, it works and all but for example the web interface to configure the device is only available if it can't connect to a wifi and therefore goes into setup mode.. this is not ideal as the mqtt parameters could also be managed in there.

so lets try also

also check out my detailed description for the sonoff setup. basically download the latest release and then copy the lib folder into your arduino sketchbook/libraries folder. then edit the my_user_config.h file and make sure the is enabled.

the hardware setup looks like this:

  • temperature_humidity_and_pressure_meter_to_mqtt_bme280.1546905255.txt.gz
  • Last modified: 08.01.2019 00:54
  • by Pascal Suter