Energy Meter Hacking – Reading EOUT Pulses

Following on from a recent teardown of a low cost appliance energy meter, I’ve done a bit more hacking of the device. As you may recall, I identified that one of the pins on the meter’s chip (EOUT) output a train of pulses proportional to the energy consumed. Some tests with a multimeter seemed to confirm this because the average voltage of EOUT changed with the appliance wattage.

I was hesitant to connect my logic analyser to the meter to measure the EOUT pin because of potential differences in voltage levels. To resolve, this I quickly whipped up a small board with a 4N25 opto-isolator to provide some voltage isolation between the internals of the energy meter and my logic analyser.

Again, I will repeat the obligatory warnings prevail. Do not:

  • Attempt or copy any of this if you do not fully understand or appreciate the hazards of mains power
  • Open the meter whilst connected to mains power
  • Perform any measurements whilst the meter’s case is open
  • Connect another mains powered device to measure the chip. The energy meter’s power supply is not isolated from active, neutral or earth.

The circuitry that allows for isolation of voltage levels is based around a 4N25 opto-isolator. An opto-isolator  allows for a signal to be transferred using light, this provides an airgap which provides electrical isolation.

opto_circuitA quick explanation of the circuit, the signal from the energy meter is EOUT_B (note the small horizontal bar across the text ‘EOUT’, this signifies that the signal is active low) and this drives a PN2222A general purpose NPN transistor. The NPN transistor was used to drive the opto’s LED at approx 10mA instead of the CS5460A having to source this current. The output of the opto-isolator was configured to be active-high because active low signals can be confusing.

The hardware was quickly assembled on some protoboard. Note that the output resistor (R4) has not been installed on this board as it will be external to the meter.

Assembly was a pain, finding a suitable place for the opto board inside the meter took two attempts. Hot glue saved the day in the end.

4N25 installed in energy meter
Opto board installed with some hot glue.

Before closing up the meter, a thorough check of clearances was made to ensure that the output wires could not come in contact with the mains voltages.

Once I was satisfied that everything was safe I powered up the meter with nothing connected. None of the blue smoke escaped.

Then the energy meter’s output wires were connected to a small PCB with a pull-up resistor for the opto’s output transistor, a 5V bench supply and an IkaLogic logic analyser. (If you want a low cost but very capable logic analyser I highly recommend the Scanalogic-2 Logic Analyser.)

IMG_4065
All ready for power up.

A 2400W clothes iron was connected to the energy meter and powered up – it began to draw 9.75A.

IMG_4071
Current being measured whilst recording EOUT pulses.

The logic analyser was configured to trigger off the EOUT pulses and set to record data. Sampling rate was 250kHz and each division is 537us.

Screenshot of EOUT pulses
Pulses recorded from the EOUT pin

Review of the logic analyser’s results show that the EOUT pin outputs its data as a burst of pulses. This concurs with the CS5460A, which says ‘the pulses may be sent out in “bursts”’. When an appliance is removed from the meter, the pulses stop.

Well, this proves that the energy meter’s EOUT pin is outputting a stream of pulses. Next up is to review the datasheet and perform some trials to determine the relationship between the rate of pulses and the power being measured by the meter.

3 thoughts on “Energy Meter Hacking – Reading EOUT Pulses

  1. Hi,

    I have a energy meter with a similar circuitboard. The chip on the meter seems to be CS5460A (https://www.cirrus.com/en/pubs/proDatasheet/CS5460A_F5.pdf) , similar to the one you have been hacking. My question is, why do you not use SPI (SDO/SDI lines) to read the data from the chip ? (See the imprint on your circuitboard next to the ribbon cable to the LCD panel)
    Currently i am making attempts to read this chip using a raspberry pi, but not have been able to make correct readings. If you have insight how to get this working it would be great. Currently i have the following wiring between my energy meter and raspberry pi:

    Signal Ground PIN 6 Ground
    CLK PIN23 GPIO11 SPI0_SCLK
    SDO PIN21 GPIO09 SPI0_MISO
    SDI PIN19 GPIO10 SPI0_MOSI

    Regarding the relationship between the pulse and the energy consumption, the CS5460A document reads;
    The required number of pulses per unit energy present at EOUT is specified to be 500 pulses/kW-hr; given that the maximum line-voltage is 250 V (RMS) and the maximum line-current is 20 A (RMS).

    Cheers,
    Peter

    Like

  2. Hi Peter,

    Thanks for your comment.

    No I haven’t interfaced to the SPI interface on my meter yet so I can’t share my experience communicating with the chip yet. However, looking at the section “4.2 Serial Port Interface” of the CS5460A’s datasheet, it details that you must control the Chip Select “CS” line to enable communication. The CS chip is active low, and from the datasheet, “When CS is set to logic 1, the SDI, SDO, and SCLK pins will be held at high impedance. When the CS pin is set to logic 0, the SDI, SDO, and SCLK pins have the following functionality…”

    Try setting the CS pin to logic 0 (driving to 0V) first and then try to communicate using the SPI interface.

    I disagree regarding that the EOUT is specified as 500 pulses/kw-hr. That statement is from an example in the datasheet that steps you through the process calculating the Pulse Rate (PR) register if your application required 500pulses/kw-hr.

    For my meter, I would need to read the contents of the pulse rate (PR) register using the SPI interface to determine how many pulses per kW-hr my meter outputs. Alternatively, a more crude method would be to connect a known constant load to the meter and count the number of EOUT pulses in 1 hour and then calulcate the pulses/kW-hr.

    I hope that helps,
    Tim

    Like

Share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s