Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Want to read AC voltage

Status
Not open for further replies.

premkumar9

Member
Hi,
I want to read AC mains voltage using a microcontroller. Want to get a DC voltage proportional to the AC (0-230V). Can I use an optocoupler for this purpose (instead of a transformer). Can anybody suggest a circuit for this?
 
Hi, I want to read AC mains voltage using a microcontroller.
To what degree of accuracy?
Want to get a DC voltage proportional to the AC (0-230V).
OK.
Can I use an optocoupler for this purpose (instead of a transformer).
(My underlined emphasis.)
I would say no, primarily because the optocoupler could never be used instead of a transformer in this context.
Can anybody suggest a circuit for this?
I'm unsure of your goal. Just from your first sentence, it would seem that a simple DVM (which has a microcontroller, of sorts) would be sufficient.

If your goal is to monitor and record, then what your asking for becomes a much bigger project.
 
Accuracy is not crtical. Even 10% variation is OK.

I thought of using a resistor network to to control current to the input side of optocoupler and get a signal proprtional to AC input at the collector.
 
This is what I did recently. I did not want to connect the micro to "ground" or "neutral" because line and neutral get mixed up too often.
A0 and A1 are analog input on the micro.
L1 and L2 are two wires from the power company. (110,0) or (0,110) or (220,0) or (110,-110) Often neutral is more like 10 volts.
The power line voltage is A0-A1. Use software to subtract to get the voltage from line to line or line to neutral.
Use the resistors to divide down to the range the micro can read. (0 to 5V)
I used three resistors R2,3,4 because many resistors are only rated for 100 volts each.
upload_2014-3-31_18-37-15.png

The ground symbol is ground for the micro.
 
What Ron suggested will give you an instaneous voltage. If you want a (not very accurate) average, add diode on L1, diode on L2, and a smoothing capacitor between A0 and A1.
 
This is what I did recently. I did not want to connect the micro to "ground" or "neutral" because line and neutral get mixed up too often.
A0 and A1 are analog input on the micro.
L1 and L2 are two wires from the power company. (110,0) or (0,110) or (220,0) or (110,-110) Often neutral is more like 10 volts.
The power line voltage is A0-A1. Use software to subtract to get the voltage from line to line or line to neutral.
Use the resistors to divide down to the range the micro can read. (0 to 5V)
I used three resistors R2,3,4 because many resistors are only rated for 100 volts each.
View attachment 85346
The ground symbol is ground for the micro.
In this case there is no electrical isolation between the input AC and microcontroller circuit. So I am thinking of using an optocoupler to give this isolation. I am thinking of trying a circuit as shown below (values may be changed). Any suggestion?
upload_2014-4-1_10-14-43.png
 

Attachments

  • upload_2014-4-1_10-2-39.png
    upload_2014-4-1_10-2-39.png
    4.7 KB · Views: 314
In my circuit there is 300k ohms of "isolation". You are not really on the power line.

Optocouplers are not linear or temperature stable.

MCT271M has a gain of 45% min to 90% max at 10mA and 10V.
MCT2E has a min of 20% and a max of ? at 10mA and 10V.
upload_2014-3-31_22-58-4.png

Here is a graph of CTR (some thing like gain) of a part.
A gain of "1" at 3.5 and 10mA.
Gain of 1.1 at 6mA
Gain of .65 at 20mA and 1mA
You can see the gain is very non linear below 2mA.
Use the part from 4 to 9mA.
upload_2014-3-31_23-2-29.png

Here is the CTR verses temperature.
At 10mA the gain changes 6% from 0C to 25C.

Spice does not model this very well. You will have to try this.
 
In my circuit there is 300k ohms of "isolation". You are not really on the power line.

Optocouplers are not linear or temperature stable.

MCT271M has a gain of 45% min to 90% max at 10mA and 10V.
MCT2E has a min of 20% and a max of ? at 10mA and 10V.
View attachment 85353
Here is a graph of CTR (some thing like gain) of a part.
A gain of "1" at 3.5 and 10mA.
Gain of 1.1 at 6mA
Gain of .65 at 20mA and 1mA
You can see the gain is very non linear below 2mA.
Use the part from 4 to 9mA.
View attachment 85354
Here is the CTR verses temperature.
At 10mA the gain changes 6% from 0C to 25C.

Spice does not model this very well. You will have to try this.
Thank you for the informative reply.
I think, the nonlinearity issue can be handled to some extent by suitably coding the microcontroller. Am I right?
 
Only if you know the curve, the whole point of a isolator is to isolate. You wont get any useful readings from it, have you looked into how those clamp meters work? maybe use something like that if you want isolation. But there are probably good reasons for not doing that :D
 
Have a look here:
https://people.ece.cornell.edu/land/courses/ece5030/labs/s2013/clareAN107.pdf
and here:
**broken link removed**

These articles describe linear operation of an opto coupler.
The down side is that you need some active devices (an opamp) on the high voltage side of the isolation barrier.
These devices will need some power, but this could be derived from the voltage being measured using a "transformerless power supply", something which is currently much discussed in other threads here on ETO.
https://www.electro-tech-online.com/threads/the-transformerless-supply-question.140545/
https://www.electro-tech-online.com...he-public-domain-at-last.136196/#post-1146578

JimB
 
Have a look here:
https://people.ece.cornell.edu/land/courses/ece5030/labs/s2013/clareAN107.pdf
and here:
**broken link removed**

These articles describe linear operation of an opto coupler.
The down side is that you need some active devices (an opamp) on the high voltage side of the isolation barrier.
These devices will need some power, but this could be derived from the voltage being measured using a "transformerless power supply", something which is currently much discussed in other threads here on ETO.
https://www.electro-tech-online.com/threads/the-transformerless-supply-question.140545/
https://www.electro-tech-online.com...he-public-domain-at-last.136196/#post-1146578

JimB
Thank You.
 
Why not use a transformer? A tiny one wouldn't take up much more space than the opto plus associated components.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top