120 VAC measurement

Discussion in 'Embedded Systems and Microcontrollers' started by cackharot, Mar 26, 2011.

Thread Status:
Not open for further replies.
  1. cackharot

    Thread Starter New Member

    Feb 2, 2011

    I need to measure only voltage at 120VAC/50Hz power line using micro-controller built in ADC 12-bit whose input rage is 0-2.56V. I have a rough idea of using a resistive/capacitive divider circuit to lower the 120VAC to 2VAC. But what i really don't understand is whether the output of divider network will swing between -2 to 2 VAC or 0-2VAC. If so do i need to level shift it using a 2VDC or use a Diode to remove the negative swing.


    Should be accurate +-0.2V

    I'll be calculating the RMS value in the microcontroller and transmit it to PC via RS232. The sampling frequency is 400Hz.
  2. Kermit2

    AAC Fanatic!

    Feb 5, 2010
    You need to rectify the AC voltage first. I would also consider using a 'peak detector' circuit to obtain the high level of the rectified AC.

    THEN you can use a voltage divider to get the required ADC input range.

    Since you are working with rectified AC, you will be seeing only one polarity of the AC waveform. It will also have identical peaks in the opposite polarity. You will need to multiply your peak reading by two in order to get the positive and negative(peak to peak) value of the AC signal.
  3. beenthere

    Retired Moderator

    Apr 20, 2004
    Not at all - you must reduce the AC voltage with a transformer to isolate the circuit from the line. Otherwise, what you have is a lethal shock hazard, and one that will probably destroy the microprocessor when attached, as the uC will have a properly grounded DC source.

    Proper galvanic isolation is necessary when working with line voltage.
  4. be80be

    Senior Member

    Jul 5, 2008
    I would do it like this but be real careful with the mains side
    And use 1/2 watt resistors

    Moderator's note - that circuit was utterly unsafe and has been edited.
    Last edited by a moderator: Mar 26, 2011
  5. beenthere

    Retired Moderator

    Apr 20, 2004
    I suppose threads like this will have to be closed, as too many members do not get the message that we only consider circuits isolated from the line.
    Last edited: Mar 26, 2011
Thread Status:
Not open for further replies.