After trying out different components, I finally decided to look on EPS8266 as the main platform of implementing my IoT use cases. In doing so, I decided to work with Wemos chips, since they are pretty and provide the functionality I need at very low cost. These are:

  • boxed ESP8266
  • USB mini power supply
  • shields with different functionality
  • can be ordered by aliexpress

I ordered the following modules at aliexpress:

  • Wemos D1 mini (v.2.0, 4MB) (around 2,50 USD)
  • Reed switch (e.g. this one ) (around 2 USD)

After several weeks of traveling over the oceans my parts have arrived and I began to build my solution for gas consumption measuring.

My setup at home is based on OpenHAB running in Docker as described here. I’m using OpenHAB 1.8.3 with modules 1.9.0 (e.g. because of InfluxDB module for Grafana).

Flashing EasyEsp

First of all, the Wemos D1 mini module needs to have a firmware to work. After trying to program my use cases on my own, I found out that the Easy ESP project offers me most of functionality I need. So, I went to their homepage, followed the instructions and installed the flashing tool anf the images for flashing on my Windows machine. Then just connected the Wemos D1 module via USB and flushed the 4mb image on the chip. After the reboot, there is a WiFi network called ‘EasyESP0’ you can join and setup the membership of the chip into your local WiFi.

Connecting the Reed sensor

Connecting the reed sensor is very easy. Use the 3,3V, Ground and a data channel for this purpose:

Configuring Wemos D1 mini

After flushing and connecting the Wemos D1, I started configuring the setup. The nice story is that the Wemos chip with Easy ESP acts as an access point allowing to connect to it, select the WiFi to use and enter the WPA key for connection. After the connection to WiFi is established the same page shows the retrieved IP address to connect to the device. Then, the main ESP Easy control screen is shown.

Setting up the device (reed sensor)

The next step is to configure the reed sensor in ESP Easy. Click on devices, select the first row and click edit. Now select the ‘Pulse Counter’ from the list, name it, enalbe it, select used GPIO (D5 in my case), select the counter type ‘Delta/Total/Time’ and MODE TYPE ‘Falling’ and allow to send to controller. For me, it looks like following:

Setting up the controller (openHAB MQTT client)

After setting up the device, make sure to setup the controller, to deliver the values somewhere. I’m using Mosquitto MQTT and Openhab MQTT binding for this purpose. I’ll skip the OpenHAB setup, but focus on the configuration of Wemos MQTT client. I run Mosquitto as a Docker container, almost without any additional configuration. EasyESP has the Openhab MQTT controller so just select it, configure the IP address and it should look like this:

Testing and mounting

Now make a test with a small magnet and you should be able to see total values changed. For checking I’m using the ‘Chrome MQTT lens’ extension:

For mounting the reed sensor on the gas counter, I used a Maul Folbdack paper clip and attached the D1 mini with the sensor with a Powerstap on it.

At the end most time was consumed by building the plate for holding the Powerstraps, D1 and the sensor. Next step is to connect the MQTT values to my OpenHAB, but that’s another post.