I have to measure AC voltage of the mains supply 180-220 VAC through a microcontroller. I have been wondering how to measure it without using a voltage divider. Since the resistance may wear out with time, doesn't sound like a good design.

I can use a transformer but that design would be too bulky. Isn't there any other way? Even the voltage sensing IC's use a resistive network to divide the voltage.

  • 5
    \$\begingroup\$ If resistors "wore out over time", we would have much bigger issues than sensing some AC line voltage. What gives you the idea that this is something that happens? \$\endgroup\$ – Nick Johnson Jun 15 '15 at 13:10
  • 2
    \$\begingroup\$ Resistors do not wear out over time, when dimensioned properly they will last for many many years. A more significant problem is is that with a resistive divider your microcontroller board will not be mains isolated !! That is VERY DANGEROUS unless you know exactly what you are doing. Connecting it to a PC will not be possible then ! You should use a small transformer, this is much safer. That some ICs use resistive networks has nothing to do with what you want. \$\endgroup\$ – Bimpelrekkie Jun 15 '15 at 13:31
  • \$\begingroup\$ @Rimpelbekkie A transformer is not the only solution; an optoisolator (or other isolator) would also work - assuming he's happy to use resistors! \$\endgroup\$ – Nick Johnson Jun 15 '15 at 13:38
  • \$\begingroup\$ Good one, didn't think of that :-) \$\endgroup\$ – Bimpelrekkie Jun 15 '15 at 13:41
  • 1
    \$\begingroup\$ @alexhilton That's nothing to do with parts 'wearing out' - the concern is that the reading you get back may be inaccurate due to resistances changing with temperature. \$\endgroup\$ – Nick Johnson Jun 16 '15 at 11:22

More sane/safe solutions typically use linear (high linearity) optocoupler, which provides several kilovolts of isolation. But designing with these is not exactly a piece of cake. Here's an article on one such design: http://www.edn.com/design/test-and-measurement/4344950/Optocoupler-simplifies-power-line-monitoring (note this for 110VAC, but can be probably be adapted for 230VAC with some care.)


One way or another, you really should have isolation between the power line and any user-touchable parts. The user-touchable parts would be the PC if the micro communicates with the PC, which then logs the data, displays it to users, etc. If this is a stand-alone meter, then all the user-touchable parts can simply be plastic, which insulate the user from the non-isolated signals inside.

Either way, the simplest and most accurate way for the micro to measure the AC signal is to have the signal connected to the micro thru a resistor network. That means the micro is not isolated, or you can say it is on the "hot" side. If this unit has to have external connections, then you can isolate those using opto-isolators.

The advantage of this scheme is that the analog signal is directly connected, and the digital signal is isolated. Isolating digital signals is easier and can be done reliably without data loss or adding inaccuracies to the transmitted information.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.