Arduino sketch for reading CS5460A-based digital power meter.
![Image of Power meter banggood SKU089379](http://img.banggood.com/thumb/large/upload/2012/jiangjunchao/SKU089379/yuan/SKU089379 (1).jpg)
Ground reference of PCB inside meter is tied to HOT (Line). It is at mains level. Use galvanic isolation, e.g. optocouplers, etc if you want to wire this up directly to something else. Be sure you know what your are doing around potentially lethal mains-level voltages. Use at your own risk!
- CS5460A-based power monitor aka "watt" meter
- Arduino Pro-Mini 3.3v 8Mhz
- NRF24L01+ 2.4 GHz radio module
- Arduino pin 2 is connected to CLK
- Arduino pin 3 is connected to SDO
- Grounds are common to pcb and arduino inside the enclosure (see warning above!)
- Taking 5V from 78L05 regulator to arduino Vraw in.
- NRF24L01 taking vcc from arduino (3.3v regulated)
- using 10uF cap on both arduino Vraw and NRF24L01 VCC inputs to smooth transients.
Analysis of SPI communication between oem mcu and CS5460A chip.
- Saleae Logic (highly recommended!) was used to analyze the communication between original mcu and CS5460A chip.
- Some captures of startup and running/recurring signals are in logic_analyzer_captures folder.
- Refer to datasheet for complete understanding of registers and formatting of values.
- In annotations below mcu->cs5460 (SDI) is
>
while cs5460->mcu (SDO) is<
> A0 (power-up/halt)
> 00 (reg read: config)
< 00 00 01 (config reg: DCLK=MCLK/1)
> 40 01 00 61 (reg write: config. PGA Gain 50x, IHPF=1, VHPF=1)
> 44 4A 32 DF (reg write: Ign [current chan gain]. value: 1.15935)
> 48 3E 9B 5A (reg write: Vgn [voltage chan gain]. value: 0.97823)
> 00 (reg read: config)
< 01 00 61
> 04 (reg read: Ign)
< 4A 32 DF
> 08 (reg read: Vgn)
< 3E 9B 5A
> 0A (reg read: Cycle Count)
< 00 0F A0 (4000 = 1/sec)
> E8 (start conversion, continuous)
> 1E (reg read: status)
< 10 03 C1 (DRDY=0)
... repeats query until conversion is done (DRDY=1)...
> 1E
< 90 03 C1 (DRDY=1)
> 5E 80 00 00 (reg write: status - clear DRDY)
> 18 (reg read: Vrms
< 2C CA 01
> 16 (reg read: Irms)
< 00 2B 7A
> 14 (reg read: E [energy])
< FF FE 26