Testing some I2C sensors with ESP01 and Tasmota

Here we are testing the Tasmota SW over the ESP01s (ESP8266) to understand how sensors can be integrated. Then proceeding with the Hydrosys4 integration using MQTT.

First thing that I missed, wasting about one hour, is that for the sensors integration it is required to use the tasmota file called: tasmota-sensors.bin

So after flashing the ESP with this Software, as for standard usage of it, I set the wifi credentials using its auto generated wifi signal, then after connection with the home wifi I looked at the router to see the newly attached devices, found the IP address and started the configuration.

Main focus was to test the I2C sensors compatiiblity, basicaly after associating the SDA and SCL to any of the GPIO of the ESP01s, the SW should be able to autodetect the sensor type and ready it.

Well, it worked flawlessly.

In my configuration I set the SDA to be GPIO1 and the SCL to be GPIO2.

ESP8266 Pinout Reference: Which GPIO pins should you use? | Random ...

Here the setting on the Tasmota web GUI

After this setting, I connected the BME280 to it, the sensor was detected and I got the following in the main page:

Great!

I had also a look at the console and checked the Json string that the device publish for the MQTT protocol, here it is:

RSL: tele/esp-01s/SENSOR = {“Time”:”2020-08-11T10:10:12″,”BME280″:{“Temperature”:27.6,”Humidity”:58.6,”DewPoint”:18.7,”Pressure”:1015.3},”PressureUnit”:”hPa”,”TempUnit”:”C”}

This will be required for the integration with the hydrosys4.

Then I connected the BH1750 light sensor, same setting on the tasmota, after restart this was the result:

The console message was this:

RSL: tele/esp-01s/SENSOR = {“Time”:”2020-08-11T10:14:37″,”BH1750″:{“Illuminance”:208}}

Well, everything looks very nice and simple.

The Device will automatically send this info periodically every of 5min, to set the period time is necessary to go to “configure” ->”configure logging” and change the “telemetry period” parameter.

Looking at the telemetry, there was also a report about the status of the device which can be usefult for further development and integrations:

10:33:28 MQT: tele/esp-01s/STATE = {“Time”:”2020-08-11T10:33:28″,”Uptime”:”0T00:19:55″,”UptimeSec”:1195,”Heap”:22,”SleepMode”:”Dynamic”,”Sleep”:50,”LoadAvg”:19,”MqttCount”:1,”Wifi”:{“AP”:1,”SSId”:”TP-LINK_7E1EEE”,”BSSId”:”30:B5:C2:7E:1E:EE”,”Channel”:2,”RSSI”:58,”Signal”:-71,”LinkCount”:1,”Downtime”:”0T00:00:03″}}

2 thoughts on “Testing some I2C sensors with ESP01 and Tasmota

  1. Jerome

    Hi,
    thanks for the update with mqtt support and tutorial to use ESP8266 modules.

    I was trying to find out if several I2C modules could be connected and configured in tasmota, on the same pins of ESP8266. I2C bus allows to connect several modules, and communication to each module is managed by using the corresponding address, but I don’t know if Tasmota automatically detects that several modules are connected.

    In your example, when you connected your BH1750 light sensor module, did you disconnect the BME280 before ?

    If you let both connected, does it recognize both modules or just one ?

    Regards,
    Jerome

    Like

    Reply
    1. hydrosysblog Post author

      Hi, Tasmota recognizes automatically the I2C addresses, in fact it scans it and associate to supported sensors. The two sensors can be connected and working at the same time

      Like

      Reply

Leave a comment