Software for the ESP8266 / ESP32 that sends P1 smart meter data as a string to a TCP port (with CRC checking). These meters have an open collector output, thus they require a pullup to 3.3V / 5V and an inversion of the signal (see included schematic).
--- BOARDS ---
- esp32 v2.0.9+
- esp8266 v3.0.2+
--- LIBRARIES ---
- None
--- Functionality ---
- ArduinoOTA from board package
- Check Wi-Fi for both boards
- Make sure that your ESP8266 / ESP32 can be flashed from the Arduino environnment.
- Place all files from this repository in a directory. Open the required .ino file.
- Adjust WIFI settings
- Adjust TCP server and port
- Add / delete messages as required for output string
- Compile and flash
You need to connect the smart meter with a RJ11 (4 pin) or RJ12 (6 pin with +5V and GND) connector. More information here: https://www.cdem.be/13_technical/#what-information-is-provided-with-the-p1-port
Invert the input to 3.3V logic for ESP using a BC547B NPN transistor or similar:
Connect GND->GND, RTS->REQ_PIN, and RxD->RX pin. By default, the req pin and the npn base input are on 3.3V. If this does not work, then supply 5V for these by using a level shifter from the output of the ESP for the REQ_PIN and connect the R2 to +5V.