Monday, October 20, 2014

Power Plug Energy Meter Hack

It has been way to long ago since I tested my capability of hacking things.

Since i am an energy engineer, I have been looking for a cheap and easy way of monitoring my power consumption. 
I know there are other hackers out there that have already worked on this problem, and I have seen dozens of hacks on smart and dumb house-power meters, but only a few that covers power plug energy meters. 

You have the Tweetawatt - awesome, but not my cup of tee (i prefer to write my own software for AVR or Arduino) and still ~55$ each...
And a guy named Connor Wolf has an awesome project where he builds his own and a video where he tares a few standard power plug meters apart

I have seen how cheap the China-version of the energy meter is (£7,86), and when i saw the tare-apart video where he takes one apart, I went ahead and ordered two pieces of the EU-type (230V 3,6kW). Of course my intention was to convert them to my own cheaper version of the Tweetawatt.

My final goal is to connect them to the internet either via an nRF24L01+  and my rPi-setup, or with an ESP8266 Wifi adapter (if it will ever arrive in the mail box...)

The future goal is to use an home made Android app to graph the data, i'm not quite there jet, but this tutorial describes how I hacked the power meter and successfully got the voltage, current and power readings to an arduino using interrupts on the CLK. 

The meters showed up last week, and the first thing i did was to open the cover of one of them. 

The guts looked promising since it is very similar to the one in Connor Wolfs video with the 3,6 V battery and the ribbon cable between the two circuit boards. The differences i can see compared to the 110 V version is the big blue capacitor.

The reason I started this project from the first place was because I had seen the ribbon cable labels in the video, so I was very satisfied when I confirmed that the 230 V version also came with the labeled ribbon cable between the power meter and the main processor which sits under the brown circuit board.

The ribbon is labeled: 
VCC, SGND, FREQ, CLK, SDO and SDI as seen here:

I tapped into all of the 7 wires, (7?) yes there are 7 wires, only 6 labeled. closed the case, and plugged it into the wall.

Before i hooked it up to my awesome £6, 8-channel, 24 MHz logic analyzer and started testing it in the logic analysing software, I firs checked all the cables with a multimeter to see that none of them was connected to mains (this video shows that the Kill-a-Watt meter has 110 V on the ribbon cable strangely enough). But the China version was safe on all 7 wires and the five which weren't VCC or GND  got its own channel on the logic analyzer:

###WARNING!!! I'm not an expert in HVAC and there are lots of knowing people that read this article on and informed me that hooking up the logical analyser like this is an terrible idea! It seems like the energy meters DC-line is not grounded, but instead use Neutral as ground, which can be very different from your computers USB-ground... DO NOT USE MY SETUP, It can be both dangerous and harmful to the computer!

If you want to test the SPI on a non-grounded device they have a lot of suggestions on how this should be done, optical isolation sounds pretty smart (maybe there are even optically isolated USB-hubs you could use?!) I guess I was lucky not to blow up my computer, or my self...

I must admit that this was the first time I have ever attempted to sniff a data communication before, so I had to do a little research. I recognized the CLK as the clock wire in SPI, and guessed that the SDO and SDI was the same as MISO and MOSI but where was the SS (chip select) wire?

My hope was that maybe SPI can work without chip select when there is only one slave that listens, but that would make it heard to know when a transmission starts and end!? how does it sync?

Well, it turns out that I was right, This is the output on a run with nothing connected but the meter:

(click picture for larger version)

