1. OCAU Merchandise now available! Check out our 20th Anniversary Mugs, Classic Logo Shirts and much more! Discussion here.
    Dismiss Notice

Measuring ac amps and volts and dc volts with a Pi

Discussion in 'Electronics & Electrics' started by THE_PROFESSOR, May 11, 2018.



    May 25, 2002
    Hi all..

    I have a box I built in a rush for testing custom PSUs at work - it looks horrible... a rough ABS enclosure with 4 different panel meters. While it works fine, i opened my big mouth and said I could do a better job...

    I need to measure...
    AC volts from 1 to 120
    AC amps from 0 to 4 (important to be able to see and measure from about 50ma.. 10ma would be better)
    DC volts to 30

    During testing, the normal readings are 90VAC, 300ma AC and 23 VDC. AC current overload can just shoot up, but 2,3 and 4 amps mean different things. AC current of around 5 to 20ma indicates something as well. Max AC current could go to 5A.

    I have to use a Pi, (boss says so). Have a Pi 7"touch screen. AND it needs to look good. I expect to have to code, but any ideas fellow workers... I would be REALLY grateful.

  2. RussellK

    RussellK Member

    Jun 11, 2003
    I'd use a transformer to drop the AC volts to something that a Pi can accept, and provide isolation. You then have the option of rectifying and smoothing the output, which will give a DC voltage proportional to the peak AC voltage, then you can work out the RMS AC from that, or you can sample the low voltage AC at a high enough rate. For AC current, a current transformer will give you isolation, and you then treat the output signal the same as above. DC volts could probably be done with a voltage divider.
  3. pantner

    pantner Member

    Aug 31, 2004
    Perth, WA
    A quick google shows more than a few people have asked the same question on the official pi forums. Basically the same answer Russellk gave. AC voltage through a transformer, rectify, smooth, divide, ADC (as the Pi doesn't have an analog input) and you will be able to get a reading that will indicate what the voltage is. Obviously you'll have to do some testing to work out the ratio between the input and the reading, but that shouldn't be too hard.

    Then there is the current reading. People are talking about a senor called a "ACS712", again, needs a ADC. Plus all the programming that goes with it.

    What were you planning on writing this in? Do you know any scripting/programming? TBH, it really sounds like something better suited to an Arduino rather than a Pi. That would negate the need for the ADCs, reduce the power consumption, make the coding a lot easier. You can still run LCD displays off an Arduino.

    Why a touch screen? Doesn't it just display values? What does the "touch" give you?
  4. Fred Nurk

    Fred Nurk Member

    Apr 5, 2002
    Cairns QLD
    Pi with libmodbus and a cheap modbus rtu / tcp compliant power meter?
    Even a Pi running CoDeSys, also using a cheap power meter.

Share This Page