-
Notifications
You must be signed in to change notification settings - Fork 1
watt

#Serial protocol

The power meter sends 70 (sometimes 71) packages of 8 bytes every second. Those blocks are separated by 47ms. This is a massive amount of bits (4480 to 4544) compared to the really useful data - the last 24 bits that contains the watt measurement.
Kalle Löfgren shows how to extract the voltage as well, and from that the amperage can be calculated. But i decided that was not needed in this version.
The last 24 bits:

Kalle describes how the data pins can be accessed. Just be aware that the internals of the power meter can be absolutely lethal. Depending on how you insert the meter to the wall the logic pins can be offset by 230V AC.
I connected the CLOCK and MISO to an inverting schmitt trigger, then to PC123 optocouplers (also inverting). This way i don't put any load on the logic pins and the resulting signal is non-inverted. And most importantly - the signal is not offset by 230V AC anymore :)
The ideal would be to mount the esp8266 inside the case, that way the 230V AC offset would not matter. But the internal power supply is rather weak. It is barely able to power the optocouplers as it is.