Yey, This confirmed my theory and it showed that the FREQ-pin was giving a 50 Hz signal, not at all involved in the SPI communication (nope it's not the SS-line). and that the un-labeled cable was the same as the VCC-labeled pin (high = 3,6V)

This project has improved my analyzing skills allot, and I had to learn how to set up the analyzer to debug the SPI-signal (great SPI-info)

To read this scatter as SPI you need to define the start (where to read the first bit in a byte from)
1. press T1 or hit 1 on keyboard
2. put marker in between SPI-signals (where it's obviously not in the middle of sending a byte)
3-4. Add an Analyzer, choose SPI

Next step is setting up the SPI-analyzer:
1. Press settings
2. zoom in on the first byte, and try and figure out what settings that is used. (see pic under this as well)

Start by "Re-run starting at marker T1" as in picture bellow.
I found that my data is read when CLK is rising "Trailing Edge" and comes in sets of 8 bits (1 byte). 
Note the last MOSI-byte going low, only catched by the trailing edge of clk=>trailing edge
This is how the bits in a byte are interpreted on trailing edge: 

When the CLK goes high, the status on the MOSI and MISO are converted to either 1 or 0. After 8 bits, you have a byte which can be translated to decimal value, as seen above:
MOSI = 1111 1110 => decimal 254
MISO = 0001 0000 => decimal 16

At this time, there was one happy geek in the house!

Decipher the data

Now I had figured out how to sniff the data communication, I still had no idea of what, and in what format the data was sent.

I figured that my best chance of decoding the data would be to sample lots of data and then compare it. So i started sniffing the setup when connecting my soldering station which was perfect since it has the ability to choose different power settings, and for heavy load i used a 1,8 kW water heater.

When comparing the data, it was quite clear that there is not much going on here.The data is sent in chunks of 70 packages at a time, followed by a 47 ms delay. Each package contains 8 bytes, and luckily for me, the first 68 package seems to be the same every time, independent of the wattage reading and they all look like this:

1 255 0
2 255 0
3 255 0
4 254 0
5 30 0
6 254 16
7 254 3
8 254 193

Sometimes (under high loads) the 16 reads 80, but that's probably because the 7th bit is misread (i haven't found a pattern):
16 = 0001 0000
80 = 0101 0000

But then in the 68th package it always sends:

Same thing here, 144 sometimes becomes 280
144 = 1101 0000
208 = 1001 0000

Which i think prepares the Master that next 8-byte package will contain important stuff.
This is what comes out in package 69 with different loads:

ByteSISO 0WSO 8,5WSO 20WSO 44,5WSO 1860W

Which i figured out to be:
Voltage = 2*(Byte6+Byte7/255) 

Which makes sens because when it goes from Byte6=115 and Byte7>238 to Byte6=116 and Byte7=10 It implies a moderate increas in voltage (231,9V=>232,1V), but under high load, one can expect a voltage drop, and when running at 1,86 kW: Byte6=111 and Byte7=191 (223,5V) seems to be correct!

I guess Byte8 represents a very small fractions of voltage level, so i skip that one.

And the last 8-byte package hopefully gives me some sort of current measurement value so that I can calculate the power!?
Package 70 looks like this with different power loads:

ByteSISO 0WSO8,5WSO 20WSO 44,5WSO 1860W

Where I have tried hard to find out what bit 2 to 4 means, please help me with that in the comment field!!!! The meter displays power factor, could it be something with that?

Anyway, I was luckey, it turned out that the last three bits sends the power value like this:

And to get the current:
P=U*I means I=P/U  and I have all i need!!!!!

And I am one very happy engineer!

A bonus is that changing the setting to view voltage or current, doesn't change the SPI-data.

Arduino MISO sniffer

I can't have a PC next to every power plug energy meter i have hacked so next step was to program a micro controller to do the SPI-sniffing for me.

I have been using AVR's for quite some time now, but this is my first Arduino project, and for testing purposes I'll be using an Arduino Nano, but I have decided to use an 3,3 V Arduino Mini when it's time to solder everything togeather since I have a 3,3 V battery in the meter, and I am planing on transmitting the read data with either an nRF24L01+ to my rPi-setup, or the ESP8266 Wifi adapter (if it will ever arrive...). I wonder if I need a big fat cap to supply the current when sending data like the Tweetawatt!?

Anyways, my plan is to send the data to Gdrive so that i can reach it from an android app or something, but that's future work! If you read this, and now how to log data from ESP8226 to G-drive or Dropbox, I'd appreciate if you gave me some tips!

I first thought of using the built in SPI-function, but learning how to use the "bitbanging" technic on SPI sounded allot more fun! (and I'm not sure the built in SPI would work anyway without SS)

This is the psudo chode I wrote:
1. Connect GND, CLK (green cable) and SO (blue-white) to Arduino (CLKto INT0 and SO to D5) (Arduino 5V from USB for now)
2. Setup interrupt (ISR) on INT0-pin (D2) and make it trigger on rising edge (se ISR-info)
3. When trigger occures: loop as long as CLK is high while logging the time
4. When CLK goes low: check if the delay was between 1-2ms, if so then we are in clk-sync and next clk-rise will be the start of a new byte (this is the delay in between every one of the 70 packages in a transmission)
5. Let CLK-interrupt trigger 40 times to skip the first 5 bytes of the current package
6. Save status on pin 5 (MISO) every time CLK-interrupt triggers to two integers (the next 8*2 times, which will be Byte6 and 7) by using shifting bits method "<<"
7. Let clk trigger 8 more times to finish a complete package and stay in sync
8. check if Byte7!=3, If true: its the 69th package => use byte 6 and 7 to calculate U and proceed with the next step, otherwise (Byte7==3) then: set sync=false and go back to step 3 and wait/look for next package.
9. Let CLK-interrupt trigger 40 more times to skip the first 5 bytes of the 70th package
10. Save byte 6, 7 and 8 in integers by shifting bits each time a new bit is read (8*3 times).
11. Calculate P and then I=P/U
12. Send U,I,P to computer for debug.

And believe it or not, after a good couple of hours of debugging it now works like a charm!

Here is the code that now sends the data to the Arduino-IDE, but is easily changed to an nRF24L01+ and hopefully the ESP8266  as well...


I now have a working setup where the energy meter is completely wireless with an Arduino mini pro 3,3V and a nRF24L01+ module! =)
Se next post for further information.


  1. Hi! I am very interested in hacking this particular kind of power meter, as I am spanish and KaW seems to operate at US voltage, also it is much more expensive. My question is, can't you read the analog signals? Shouldn't those be more precise? Something similar to the "Moteino Kill-a-Watt" project.

    Thank you very much for sharing! Keep up the good work.

    1. Hi!
      I have no idea if you can get an analoge signal from the chip... maybe the datasheet can give you a hint:

  2. I just begun to plan building a "cheaper tweet-a-watt" using one of these power meters, a couple of MSP430 and cheap 433 MHz modules (nRF24 in the future). Your article will be a great inspiration to make that. Well done, sir.

    1. You're welcome!
      Looking forward to get an update on your project!

  3. Update:
    I now have a working setup where the energy meter is completely wireless with an Arduino mini pro 3,3V and a nRF24L01+ module! =)

  4. It looks to me like you are spying on CS5460A Single-Phase, Bi-Directional Power/Energy IC

    In package 70, bytes 1-4 are responsible for reading RMS current value of last cycle :
    Byte 1 SI -> 00010110 (read register IRMS)

    google CS5460A and you will find datasheet

    Great work and great article,

    1. Have been trying to find out how to convert the IRMS to readable data, but I am stuck...
      The datasheet sais: "The results are in the range of 0.0 < IRMS,VRMS <1.0."
      and it also claims that the energy value is shifted 12 bytes (it's 8 bytes according to my code...)

      maybe the CS5460A differ from the ECH1560 somehow... Any help is appreciated!

  5. Your project inspired me to try to hook one of those power meters to an esp8266. The result is this general purpose, interrupt driven, serial sampler:

    These are the findings i made:
    * There is 50% chance (depending on how the meter is plugged in) that the signals & GND will 'high voltage'.

    * Sometimes my power meter sends 71 'packages' of 8 bytes, but the good stuff (watt) is always in the last 24 bits.
    So my code always sample until it finds the 'idle gap', then it do the bit calculations relative to the end of the bitstream.

    * The internal 3V3 power is really weak. My power meter is just barely capable of running two PC123 optocouplers + resistors.
    So i have not yet decided on how to power my contraption. It would be nice to be able to put everything inside the case like you did.

    Thank you for this very informative blog.

    1. That's awesome!

      I also found that the internal 3,3V power is very weak, but gets more powerful after a while when the battery has charged up!

      I have just received a couple of esp8266, and was planing on trying them in a meter...
      I might try putting a larger capacitor in the module and only power up the esp8266 once a minute or something to send collected values without causing the meters 3,3v to drop to much.

      Please keep me updated if you find a working setup!

  6. I received this meter today, and loaded the Arduino sketch to a Arduino Nano V3 i had lying around.
    Tapped into the wires (first it wouldn't work, i saw i had the GND wire wrong, it was on RESET instead of GND) and got some output in the Arduino monitor... Yayy!

    However, the output isn't correct:
    U: 228.7V
    I: 142664mA
    P: 32633.6W

    U: 228.7V
    I: 142698mA
    P: 32633.6W

    U: 228.6V
    I: 142737mA
    P: 32633.7W

    U: 228.6V
    I: 142767mA
    P: 32633.6W

    U: 228.6V
    I: 142781mA
    P: 32633.6W

    The voltage is correct, it is the same as what the meter itself report. But the current and power don't match :(
    I had a LED-bulb connected to the meter. According to the meter itself: 228V, 0,038A, 7W

    Any ideas?

    1. LED-bulbs can be very 'electrically noisy' i.e. a lot of transients on the power line. Did yo try with something else as a load?

    2. Strange that you get the correct voltage value... the ampere part is just P/U, so its the P-value you will have to find out whats causing the misreading.
      What kind of setup are you using? are you using the potentially dangerous setup where you connect the arduino via USB to a computer, or are you using an nRF24 for wireless communication?
      Try printing out Ba, Bb and Bc separately to see what they contain!
      Good luck

    3. I have now connected my soldering iron, which is a constant load of 20W.

      It seems like the Ba and Bb values dont change:
      U: 229.0V
      I: 142465mA
      P: 32620.5W


      U: 229.0V
      I: 142455mA
      P: 32620.6W


      U: 228.9V
      I: 142499mA
      P: 32620.6W


      U: 228.9V
      I: 142504mA
      P: 32620.6W


      I am using the potentially dangerous setup by Arduino connected to PC. The meter is powered by an UPS running on battery. But running it directly on mains doesn't make a difference.

      Any ideas? Unfortunately i don't have such a nice analyzer like you...

      Oh and my meter is a little bit different from yours. It also has a 24C02 EEPROM (i think to save the tariff you can configure), and 2 extra wires from LCD to mainboard (EE1 and EE2 for the EEPROM i guess). The measurement IC (marked U101 on PCB) doesn't have any markings unfortunately. It is a chip with 12pins on each side.

    4. Good thing you are using an UPS!
      Well, it kind of sounds like the SPI is sending different data than what my meter does, where did you buy it, and what version? please post a link to the module you bought...

      If you can't get hold of a logic analyzer, you should debug all the bytes after the voltage, instead of line 74:


      you should print out these 5 bytes as well as Ba, Bb and Bc, to try and find the interesting ones.
      something like:

      if(NextBit == true){
      Ba = (Ba << 1);
      Ba |= (1<<0); //changes first bit of Ba to "1"

      if(CountBits % 8 == 0){ //true every 8 bit => 1 byte
      Serial.print(" : ");

      *Haven't tested the code above...

      If that wont work, investigate whats going on in the MOSI-line as well.

    5. I bought exactly this one:

      Thanks for your code, i will try it later this day/when i have spare time, with different loads connected to the meter.

    6. Could it be so that the Ba and Bb and Bc is just read backwords? (LSB and MSB mixup)
      Ba: 255-255 = 0
      Bb: 255-216 = 39
      Bc: 255-50 = 205

      P=(0*255+39+205/255)/2 = 19,9V
      And there you have it! =)

    7. So only changing the calculation for the power (P) could solve it? That would be easy to try.
      How should the Arduino code for the calculation look like then?

      P=((float) .....

    8. Which also works on your 7 W example above:
      Ba=255 => Ba*=0
      Bb=(32633 x 2)-(Ba x 255) =242 =>Bb*=13 //(255-242)
      Bc is not that important

      => P=(0*255+13)/2=6,5 ~7W (with Bc)

      Well, you can just put this:

      before the:

    9. Awesome, it worked! Thank you very much for helping me out!!

      One thing i noticed: the power that the Arduino displays is not equal to the value shown on the LCD of the meter itself. Do you also see that behaviour? Maybe the Arduino is calculating the values faster than the LCD...

      But really great you helped me out. I can now continue my project. I want to include the meter into my domotica (Domoticz) setup. I will add a ESP8266 to the Arduino, and the ESP8266 will send the power to Domoticz. I already had it working with an Arduino sketch where the temperature from a DS18B20 was send wirelessly to Domoticz by using the ESP8266.

    10. Oh and by not equal, i mean the LCD displays 20.3W and the Arduino 19.6W. So they are very close, but not the same :P It looks like the LCD is updating slower than the Arduino :P

    11. Nice!

      correction on my previous post.. the bytes are not read backwards, but inverted!

      That's weird you have different values, mine are the same, this makes me think something is not working properly!?
      Have you tried different loads like a water boiler or something to read heavy duty loads >1kW?
      Maybe the data you read has been corrected for power-factor, but the displayed value hasn't? in that case a pure resistive load like a water boiler would show the same values, but an inductive load wouldn't.

      I look forward to see your progress with an ESP8266, please keep me updated on how you get enough power from the energy meter to run both an arduino and an ESP8266. My idea is to use a large capacitor and only power the ESP once every 10s or so to transmit stored data, and then power down.
      Or maybe we can use the technique described by "eadf" above, where he skipps the Arduino and lets the ESP do all the SPI-sniffing: Link

    12. I tried it with a water boiler, and luckily the sketch also works with higher values. But i still have that the value on the display is different than what the Arduino reports.

      LCD: 1887W
      Arduino: 1881W

      LCD: 1888W
      Arduino: 1882W

      Yes powering the ESP266 part is something difficult. I haven't thought about that yet. In your setup, you power the nRF24L01 and Arduino directly from the battery. But if you leave the meter disconnected for a week or so, it will damage the battery i think.

      I don't actually need the battery (i think it is for remembering the total amount of kWh?) so maybe disconnect it and connect the ESP8266, Arduino and a big capacitor to the wires going to the battery?

      Using only the ESP8266 would be even better, but i am not very skilled with the ESP8266. I have some experience with the Arduino. And i managed to get the temperature from a DS18B20 sensor connected to the Arduino send wirelss through my domotica by using the ESP8266. So that would be regarding the coding the easiest way for me... Regarding hardware the best would be to use only a ESP8266 indeed....

      I will let you know if i made any progress ;)

    13. Thats good news!

      The power consumption of the ESP is quite high (~60mA) compared to the nRF (page 14) (Transmitter ~10mA)
      And the nRF caused the meter to black out when i put nRF in receiver mode (12,6mA)
      Hopefully one of us will find a working setup with the ESP and the meter. =)

    14. Kalle, what about putting a small phone charger into the unit?
      The phone charger can power the ESP8266 and Arduino?
      Only thing is, phone charger is mostly 5V, and we want 3.3V. I don't know if there is a small part (because we don't have much space) which can convert 5V > 3.3V

    15. I haven't been working on this at all lately since I'm in the middle of moving process, but this post is highly interesting on how to power an esp without draining the meters power supply :

  7. Great work Kalle!
    Have you made any progress with the ESP8266 version? Preferably using the ESP processor rather than the Arduino?

  8. Kalle,
    Did you ever got this to work with the ESP8266?
    Regards, Harry

  9. Got it working using ESP only. ESP sending (TuanPM) MQTT messages to my broker every 1 sec containing Voltage, Power and Kwh (calculated since start). Also used a small 5V PSU fitting nicely in the meter housing to power the ESP. Created a little PCB to fit the EPS module and some components to level shift/buffer the meter signals, Rx/Tx and make 3.3V for the ESP module.

    1. hi, I'm from Hanoi. I have problem when doing this project. Can you give me some help. my email is Pls give me your email, or contact, i want to ask you some info

  10. Nice hack, but we can't just simply calculating AC power with P=E.I, in the AC power, E.I resulting in VA
    to get Watt we must take the power factor / cos phi in to account.

  11. Hi Kalle,

    Based on you hack using an Arduino, i am trying to build an Raspberry Pi version using Java.
    And it seems to be harder to realize than it initially estimated :-)

    It seems that my current issue is to get the synchronization. As i can make up from your blog, the data is always send in 70 packages of 8 bytes. So every 70 packages there should be a synchronization by a Clk High signal between 1 and 2 ms.

    In my code ( i do detect a constant Clk Sync pulse of 1.23-1.32ms.
    Bu the number of packages between thee Clk Sync pulses seem to vary.

    Synchronized [1.23 ms] 760 bits 95 bytes 11 packages
    Synchronized [1.32 ms] 4659 bits 582 bytes 72 packages
    Synchronized [1.32 ms] 938 bits 117 bytes 14 packages
    Synchronized [1.29 ms] 11466 bits 1433 bytes 179 packages
    Synchronized [1.32 ms] 9215 bits 1152 bytes 144 packages
    Synchronized [1.29 ms] 3630 bits 453 bytes 56 packages
    Synchronized [1.32 ms] 1940 bits 242 bytes 30 packages
    Synchronized [1.32 ms] 957 bits 119 bytes 14 packages
    Synchronized [1.29 ms] 1918 bits 239 bytes 29 packages
    Synchronized [1.29 ms] 2983 bits 372 bytes 46 packages

    Do i misinterpret you blog, or can you give me a new insight?
    I am currently stuck...


  12. The LCD shows cos(phi) value, is it not possible to get that value from the SPI?
    I just bought a USB Isolator (waiting for it to arrive) and I am planning on connecting a cheap logic analyzer to replicate this project.
    I am a bit concerned because in Europe the plugs can be connected either way so Neutral and Line can be in either of the socket pins. Any thoughts on this?

    1. The SPI shows the same as the LCD, so if the LCD is correct, you have the correct value. I use a separate miniature PSU to isolate the thing from mains.

    2. @Harry do you have documentation about your solution with a ESP8266?

    3. This comment has been removed by the author.

    4. No documentation, if you send me an email ( i can send you the code (Native SDK 2.0.0)

  13. Did anyone manage to read the Power Factor as well? this value is VERY important to calculate the correct power usage

  14. I'd like to buy power meter like this one on my local market (Poland) and I've found 2 similar but not identical:
    first one (blue buttons): and
    second one (green buttons):

    Do you think these have the same internals?

    1. Witam
      Prosze o kontakt na

  15. This is a brilliant hack Kalle. I've tried it but annoyingly can't get it to work. I started trying with an ESP8266 but then went to an Arduino Nano in case it was some issue with ESP's.

    My meter looks the same as y ours but inside is slightly different and sounds similar the the one the guy in this comment has -, with 9 wires on the ribbon cable and a 24C02 EEPROM on the power board. However my power board has an id: KR-PM01-A5 2015.08.20, so that date is much later than his comment.

    In that comment his Voltage value was correct and just the Power value was out but mine has the Voltage wrong too and seems quite random - 967.1, 124.2, 455.8, 899.8, 248.2, 574.1, 60.9,...

    Based on your comment to that comment about debuging i've changed loop to be just:

    void loop() {
    //do nothing until the CLK-interrupt occures and sets inSync=true
    if (inSync == true) {
    // Serial.println("In sync 1");
    CountBits = 0; //CLK-interrupt increments CountBits when new bit is received
    //while (CountBits < 40) {} //skip the uninteresting 5 first bytes

    Serial.print("CountBits:"); Serial.print(CountBits); Serial.print(" ");
    if(NextBit == true){
    Ba = (Ba << 1);
    Ba |= (1<<0); //changes first bit of Ba to "1"

    if(CountBits % 8 == 0){ //true every 8 bit => 1 byte
    Serial.print(Ba, HEX);Serial.print(" ");

    inSync = false; //reset sync variable to make sure next reading is in sync.

    And that gives a sea of numbers like this:

    CountBits:0 C7 7 8E F 3C 1E 78 3C
    CountBits:0 E0 E3 C1 CF 83 9F F 3E
    CountBits:0 3C F8 71 F0 E3 E1 C7 C3
    CountBits:0 1F F 80 F3 CF 7 9E E
    CountBits:0 E0 E7 C1 CF 83 9F F
    CountBits:0 3C F8 71 F0 E3 E1 C7 C3
    CountBits:0 1F E 3E 1C 7C 30 F8
    CountBits:0 E3 87 C7 F 8E 1F 1C 3E
    CountBits:0 60 F8 C1 F1 83 F0 FC
    CountBits:0 9F E 3E 1C 7C 38 F8
    CountBits:0 E1 C7 C3 8F 86 1F 1C
    CountBits:0 70 F8 E1 F1 C3 E3 7 C6
    CountBits:0 1F 18 3E 70 78 E0 F1 C1
    CountBits:0 C7 7 8E F 1C 1E 78 3C
    CountBits:0 E0 F0 7F C 30 F8 E1 F1
    CountBits:0 1F 1C 3E 30 7C 60 F8 C1
    CountBits:0 E3 7 8E F 1C 1E 38 3C
    CountBits:0 E0 F1 C1 E3 83 CF 7 9E
    CountBits:0 1E 78 3C F0 79 E0 F3
    CountBits:0 CF 7 9E F 3C 1E 1F E3
    CountBits:0 70 F8 C1 F1 83 E3 7
    CountBits:0 1F 18 3E 70 7C E0 F1 C1
    CountBits:0 C7 7 8E F 1C 1E 38 3C
    CountBits:0 E0 F1 C1 E3 83 CF 7
    CountBits:0 1E 78 3C F0 79 E0 F3 C1
    CountBits:0 CF 7 87 F8 63 87 C7
    CountBits:0 70 F8 C1 F1 83 E3 7 C6
    CountBits:0 1F 18 3E 70 7C E0 F9 C1
    CountBits:0 C7 7 8E F 1C 1E 38
    CountBits:0 E0 F1 C1 E3 83 C7 7
    CountBits:0 1E 78 3C F0 79 E0 F0 7F
    CountBits:0 61 87 C7 F 8E 1F 1C 3E
    CountBits:0 70 F8 E1 F1 83 E3 7 C6
    CountBits:0 1F 18 3E 30 7C E0 F9
    CountBits:0 E7 7 8E F 1C 1E 38 3C
    CountBits:0 E0 F1 C1 E3 83 C7 7 8E
    CountBits:0 1E 78 3C 1F C3 C 3E 18
    CountBits:0 E3 87 C7 F 8E 1F 1C 3E
    CountBits:0 70 F8 E1 F1 83 E3 7 C6
    CountBits:0 1F 18 3E 30 7C 60 F9 C1
    CountBits:0 C7 7 8E F 1C 1E 38 3C

    From the meter display at the time the voltage is around 247 and the Watts around 69.

    Does that show anything useful to you or any hints on how I might debug this?

    1. BTW, this is the meter -

    2. my serial.print appear count bits 0,0,0

  16. Hi!
    Strange... The bytes you posted makes no sense! Converted them to binary to see if there was an obvious shift error (see below) but i can't figure it out. lots of "111", "1111" or "11111"are you sure you're not sniffing on the mosi instead of the miso? (still makes no sense compared to mine: 255="1111 1111" and 30="0001 1110")
    Maybe the serial.print is too slow and interfear with the interrupt that collects the data (try and do the same thing but instead save all the bytes in an array that you print out after all the bytes are read)

    11000111 : 00000111 : 10001110 : 00001111 : 00111100 : 00011110 : 01111000 : 00111100
    11100000 : 11100011 : 11000001 : 11001111 : 10000011 : 10011111 : 00001111 : 00111110
    00111100 : 11111000 : 01110001 : 11110000 : 11100011 : 11100001 : 11000111 : 11000011
    00011111 : 00001111 : 10000000 : 11110011 : 11001111 : 00000111 : 10011110 : 00001110
    11100000 : 11100111 : 11000001 : 11001111 : 10000011 : 10011111 : 00001111 : 00000000
    00111100 : 11111000 : 01110001 : 11110000 : 11100011 : 11100001 : 11000111 : 11000011
    00011111 : 00001110 : 00111110 : 00011100 : 01111100 : 00110000 : 11111000 : 00000000
    11100011 : 10000111 : 11000111 : 00001111 : 10001110 : 00011111 : 00011100 : 00111110
    01100000 : 11111000 : 11000001 : 11110001 : 10000011 : 11110000 : 11111100 : 00000000
    10011111 : 00001110 : 00111110 : 00011100 : 01111100 : 00111000 : 11111000 : 00000000
    11100001 : 11000111 : 11000011 : 10001111 : 10000110 : 00011111 : 00011100 : 00000000
    01110000 : 11111000 : 11100001 : 11110001 : 11000011 : 11100011 : 00000111 : 11000110
    00011111 : 00011000 : 00111110 : 01110000 : 01111000 : 11100000 : 11110001 : 11000001
    11000111 : 00000111 : 10001110 : 00001111 : 00011100 : 00011110 : 01111000 : 00111100
    11100000 : 11110000 : 01111111 : 00001100 : 00110000 : 11111000 : 11100001 : 11110001
    00011111 : 00011100 : 00111110 : 00110000 : 01111100 : 01100000 : 11111000 : 11000001
    11100011 : 00000111 : 10001110 : 00001111 : 00011100 : 00011110 : 00111000 : 00111100
    11100000 : 11110001 : 11000001 : 11100011 : 10000011 : 11001111 : 00000111 : 10011110
    00011110 : 01111000 : 00111100 : 11110000 : 01111001 : 11100000 : 11110011 : 00000000
    11001111 : 00000111 : 10011110 : 00001111 : 00111100 : 00011110 : 00011111 : 11100011
    01110000 : 11111000 : 11000001 : 11110001 : 10000011 : 11100011 : 00000111 : 00000000
    00011111 : 00011000 : 00111110 : 01110000 : 01111100 : 11100000 : 11110001 : 11000001
    11000111 : 00000111 : 10001110 : 00001111 : 00011100 : 00011110 : 00111000 : 00111100
    11100000 : 11110001 : 11000001 : 11100011 : 10000011 : 11001111 : 00000111 : 00000000
    00011110 : 01111000 : 00111100 : 11110000 : 01111001 : 11100000 : 11110011 : 11000001
    11001111 : 00000111 : 10000111 : 11111000 : 01100011 : 10000111 : 11000111 : 00000000
    01110000 : 11111000 : 11000001 : 11110001 : 10000011 : 11100011 : 00000111 : 11000110
    00011111 : 00011000 : 00111110 : 01110000 : 01111100 : 11100000 : 11111001 : 11000001
    11000111 : 00000111 : 10001110 : 00001111 : 00011100 : 00011110 : 00111000 : 00000000
    11100000 : 11110001 : 11000001 : 11100011 : 10000011 : 11000111 : 00000111 : 00000000
    00011110 : 01111000 : 00111100 : 11110000 : 01111001 : 11100000 : 11110000 : 01111111
    01100001 : 10000111 : 11000111 : 00001111 : 10001110 : 00011111 : 00011100 : 00111110
    01110000 : 11111000 : 11100001 : 11110001 : 10000011 : 11100011 : 00000111 : 11000110
    00011111 : 00011000 : 00111110 : 00110000 : 01111100 : 11100000 : 11111001 : 00000000
    11100111 : 00000111 : 10001110 : 00001111 : 00011100 : 00011110 : 00111000 : 00111100
    11100000 : 11110001 : 11000001 : 11100011 : 10000011 : 11000111 : 00000111 : 10001110
    00011110 : 01111000 : 00111100 : 00011111 : 11000011 : 00001100 : 00111110 : 00011000
    11100011 : 10000111 : 11000111 : 00001111 : 10001110 : 00011111 : 00011100 : 00111110
    01110000 : 11111000 : 11100001 : 11110001 : 10000011 : 11100011 : 00000111 : 11000110

    1. Your comment about sniffing on the wrong wire made me recheck the connections - i had it wired up wrong. Duh! Works now. Very happy. Thank you so much.

    2. Glad i could help!
      Please share with us when you have a working setup with the ESP!

    3. I have now, linked from your other post about wireless operation -

    4. Sweet! I have bought the same kind of ac/dc converter and will replicate your setup when I have time :)

  17. Hi
    Just bought all the stuff to get this working with and ESP8266-12 and hopefully monitor the data with emoncms. Ill post the results here when I can.

  18. Thanks to Karl's work and other comments here, I took a stab at this as well.
    I read over datasheet and looked at logic analyzer traces from startup, and have quite a few observations.
    I re-implemented the spi-bitbang reading and doing things a little bit differently. Timing was tricky because we dont have any real start/end framing (like SS), so have to infer the stop/start from the longer inter-frame clock pulse.
    I have started a sketch with nrf24l01 -> raspberry pi integration here:

    Hopefully in next few days, I'll put together a short write up of the analysis of the comms (register transfers, etc) along with a raspberry pi python script which i'm using to receive at the other end.

  19. hello, feel free to look here
    same energy chip, maybe my software can help ?

    1. when I plug gnd of watt meter to arduino, the lcd of watt meter disapear, i check it with multimeter, it connect to hot line of ac. what wrong with me?

  20. I cant use your code with arduino 5v-328mhz. How should I do?if i can use it with 5v, then i can upload it on the internet. Is there any change in the code to run with 5v arduino.

  21. when I plug gnd of watt meter to arduino, the lcd of watt meter disapear, i check it with multimeter, it connect to hot line of ac. what wrong with me?

  22. the first line in void loop (if(inSync == true)) is not execute. what wrong with clk pin?

  23. when I plug gnd of watt meter to arduino, the lcd of watt meter disapear, i check it with multimeter, it connect to hot line of ac. what wrong with me?

  24. Nice and useful information about pop up electric sockets. I really liked it.
    Good work.

    pop up power

  25. Hi,
    You divide/multiply the successive bytes by 255, that should be 256.

    the data is probably straight 24 bits from a 24-bit ADC converter.

  26. Hi,
    It's nice work... any idea to measure the effective load/cos phi & harmonic distortion by using the CS5460A chip?
    Many thanks for your shared info

  27. thank you for sharing good information about energy meter

  28. I don't have much experience soldering. How did you tap into the ribbon cables? Looks pretty difficult to me, and I can't see how you did the connection in any of the pictures.

    Thanks and great work!

  29. I need some help to fix my watt meter, can anyone kindly let me know the value of the orange color capacitor in the watt meter circuit board ? mine was blown and burnt while testing my cooler. thanks in advance.

  30. Hi Amila, the circuit board in mine are slightly different than the photo's in this blog post, and mine don't have a component where the orange one is the above photos. There are some holes where something could be, labeled VRT. You can see mine here:

  31. Hi ,
    I haven't been using my meter for a while and the screen stopped showing data. It stays blank. I have the 240v version which looks like the one ant has (
    The battery is showing 1.27v upon measurement (should be a 3.6v).
    Anybody has an idea on what's wrong? The capacitors all look ok. not blown.

  32. MestiQQ Adalah perusahaan judi online KELAS DUNIA ber-grade A

    Sudah saatnya Pencinta POKER Bergabung bersama kami dengan Pemain - Pemain RATING-A

    Hanya dengan MINIMAL DEPOSIT RP. 10.000 anda sudah bisa bermain di semua games.

    Kini terdapat 8 permainan yang hanya menggunakan 1 User ID & hanya dalam 1 website.


    100% tanpa robot, 100% Player VS Player.
    Live Chat Online 24 Jam Dan Dilayani Oleh Customer Service Profesional.

    Segera DAFTARKAN diri anda dan Coba keberuntungan anda bersama MestiQQ
    ** Register/Pendaftaran : WWW-MestiQQ-POKER
    Jadilah Milionare Sekarang Juga Hanya di MestiQQ ^^

    Untuk Informasi lebih lanjut silahkan Hubungi Customer Service kami :
    BBM : 2C2EC3A3
    WA: +855966531715
    SKYPE :

  33. We now have any level graph and or chart nearby the house therefore young people can easily examine by themself for their Sept elevation all year long.

  34. مرحباً بكم جميعاً
    أرجوا المساعدة لدى عداد كهرباء خارج المنزل واريد إيقافه من داخل المنزل عداد ديناميكي أرجوا الرد اسدد شهرياً 120$

  35. A voltage regulator is a system that automatically maintains a constant voltage level and this includes Buck converter and Boost converter. Voltage regulators are found in devices such as computer power supplies where they stabilize the DC voltage. It can also use an electronic component, depending on the design. You can Buy voltage regulators at an assured price from various shopping sites in India.