ESP8266 remote power display for energy monitor

This article documents remote power display for an energy monitor system based on emontx3 / emonhub / mqtt.

The remote power display connects via WiFi and subscribes to a topic on a MQTT server, updates are published every 10s with data from the emontx3 by emonhub.

Hardware

The remote power display uses a Wemos D1Pro ESP8266 module, a common 4 digit 14.2mm seven segment LED module with 74HC595 shift register per digit, and a simple 3V/5V level converter between the two (see above shrink wrapped in the cable from the D1Pro to the display). 

It is popularly held that the ESP8266 is 5V tolerant, but there is no mention of such in the specs, and a posting by Espressif in their forum makes it clear they are not 5V tolerant. For that reason, this project uses an inexpensive four channel 5V/3V converter, a dollar or so each on eBay.

The display is real power in kW.

Above is the schematic for the display used. There are a range of similar displays on eBay, some are common anode, some common cathode. The code contains a variable in nodevars.lua to invert output for a common anode display. A multiplexed display requires different code and it may not be practical with Lua script (bit operations are slow).

Current consumption with all display segments lit is 0.25A @ 5V.

Parts cost of the D1Pro, level converter and display is about $20 (inc shipping)  from eBay.

Waveforms

Above is a capture of the waveforms on the control lines which clock the 7 segment encoded data into the shift registers driving the display.

Code

The code is written in Lua script. It is under active development, the code as it evolves is available online https://bitbucket.org/owenduffy/rpdiotm.

Variations

LCD

The display used is a medium size bright LED display, but that consumes up to 1.3W @ 12V. The code could be written to use an I2C 16×2 LCD which would dramatically reduce power consumption (though very different visibility).

LED 3.3V

It may be tempting to run the display at 3.3V from the D1Pro, but the regulator is unlikely to have sufficient dissipation.

I have a display similar to the one above but common anode and it draws 90mA on 3.3V with all segments lit. The ESP8266-12E devkit 1.0 has a much bigger regulator, and runs the 3.3V display comfortably (total current up to 0.2A).

Above, the displays are on 5V and 3.3V. The 5V display is very bright, the 3.3V one is mid brightness (LED current on 3.3V is about 35% of the 5V display).

The 3V display option does not require a 5V/3V converter so it is simpler, but it does require a ESP8266 with an adequate 3.3V regulator.

RESTful protocol

This instance uses MQTT to suit the local environment, but the code could be altered to provide a RESTful server and emonhub configured to post directly to the server.

Multiplexed LED display

Note that the code is for a non-multiplexed display with one 74HC595 per digit, different code is required for a multiplexed display. As mentioned, Lua bit banging and bit library operations are unlikely to be fast enough for a multiplexed display. It may be possible to use the HSPI port to get faster transmission for a multiplex display.