AC line zero detection with MCF5213

cancel
Showing results for 
Search instead for 
Did you mean: 

AC line zero detection with MCF5213

3,532 Views
airswit
Contributor III
Hi everyone,

I was wondering if it is possible to use an a/d channel of the mcf5213 as a zero detect circuit for the AC power line. I have seen a schematic for an 8-bit controller using an input port for this purpose, but i don't see how it would be good to expose the i/o line to such high voltage? they used a 1meg resistor from AC+ to the uC pin, and a 1meg resistor from AC- to ground. will this be okay on the MCF5213, and will it give accurate results? I am also using a single supply of +3.3v for my uC system

Thanks in advance for any help!


Trevor
Labels (1)
0 Kudos
3 Replies

78 Views
mjbcswitzerland
Specialist V

Hi Trevor

There are some processors designed to accept high voltages but generally this is very dubious practice and it is best to keep clear of such short cuts.

Use for example an optocoupler (most have 2000...4000V isolation) and keep everything well safe.

If you want to count cycles then the output of a unidirectional optocoupler can be connected directly to a port (or better timer) input with a pull-up to the supply voltage you are using.

Note also that the ADC in the MCF5213 has a zero crossing interrupt function. Although maybe not relevant to your application, it can be programmed to automatically monitor analog input signals and trigger when a signal crosses a 'zero' threshold in either or both 'directions'. The interrupt does however have to be serviced since each time the detection occurs - it needs to be reset to enable the next trigger, but it could be used as an AC line zero detection using a suitable isolation transformer....

Regards

Mark Butcher
www.mjbc.ch

0 Kudos

78 Views
airswit
Contributor III
ya, i was afraid of that. i am using this as a lamp dimmer system, and was hoping that i could do it simpler. I am actually using an AC optocoupler (diodes in reverse parallel on the xmitter), but i am afraid that it isn't giving me very accurate results. I haven't been able to put it on a scope, but i do see some flickering in the lights.
0 Kudos

78 Views
rocco
Senior Contributor II
Hi, Airswit:

A few years back, I did the exact same thing using an AC opto and a series resistor to detect the AC zero-crossing for an X10 receiver.

The problem I had was that the LED of the optocoupler would turn off when the voltage got down around 4 volts (too early), and came on again when it got up to 4 volts again (too late). And the actual voltage (how early or how late) would also vary with the tolerance of the resistor and with temperature.

My solution was to use the Input-Capture (this was an HC05) to latch the time of BOTH falling and rising edges, and then assumed the actual zero crossing was halfway between.

A side benefit was that it could adapt to either 110v or 220v, and either 50hz or 60hz.
0 Kudos