MainsMeasurer
disclaimer
This device works with voltages that are deadly. Please only try to duplicate it if you're a trained professional. And if you're a trained professional and see a problem with it: please let me know.
the story
I want to measure the net-voltage to see how often the solar cells in the neighbourhood would switch off. This happens when the net voltage reaches 253 V.
In the Netherlands we have a "slimme meter" (smart meter) in most households, unfortunately not everyone of them exports the voltage (let alone frequency).
first iteration
This one consisted of a regular USB power supply from which I removed the casing. Also a raspberry pi pico, a zmpt101b for sampling the AC sine wave and a pzem004tv30.
second (failed) iteratrion
Same sensors, different box. It failed because I could not fit everything in the casing.
third iteration
Same sensors, nice rack mountable 5 V powersupply.
What it measures:
- net/line voltage
- frequency (around 50 Hz (in Europe))
- current going through the device (via the socket)
To accurately measure the frequency, an 10MHz OXCO is used (divided to 10kHz with a PICDiv). This clock-signal is used to trigger when to sample the sine wave.
It has a nice web-interface (data is also send via MQTT of course):
software
For measuring the mains frequency, I used Bertrik Sikken's measuring code which I ported to the RP2040 micro processor and 'connected' to a 10 kHz sampling interrupt produced by an OXCO (see above).
Source code download link: mainsmeasurer.tar.xz.
hardware
parts list