Help sensing ac current

Discussion in 'General Electronics Chat' started by JeremyB, Jul 22, 2012.

  1. JeremyB

    Thread Starter New Member

    Jul 22, 2012
    8
    0
    Project Info:
    My goal is to measure AC current across a shunt resistor using a differential input on my microcontroller's ADC. 120VAC mains is passing thru the shunt resistor and also powering the board using a bridge rectifier and a couple voltage regulators to generate DC Voltage and DC Ground.

    The Problem:
    The voltage difference between Neutral and DC Ground is giving me a headache when I simulate because the input to the microcontroller is showing to be only half of a sinusoid, with the bottom half missing. Why is this? And more importantly, is there a way for the microcontroller to see the entire waveform using this scheme?

    Additional Info:
    The attached image probably explains things better than my words. The big arrow points to one of the two differential inputs to the microcontroller and the associated waveform is shown to the right. I am referencing the resistor dividers to DC Ground because that is the reference of the microcontroller.
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,645
    2,344
    Hello,

    measuring directly on the mains is VERY dangerous.
    Better look for an isolated method to measure the current.
    Using a HALL sensor is one of the ways to do this.
    (read the attached PDF).

    Bertus
     
  3. #12

    Expert

    Nov 30, 2010
    16,257
    6,757
    You need to sort out your "grounds". You said, "mains AC" then you used a full wave rectifier to create a different "ground". If that "ground" on the rectifier ever contacts "ref" on the mains, things will smoke. I hope it's a fuse.

    If "ref" is earth potential, you are measuring the high side of the mains with a "ground" that is referenced through the ADC to I don't know.

    Now for nit-picking: AC current across a shunt resistor is worded badly. You are trying to measure the AC voltage across a shunt resistor.

    Get your grounds in order, measure the earth potential side of the mains, and this will work.
     
  4. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,535
    A simple transformer would allow you to measure the AC and isolate the circuits. After all is said and done, you will need calibrate it anyhow.
     
  5. #12

    Expert

    Nov 30, 2010
    16,257
    6,757
    Actually, the Terms of Service for this site demand a transformer. (Smacking Bill on the wrist with a ruler.) Use a transformer to lower the voltage instead of trying to send 170 volts into a regulator chip.
     
  6. MrHam

    New Member

    Jul 20, 2012
    10
    0
    I have a few comments on the measurement method, but I must hold these based on the above post regarding the terms of service.
     
  7. vk6zgo

    Active Member

    Jul 21, 2012
    677
    85
    Use a transformer with its primary between Active & Neutral to operate your power supply.
    This doesn't have to be hardwired,& would be safer just plugged into a domestic power point.
    Instead of your existing series resistor,make a current transformer to take a sample off the Active,then work with that.
    In this way,all of your low voltage circuitry is isolated from the mains,plus your current sensor is not connected to your power supply.

    If in doubt,Google for Current Transformers.
     
  8. JeremyB

    Thread Starter New Member

    Jul 22, 2012
    8
    0
    ALL,
    I am not using current transformers, I am using a shunt resistor. I know the risks involved with non-isolated power but this is a design requirement. I'm not asking for a re-design, I'm asking for help making this non-isolated design work.

    #12,
    "If that "ground" on the rectifier ever contacts "ref" on the mains, things will smoke. I hope it's a fuse."

    I know not to connect Neutral to DC GND.

    "If "ref" is earth potential, you are measuring the high side of the mains with a "ground" that is referenced through the ADC to I don't know."

    The ground reference of the micro's ADC is DC GND. There are only two grounds: Neutral and DC GND. So my question really is: if this isn't the correct approach, what is? I know that if I use a half-wave rectified scheme where the Neutral is the DC GND then this problem goes away but I'm trying to avoid that if I can. Thoughts?

    You also said, "Now for nit-picking: AC current across a shunt resistor is worded badly. You are trying to measure the AC voltage across a shunt resistor."


    Yes I know this and you're right. Thank you for pointing that out.


    Thanks,
    Jeremy
     
  9. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,535
    Just be aware, that if in our opinion a circuit hits a certain level of risk, it is my and my fellow moderators job to close the offending thread. So don't be too cavalier about dismissing our inputs, even if it doesn't seem to apply at first.

    Bertus has already pointed out one technique for isolated current measurement. If you were to research current clamps you would find alternates (though they could also be hall effect related).

    You are not required to go the most dangerous path, this is a design decision. Treat it as such. My strong suggestion is to look for alternate methods that the one you have selected, they do exist.

    It is a engineers job to design safe circuits, as well as ones that work. If this were a transformerless power supply the thread would already be closed and the discussion ended. Since is a step removed you have some slack, but the length is not indefinite.
     
  10. vk6zgo

    Active Member

    Jul 21, 2012
    677
    85
    If your DC earth is connected to the Mains Earth,only one half of your bridge rectifier will operate,as Neutral & Mains Earth are by design,very close (in theory identical ) in voltage.

    Even though you say:"There are only two grounds: Neutral and DC GND.",
    the results from your simulation look like what you would get in the situation referred to above.

    Unless you are going to double insulate this thing,it should have the case returned to Mains Earth for safety,in any case.
     
  11. #12

    Expert

    Nov 30, 2010
    16,257
    6,757
    This isn't going anywhere fast, so I'll try a drawing.
    Will this get you where you want to go?
     
Loading...