Sensing low voltage AC
I have an application where I need to sense a low (18v) AC voltage. I built an interface using an AC optocoupler, which works well.
However, someone suggested to me that I could just feed the AC voltage directly to an input pin, using an appropriate resistor. This appears to be what's done in this Microchip application note:
ww1.microchip.com/downloads/en/AppNotes/00521c.pdf
What puzzles me is how the "ground" of the circuit is completed. In the simple input circuits I am familiar with (like a switch), the circuit and the Stamp are both tied to Vss. In a circuit like the one shown in the application note, there is simply a connection from the hot side of the line voltage to the input pin and no indication of a common ground.
However, someone suggested to me that I could just feed the AC voltage directly to an input pin, using an appropriate resistor. This appears to be what's done in this Microchip application note:
ww1.microchip.com/downloads/en/AppNotes/00521c.pdf
What puzzles me is how the "ground" of the circuit is completed. In the simple input circuits I am familiar with (like a switch), the circuit and the Stamp are both tied to Vss. In a circuit like the one shown in the application note, there is simply a connection from the hot side of the line voltage to the input pin and no indication of a common ground.
Comments
In your case, the low AC voltage is probably provided by a transformer and is not ground referenced. Your optocoupler is the best way to handle it.
From a safety standpoint, you wouldn't want to connect the AC ground side to Vss unless the whole circuit is directly powered by the AC line and appropriately insulated.
The issue of what is "ground" on the other side of the transformer has always puzzled me. Your explanation that the example circuit would be powered by the AC line makes sense. But don't the majority of DC power supplies (e.g., a wall wart) use a transformer as well? It seems to me that your typical microcontroller power supply would then be just as isolated from earth ground as the AC coming out of my transformer.
One effect of my confusion is that I have never been sure if it is safe to measure low voltage AC with my USB oscilloscope if the laptop is plugged in. I read a lot of dire warnings about such things, but if the laptop is also powered by a transformer then what is the danger since neither are directly connected to the AC power line? But if they are both isolated how can the oscilloscope read the voltage between the transformer posts?
To be safe I only measure the low voltage AC when running on battery power but I have never really understood if this is necsesary or not.
Addendum: I came across another AC line interface circuit in the following application note. Here the AC ground is shown tied, across a 1 M resistor, to the microcontroller's circuit ground.
www.atmel.com/dyn/resources/prod_documents/DOC2508.PDF
Post Edited (Professor Chaos) : 12/31/2008 12:27:59 AM GMT
I acquired an emergency light that I hacked into for the 12volt gel cell trickle charger and it was such a system. Thinking that it was merely 12volts, I figured it was safe. But, I found out that touching one lead while barefoot on a tile floor was quite unpleasant.
One can always use a rectifier to convert pulsed AC to pulsed DC for an input into a microprocessor. I'm bit unclear as to why Microchip is merely using a 5M resistor and relying on the internal protection of the microprocessor. What would a spike or lightning strike on the power line do to the unit?
Just always consider whether the AC source is from your AC mains or an isolated supply. O-scopes used to require some education about electrical safety and proper isolation. T.V. repair shops had a handy isolation transformer for dubious cases. It is a bit complex when you use a USB scope as there are indeed multiple options of how to power it up.
Complete isolation is much better than grounding. Grounding as a safety feature is really there to provide an immediate short circuit mostly for fire protection by blowing fuses -- not human protection. In some cases, people have been electrocuted by using an ESD bracelet because the ground provided the necessary completion of a circuit when they were probing 120ac.
So, most of my bench work with done with an 8Volt 9AH gel cell and a 7805 regulator. Isolating the device under test might be more reliable than guessing about the power being fed to the USB scope. Having that as a consistent proceedure might help. And battery power doesn't insert any additional noise into a circuit under test. Switching supplies and AC supplies may easily do so.
When in doubt, eliminate any and all unnecessary AC power from your workbench.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
How do you like my name change?
aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
Post Edited (Loopy Byteloose) : 1/1/2009 12:32:09 PM GMT
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle