AC Voltage Measurement using PIC

Thread Starter

Qual

Joined Aug 5, 2016
48
hi,

I need help to design a circuit which receives the voltage from AC mains( i.e Line and Neutral) and gives out a low voltage to PIC .
Where PIC receives this voltage and displays the AC mains voltage on LCD by doing calculations.
 

Alec_t

Joined Sep 17, 2013
14,312
a circuit which receives the voltage from AC mains( i.e Line and Neutral) and gives out a low voltage to PIC .
It's called a 'transformer'. This provides isolation from the mains to protect you and the PIC from danger. The transformer low voltage output (e.g. 3V RMS) is a known fixed fraction of the mains voltage input.
Welcome to AAC!
 

Thread Starter

Qual

Joined Aug 5, 2016
48
It's called a 'transformer'. This provides isolation from the mains to protect you and the PIC from danger. The transformer low voltage output (e.g. 3V RMS) is a known fixed fraction of the mains voltage input.
Welcome to AAC!

Thank you for welcoming.

I want to measure this ac mains voltage and display the same on LCD.
I have seen many articles regarding this where they say isolation is required between mains and pic.
But i want a circuit which gives output in the range of 0-5V so that it can be fed to PIC.
 

bertus

Joined Apr 5, 2008
22,276
Hello,

An optocoupler will not give a linear response.
A transformer will be almost linear, until you reach saturation.

Bertus
 

Thread Starter

Qual

Joined Aug 5, 2016
48
Here in below pdf designer does not use any transformer or optocoupler but he says he is doing measurement using op amp.

Can anyone guide me in this matter, as i am getting confused with many circuits which show measurement .


{Moderator's note: The application note has been removed]
 
Last edited by a moderator:

AlbertHall

Joined Jun 4, 2014
12,346
Here in below pdf designer does not use any transformer or optocoupler but he says he is doing measurement using op amp.
This circuit is not isolated from the mains - the whole circuit is live. It uses a capacitor input power supply discussion of which is not allowed in here on safety grounds.

This circuit only measure current. You would need to do some work to convert it to reading voltage. Some of your new circuitry will be at mains potential requiring great care troubleshooting if doesn't work as you expected.

The transformer low voltage output (e.g. 3V RMS) is a known fixed fraction of the mains voltage input.
A 3V transformer would provide around 4.2V of rectified DC which would give you reasonable for higher supply voltages and still keep within the 0V to 5V for the PIC. For higher transformer voltages, you just a potential divider to reduce the voltage to the range the PIC can measure.
Using a transformer means your mains circuitry is simple and trouble free - connect the mains supply to the primary. Simple and safest.
 

Thread Starter

Qual

Joined Aug 5, 2016
48
Thank you AlbertHall for your reply. I got some basic idea. :)

Is there any other way to provide isolation between mains and pic.

My aim is to design a circuit which can do measurement of ac voltage

And in addition current display and power factor too.
 

crutschow

Joined Mar 14, 2008
34,408
A transformer is the easiest and best way to read the mains voltage with isolation.
Why are you resisting that solution?
It's possible to use an opto coupler circuit for that purpose but it becomes a lot more complex.

Note that a current transformer goes around only one of the main's wires.

To determine power factor you will need to determine the ratio of the real power to the apparent power.
You can't do that by measuring the rectified AC (DC) voltage, it must be measured in the AC form.

The easiest way to determine the power factor is to simultaneously sample the voltage and current at a high frequency (perhaps a 100 times the main's frequency) with an A/D converter and then calculate the ratio of the real power to the apparent power to get the value of the power factor.
This will give an accurate power factor, even if the load causes distortion in the current drawn, such as many electronic devices do.
 

NorthGuy

Joined Jun 28, 2014
611
When calculating power, keep in mind that the current transformer will introduce some sort of phase shift, perhaps few degrees. If you're measuring power of a motor with pf around 0.6, this few degree phase shift will produce substantial errors, so you will need to correct it (most likely in your software).
 

crutschow

Joined Mar 14, 2008
34,408
When calculating power, keep in mind that the current transformer will introduce some sort of phase shift, perhaps few degrees. If you're measuring power of a motor with pf around 0.6, this few degree phase shift will produce substantial errors, so you will need to correct it (most likely in your software).
I would expect the transformer phase shifts for both voltage and current to be very small, but they certainly could be corrected by measuring the power of a resistance load and adjusting the calculations (if necessary) to give a PF of 1.
 

Thread Starter

Qual

Joined Aug 5, 2016
48
A transformer is the easiest and best way to read the mains voltage with isolation.
Why are you resisting that solution?
It's possible to use an opto coupler circuit for that purpose but it becomes a lot more complex.

Note that a current transformer goes around only one of the main's wires.

To determine power factor you will need to determine the ratio of the real power to the apparent power.
You can't do that by measuring the rectified AC (DC) voltage, it must be measured in the AC form.

The easiest way to determine the power factor is to simultaneously sample the voltage and current at a high frequency (perhaps a 100 times the main's frequency) with an A/D converter and then calculate the ratio of the real power to the apparent power to get the value of the power factor.
This will give an accurate power factor, even if the load causes distortion in the current drawn, such as many electronic devices do.

Thank you for your reply,

Reason for resisting Transformer was to make my circuit as simple as that !!

But now after going through through replies from all of you i clear that opto coupler based circuit would be complex.!!!
 

BobaMosfet

Joined Jul 1, 2009
2,113
Unfortunately AAC only allows for transformer isolation, which is a shame because there are cheaper, esier, and equally safe ways to do it without.
 

DickCappels

Joined Aug 21, 2008
10,169
Unfortunately AAC only allows for transformer isolation, which is a shame because there are cheaper, esier, and equally safe ways to do it without.
The relative safety of a given method may be highly dependent upon the experience and skill of the one using the method. Hence, discussion of circuits that are powered directly from the mains are not allowed here and circuits that connect to the mains without isolation are carefully reviewed with respect to safety to not only those immediately participating the the thread but also for inexperienced users who might come across the thread later.
 
Top