Mains AC: invasive method electronics

Caution: The circuitry below involves wiring up to high voltage mains electricity. Improper care could result in a potentially fatal electrical shock. When working on this circuit make sure the device is unplugged from the mains socket. The design is distributed in the hope that it will be useful. I take no responsibility for any damage to equipment or injury or death caused by following the information here. If you accept, great! please continue.

Note: I have recently had a bit of trouble with the hcpl-7520 optoisolators blowing, not sure why yet, it could possibly be a recent change of power supplies. Ive created a discussion page here detailing my attempts to find out why.

Hardware Design Considerations

To calculate power using the invasive method we need to first measure the voltage and current in the mains supply, to read more on how power is calculated have a look at the Measuring Power page.

Voltage Sensing

Using a voltage divider connected directly between the live and neutral wires to measure voltage.

Current Sensing

Using a current sensing resistor to measure the current flowing in the mains supply.

Isolation

For safety we isolate the electronics connected directly to the mains wiring from the Arduino and computer.

Arduino

Details of how we connect the above to the Arduino and the firmware required for processing.

Bill Of Materials

Bill of Materials is available as a published google documents spreadsheet here.

Hi regarding power meter that

Hi regarding power meter that using HCPL-7250, can u calculate the THD of the AC power? and the power factor which is lag or lead. From your calculation the pf = rPower / aPower, but i need to know the pf is lag or lead.. can u tell u how 2 get it? thankyou

Hey, Im afraid I havent tried

Hey, Im afraid I havent tried to calculate THD yet and havent tried to find if pf is lagging or leading. But you may be able to do this if you calculate power factor another way by measuring the time between the zero-crossing of the voltage waveform and the zero crossing of the current waveform. There are some articles on calculating THD around, but I forget where I saw them. If I remember I will let you know.

So there is a way to find THD

So there is a way to find THD out? ok thank for ur reply