Following on from the forum post here ESP8266 Wifi Developments. This is a brief guide on how to use the Adafruit ESP8266 Huzzah WIFI breakout module with an EmonTx v3 to make a simple WIFI enabled energy monitor that posts to a remote emoncms server such as emoncms.org.
Note: this is an ongoing development project, but is a useful option in its present form
In the future, we may integrate the ESP8266 module directly on the EmonTx PCB. For now, the ESP8266 Huzzah module provides a good way to get this up and running while we continue to develop the firmware and do extended testing. It also provides backwards compatibility for existing EmonTx v3’s.
To setup an EmonTx v3 + ESP8266 Wifi energy monitor you will need:
- EmonTx V3
https://shop.openenergymonitor.com/emontx-v3-electricity-monitoring-transmitter-unit-433mhz - ESP8266 Huzzah breakout module
Adafruit HUZZAH ESP8266 Breakout : ID 2471 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Adafruit HUZZAH ESP8266 Breakout – Pimoroni - 6 WAY ribbon cable with female headers or 6 WAY stackable header. We can supply these by request with an order of an EmonTx v3 through the OpenEnergyMonitor shop.
- CT Sensors and ACAC Adapters:
Sensors - Shop | OpenEnergyMonitor - USB power supply and mini USB cable
Power Supplies - Shop | OpenEnergyMonitor - USB to UART programmer
Development Boards - Programmers - Shop | OpenEnergyMonitor
Setting it up
1. Upload EmonTx v3 EmonESP Compatible Arduino Firmware.
The firmware running on the ESP8266 module expects data to be sent via serial in a specific format, a json like key:value string of the form: P1:100,P2:250,P3:150
The first step is to upload new firmware to support this format which can be found here:
There is a getting started guide for uploading Arduino firmware here:
https://openenergymonitor.org/emon/buildingblocks/setting-up-the-arduino-environment
2. Upload EmonESP firmware to ESP8266 WIFI module
See installation notes here for using the Arduino IDE or Platform IO:
Note: before soldering any headers into the ESP8266 huzzah module, see the example image below for soldering a 6 way stackable header to enable the ESP8266 module to sit cleanly against the EmonTx.
3. Connect EmonTx v3 to ESP module
The ESP8266 can be connected to the EmonTx v3 with a 6 way stackable header as below but a modification needs to be made so the TX line from the EmonTx goes to the RX line of the ESP8266 module as shown in the picture below.
Alternatively, 6 way ribbon cable with the RX/TX line swapped could be used, and may be a bit easier to put together.
N.B. You should connect ONLY the RX pins, and leave the Tx pins not connected, as the pictures below show.
4. Power up and configure
Once powered up, the wifi module starts by broadcasting a hotspot that you connect to directly. You can then scan for wifi networks, select a network, or get the ip address of the monitor on the network (which eliminates the need to use fing or access your router device list). Enter your emoncms.org apikey to connect to an emoncms.org account and see the latest values from the EmonTx in the web interface to verify proper operation.
That’s it. If you follow this and get it working, let us know how you get on!