I want to measure AC power of any general device such as TV, laptop etc using a microcontroller. My MCU is ARM Cortex-M TM4C1233H6PM.
I am using ACS712 current sensor to measure the AC current and then using an optocoupler to isolate it from my MCU. After which, it is fed to the ADC of my MCU and it's value measured.
My problem is with voltage measurement. I do not have access to many transducers and voltage measuring IC's in my area. Here is what I have though so far along with my questions related to it:
Use a transformer to convert from 0-220V AC to 0-5V DC and then feed it to my MCU's ADC using another optocoupler.But my questions are these:
1)Won't my voltage measured, be in a smaller range (0-5V DC) then my current measured in AC and the power will come out wrong? Also, since my voltage is now measured in DC, how can I calculate the AC power?
2)How can I find the zero crossings and phase difference (theta) to measure P=VIcos(Theta) in both current and voltage?
I know my questions may seem rather lengthy but I really do need your help. Thanks for any help!