Connect with us

Looking for ways to measure AC line voltage with a uP

Discussion in 'Electronic Design' started by Donald, Nov 24, 2006.

Scroll to continue with content
  1. Donald

    Donald Guest

    Looking for ways to measure AC line voltage with a uP.

    The uP would connect to a PC serial port.

    Also measuring AC line current would be useful.

    thank you

    donald
     
  2. How about a DMM with an RS-232 port ? Lots of meters available. "dmm
    rs232" came up with 27000 hits on the Yahoo search.

    GG
     
  3. Donald

    Donald Guest

    That would add a large cost to the project.

    I try ggogle/yahoo for "dmm rs232" and see what may turn up.

    donald
     
  4. Donald

    Donald Guest

    I would like to measure the AC line on a remote heater and water pump.

    I can run a RS-485 to the site, but measuring the AC side is where I am
    having to be creative.

    My idea is to isolate the line measuring side from the uP.

    What do you mean by "make accuracy expensive" ?

    This is a one off project, for our hot tub. :)

    donald
     
  5. John  Larkin

    John Larkin Guest

    How about a voltage stepdown transformer and a current transformer,
    both running into a sound card?

    Somebody must have done this by now; ask Google.

    John
     
  6. Donald

    Donald Guest

    Good idea, if the site was closer. The RS-485 line is already 200Ft.

    I have a uP already on-site measuring temperature.

    Voltage and current are next.

    donald
     
  7. Tim Shoppa

    Tim Shoppa Guest

    Do you care about peak or RMS? The lowest-end meters don't really do
    RMS.

    There are numerous voltmeters out there with serial, USB, GPIB, and
    other interfaces. If you want current, get one with a current probe.
    They solve the isolation, reference, measurement, interface, and RMS
    (except on the cheapest) for you.

    Most scopemeters can be put into chart-recorder mode and log AC
    voltages for you.

    There are commercial recorders that monitor power-line quality
    every-which-way-from-Sunday (peaks, noise, harmonics, frequency, you
    name it) if that's what you want.

    I'm sure there's some way to do it with a uP... put 120VAC across a uP,
    count how many pieces it explodes into,... etc. If you get the idea
    that the microprocessor is only a small part of the solution then
    you're getting the story.

    Tim.
     
  8. Eeyore

    Eeyore Guest

    Are you sure you want to use a serial port ? They're becoming rare these days. A
    very silly move imho btw.

    Graham
     
  9. Donald

    Donald Guest

    True enough, but my old PC has a serial port.
    I already have a uP onsite measuring temperature.

    Voltage and current are next.

    donald
     
  10. I have a simple current system in use that uses an old tape recorder
    playback head glued against one of the main leads, followed by a peak
    detector.
    You likely need no RMS, but if you use a 50Hz (or 60Hz US) lowpass, and
    use a PIC with a ADC, you will have several channels analog input, and you
    could take a lot of samples and get peak-to-peak value, and calibrate once
    against a real meter (So 110V would be 110 x 2 x sqrt(2) = 311V,
    100x attenuator gives 3.11V peak peak on the ADC).
    The PIC will have RS232 or you can do it in software, add a MAX232.
    You could even FM modulate that signal and send it via the mains.
    As you already have temp, you maybe already have the ADC, and maybe enough
    channels, else multiplex with some 74HC405x CMOS switch.
    Main isolation, well you likely already have a transformer, grab and measure
    the secondary for voltage, if no transformer and powered by for example RTG
    or polonium 210, you could generate current for an optocoupler via capacitive
    coupling if you want o be exotic, and the current in the photo-transistor
    at the other end of the optocoupler would be proportional to the input mains
    voltage.
    Or buy a transformer.
    There are many other ways I will not discuss these in this limited space as I
    am watching telly on this PC now, and looks like I have to zap again.
    If you made it this far thank you for your attention span.
     
  11. John  Larkin

    John Larkin Guest

    OK, scale the AC voltage and current to managable values and feed them
    into ADC channels on your uP. If the ADC is unipolar, bias them to
    about midscale. Now and then sample the voltage and current signals as
    a pair of E:I values, as close to simultaneously as you can manage.

    Then

    Autozero out the longterm average value of each, to remove any DC
    components.

    Multiply the E:I numbers to get power samples.

    Lowpass filter or group average those products to get realtime power.

    Integrate that to KWH, or just integrate the sample products if you're
    not interested in realtime power.

    You can also do true RMS calcs on the separate E and I samples, to get
    true rms voltage and current. Multiply those to get KVAs, and divide
    true power by KVAs to get power factor.

    Easy.

    John
     
  12. Rich Grise

    Rich Grise Guest

    Nowhere near as much as designing and building from scratch.

    Good Luck!
    Rich
     
  13. Rich Grise

    Rich Grise Guest

    Then, just use an ordinary voltage divider, maybe a buffer or precision
    rectifier to get it into the uP, and either a current transformer or
    shunt for the current, suitably buffered.

    What's the real problem?

    Thanks,
    Rich
     
  14. Guest

    This is what I would do: use a bridge rectifier along with a voltage
    divider, feed that into your uP, take lots of A/D samples and look for
    the peaks. Calculate RMS from that value. I'm assuming your input AC
    is still a nice sinewave.

    For current, use one of the Allegro Hall effect current sensors. 50 or
    100A capacity, totally isolated, 0-5V output. Again, look for the
    peaks.
     
  15. DaveM

    DaveM Guest

    Not really such a good idea... The gain through a sound card is very
    uncalibrated, and controlled by the volume slider in the sound mixer (assuming
    Windows OS). The gain changes each time you adjust the volume of your favorite
    CD track. So unpredictable as to be useless in this situation, unless you
    provide (programmatically) some means of presetting the calibration.

    --
    Dave M
    MasonDG44 at comcast dot net (Just substitute the appropriate characters in the
    address)

    Some days you're the dog, some days the hydrant.
     
  16. USB - serial isn't bad. Or add a serial card - very cheap.
     
  17. John  Larkin

    John Larkin Guest


    Just set up the sound card gains and such when you use it. Heck, you
    can do that in PowerBasic.

    John
     
  18. My PC is playing background music all day.... sound card 1 occupied.
    For web video and TV soundcard 2 is used... different speaker (or headphone).
    He may need that soundcard.
    Soundcard 1 is also used for net2phone, skype etc. Or was it 2?
    2 soundcards is not even enough.
     
  19. Donald

    Donald Guest

    Thanks to all who responded to my questions.

    I am looking at opto-isolating an serial ADC.

    Running the ADC with a battery would power the circuit.

    Dropping the line voltage with a resistor divider to 2 volts and measure.

    I have some serial ADCs on hand (just need to find them).

    I need to locate some current monitors.

    I want to calulate the power used by the heater.

    donald
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-