Closed rradar closed 6 years ago
@mhaack could a Schwedenbecher help?
I think for the BME280 it could be the following wiring:
BME / ESP
VIN 3V3
GND GND
SCL D4
SDA D3
Took this from here: http://embedded-lab.com/blog/making-simple-weather-web-server-using-esp8266-bme280/
For the display I have no clue till now...
I think that makes sense. But there are different layouts of the ESP boards like Nodemuc or Wemos. You have to figure out which pins they use for I2C. The display used I2C as well, connect them to the same pins on the ESP board. But there are different flavors of it with 4,5 or 6 you need to check the board.
I tried my best, don't know if it's correct:
BME280 | SSD1306 | WeMos D1 mini | NodeMcu | Generic |
---|---|---|---|---|
VIN | VCC | 3V3 | 3V3 | 3V3 |
GND | GND | GND | GND | GND |
SDA | SDA | D2 | D2 | GPIO-4 |
SCL | SCL | D1 | D1 | GPIO-5 |
What do you think about releasing a binary to download?
Hmm don't get it running :-1:
Firmware flashed and setup:
Firmware mqtt-gateway-bme280 (1.1.0)
Booting into normal mode
{} Stored configuration
• Hardware device ID: xyz1234567
• Device ID: xyz1234567
• Name: bme280
• Device Stats Interval: 60 sec
• Wi-Fi:
◦ SSID: WAN.lan
◦ Password not shown
• MQTT:
◦ Host: MQTT.lan
◦ Port: 1883
◦ Base topic: homie/
◦ Auth? no
• OTA:
◦ Enabled? no
• Custom settings:
◦ flipScreen: 0 (set)
◦ sensorInterval: 10 (set)
◦ temperatureOffset: 0.00 (set)
BME280 sensor not found. Check wiring!
OLED DisplayNode setup successful!
↕ Attempting to connect to Wi-Fi...
✔ Wi-Fi connected, IP: 192.168.100.91
Triggering WIFI_CONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
Calling setup function...
〽 Sending statistics...
• Wi-Fi signal quality: 74%
• Uptime: 1s
It says the sensor was not found but beside that the display also stays off...
and so it goes on...
〽 Sending statistics...
• Wi-Fi signal quality: 84%
• Uptime: 7801s
〽 Sending statistics...
• Wi-Fi signal quality: 86%
• Uptime: 7861s
〽 Sending statistics...
• Wi-Fi signal quality: 80%
• Uptime: 7921s
〽 Sending statistics...
• Wi-Fi signal quality: 88%
• Uptime: 7981s
but nothing to collect and nothing to show :-1:
Do you have SDA/SCL reversed? (affects display and BMP) Do you use the correct I2C Address for the BMP? (they have 0x76 or 0x77) Did you run an I2C scanner or your ESP? Does it detect the display and the BME?
Take a look at https://github.com/luebbe/homie-display and https://github.com/luebbe/homie-node-collection. There you will find some more hints about wiring the display and the BMP
I think the correct wiring table looks ok. The messages indicate that the BME sensor was not found. As @luebbe wrote I also suggest to use an I2C scanner to see if the sensor and display are detected and which I2C addresses they use.
I will try the given suggestions and report back! Thank's already for the usefull information (didn't know the I2C scanner).
Little update. I could find my bme280 on adress 0x76 with the i2c scanner. The display is not shown at all. I will order a new one and check with it...
Does the sketch also works without display (just reporting via mqtt)? And what's wrong with the bme280.. why is it not recognized by the sketch?
The sketch works without the display. Make sure that you pass the correct I2C address for the BME in the constructor. Otherwise it'll use the default 0x77
I have the same issue (I think). Using a NodeMcu board, my SSD1306 display works, but I get BME280 sensor not found. Check wiring!
and consequently all the sensors report nan
on the display.
🔌 Booting into normal mode 🔌
{} Stored configuration
• Hardware device ID: 5ccf7f19d59f
• Device ID: multi-sensor-2
• Name: Multi Sensor 2
• Device Stats Interval: 60 sec
• Wi-Fi:
◦ SSID: CD
◦ Password not shown
• MQTT:
◦ Host: 192.168.0.20
◦ Port: 1883
◦ Base topic: /homie
◦ Auth? yes
◦ Username: client
◦ Password not shown
• OTA:
◦ Enabled? yes
• Custom settings:
◦ flipScreen: 1 (set)
◦ sensorInterval: 20 (set)
◦ temperatureOffset: 0.00 (set)
BME280 sensor not found. Check wiring!
OLED DisplayNode setup successful!
↕ Attempting to connect to Wi-Fi...
✔ Wi-Fi connected, IP: 192.168.0.126
Triggering WIFI_CONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
Calling setup function...
〽 Sending statistics...
• Wi-Fi signal quality: 100%
• Uptime: 1s
This is my setup:
SDA - pin D2 (GPIO4)
SCL - pin D1 (GPIO5)
If I run the Arduino sketch i2c_scanner
I get:
Scanning...
I2C device found at address 0x3C !
I2C device found at address 0x76 !
done
The display is 0x3C
and the BME280 sensor is 0x76
.
It looks like everything is wired up correctly. Do you have any suggestions as to why the BME280 sensor is not being detected?
Thanks!
Chris
@chris-thorn your BME280 sensor is also at the address 0x76
The default one should be at 0x77
. Any idea where to change this value?
Ah right, I see. I tried to follow the instruction from @luebbe:
Make sure that you pass the correct I2C address for the BME in the constructor.
... but I could not find any reference to 0x77 in the code 😦
@chris-thorn if can be changed in the code. See https://github.com/mhaack/mqtt-bme280-homie/blob/master/src/BME280Node.cpp#L28
The begin method can take the BME address as parameter. Try to change to bme.begin(0x76)
.
Aha! I will try it when I get home after work and report back.
Thanks very much!
Chris
@mhaack Brilliant, all working now! Thanks so much for all your work on this!
Chris
I could it also getting running with this:
See https://github.com/mhaack/mqtt-bme280-homie/blob/master/src/BME280Node.cpp#L28 The begin method can take the BME address as parameter. Try to change to bme.begin(0x76).
I'm running it without display (next step) right now.
But i still struggle getting the right mqtt topic. I called my device bme280 and tried a ton's of topics like:
/homie/bme280/temperature /homie/bme280/bme280/temperature /homie/bme280/hardware-id/temperature /homie/bme280/stats$/temperature
and more... Can somebody help me out with the right one? :+1:
@rradar check https://github.com/homieiot/convention this defines how MQTT is used and has a bunch of examples.
I gave my BME280 sensor a device ID of multi-sensor-1
, and a node ID of sensor
(I've not got it in front of me right now, so I can't remember whether I left the node ID as default, or set it myself.)
The MQTT topics I'm interested in are as follows:
homie/multi-sensor-1/sensor/humidity
(e.g. 46.03)homie/multi-sensor-1/sensor/pressure
(e.g. 1000.07)homie/multi-sensor-1/sensor/temperature
(e.g. 23.50)The units are available on:
homie/multi-sensor-1/sensor/humidity/unit
(e.g. %)homie/multi-sensor-1/sensor/pressure/unit
(e.g. hPa)homie/multi-sensor-1/sensor/temperature/unit
(e.g. °C)I use an MQTT client in Windows to subscribe to the topic homie/#
which will list everything the device is reporting.
Chris
@chris-thorn wrote:
subscribe to the topic homie/# which will list everything the device is reporting.
Wow! This one is powerful and works! Could have saved me 3 hours or more :smile:
Hehe yeah. If you've not already done so, have a look here for some general MQTT info:
https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices
I think this is answered and solved, closing the issue.
Am I blind or is there no wiring instructions? Would be very nice to have one!
Also a ready to flash build (binary) without the need of atom/platformio etc. would be awesome! :+1: