Electronic – Measuring mains voltage and powering a raspberry pi from the same adapter

mainsraspberry pi

I'm looking to measure AC voltage (just the voltage, not the phase etc.) and power a raspberry pi 3 with a lora concentrator (so there would be a power draw up to 2A @ 5V) from the same ac-ac adaptor, like in the schematic:
enter image description here

The main reason I don't want to use a separate power supply and sense adapter is installation inconvenience.

Would this work, if I chose a beefed up enough wall wart? I'm thinking that a 12V 24VA should be more than sufficient. And since it's using a transformer, the voltage at the adc divider should be linearly proportional to the mains.

The required resolution is 1V, so using a 10bit should be sufficient.
1V @ 240V translates to 12.5mV @ 3V and the ADC has a resolution of 3.2mV @ 3.3VRef

Edit: The 5V regulator before the raspi would most probably be a switching one

Best Answer

Yes using any calibrated “instrument transformer” can measure primary AC voltage with known verified ratio.

You may or not be interested in doing all types of measurements, peak and average then convert both to rms for a sine wave. This depends on signal conditioning in both cases for bandwidth and then sample rate. You can also use S&H and trigger events that exceed a preset threshold or a a ratio differenc and then choose to compress sampled data with statistics such as % of time below -10% of nominal.

Just a few ideas

Related Topic