wemos mini D1 pro esp module with antenna
Renowned esp8266 development module wemos D1 mini pro with antenna to best capture wifi waves
This page has been visited ... times
Recently version 2022.11 of Homeassistant supports the water energy meter, it is possible to recover the data easily using esp and that for around 10€. In my case the meter is equipped with a 433Mhz Itron Everblu Cyble 2.1 transmitter. This makes it easy to retrieve data using a CC1101 receiver coupled to an esp8266/esp32. I picked up and modified a complete repository on github that was edited by psykokwak, and I commend his work. This repository allows data to be received and transferred by mqtt to homeassistant.
Let’s start by installing the esp8266 and esp32 card management library:
Method 1: Download the git, extract it and drag it to the sketch folder on the Arduino interface, otherwise drop the folder directly at the root of the Arduino folder.
Method 2: Command line
Please upload the folder with name: watermeter2mqtt
|CC1101||Wemos D1 mini||NodeMCU||ESP32|
|GOD0 (GDO0)||D1, GPIO 5||GPIO 5||GPIO 22|
|CSN (SPI chip select CS or SS)||D8, GPIO 15||GPIO 15||GPIO 5 ou GPIO 15|
|SCK (SPI clock)||D5, GPIO 14||GPIO 14||GPIO 18 ou GPIO 14|
|MOSI (SPI MOSI)||D7, GPIO 13||GPIO 13||GPIO 23 ou GPIO 13|
|GOD1 (SPI MISO)||D6, GPIO 12||GPIO 12||GPIO 19 ou GPIO 12|
|GOD2 (GDO2)||D2, GPIO 4||GPIO 4||GPIO 21|
1 wifi and mqtt settings
2 line 88-90 reading adjustment
As a reminder, this code collects consumption data once a day during meter reader working hours. ** Below I have set 2 p.m. UTC which corresponds to 3 p.m. France **
3 choices of scheduled reading or at each data update
By default the script updates as soon as the data changes, just uncomment onScheduled line 257 to 259 and comment onUpdateData
4 find the right frequency for your CC1101 transmitter
Just uncomment the code line 272-291
Push the code to your module then select Serial Monitor:
the result should look like the image below:
Once the code has been retrieved, remember to comment on these codes, otherwise you will not be able to upload the data later.
5 Set the clock to your region (Optional)
Go to line 188-190 if necessary
The clock is set to Paris, to modify according to your region copy/paste the code available on this site
Important step, match the connections of the CC1001 to the GPIO of the esp module:
Let’s start by going back to the diagram available above, you will be able to realize that on a Wemos D1 for example that SCK corresponds to the GPIO14, Miso 12 etc… knowing that modifies lines 94 to 100 of the code available in this file. See the animated GIF below:
Code available on your itron module remember not to use the first 0.
at the very bottom of the file line 53-60
All that remains is to validate the sketch project > check/compile or Ctrl+R, and if everything went well you should have the result
Then click upload: sketch > upload or Ctrl+U
Check serial monitor
this repository allows to retrieve:
The device polls the counter once a day, every 24 hours, and retries every hour if the query fails. Your counter can be configured in such a way that it only listens to requests during the hours when the meter readers are working. This is to save the batteries of the modules. If you are unable to communicate with the meter, please try again during business hours (8:00 a.m. to 4:00 p.m.), Monday through Friday. As a general rule, try to set up your device only during business hours to avoid confusion.
Your transceiver module may not be calibrated correctly, please change the frequency a little lower or higher and try again. You can use RTL-SDR to measure the necessary offset. You can uncomment the part of the code in the watermeter2mqtt.ino (see above), file which analyzes all frequencies around the meter frequency to find the correct one.
This is a simple method to set up, for those who are not equipped with an Itron Everblu Enhanced transmitter, there is another method which consists of putting an inductive sensor directly on the meter and connect it to an esp8266, this method is a little more restrictive because it will be necessary to have a source of energy near this meter in order to be able to supply the esp and the sensor with 5V, the price of the whole also oscillates around 10€, an excellent article is available here pieterbrinkman.com