Zero-Cross detector Circuit...will this give me the IRQ I need for phase control - Page 1
Forum section: electronics / projects

author: SuzyC
author_rank: Frequent Contributor
timestamp: February 08, 2014, 09:32:13 am
content: I am trying to do phase control for a Universal Motor for my sewing machine since my foot pedal quit. I will be using a MCU so I made up this circuit for detecting the zero-cross of the mains..Will it work? I don't have Spice.

author: DmitryL
author_rank: Regular Contributor
timestamp: February 08, 2014, 11:49:42 am
content: Quote from: SuzyC on February 08, 2014, 09:32:13 amTry this:http://www.dextrel.net/diyzerocrosser.htmBTW, Does it really need to be optically-isolated ? If not, it can be done much simpler way, just a couple or resistorsGoogle for "microcontroller triac dimmer"

author: Psi
author_rank: Super Contributor
timestamp: February 08, 2014, 12:03:25 pm
content: yep, for AVRs you just need two 1Mhttp://dangerousprototypes.com/2012/12/23/app-note-zero-cross-detector-for-avrs/However, doing it with an opto will always be safer.The two resistor method relies on the i/o protection diodes which i believe are a bit more robust in AVRs than other micros, so the same technique may not work on all micros and definitely wont work on micros with no protection diodes at all.Also its a good idea to use two ~500K in series instead of a single 1M, just in case one resistors shorts or a low ohm resistor is accidentally installed.

author: SuzyC
author_rank: Frequent Contributor
timestamp: February 08, 2014, 03:15:30 pm
content: Thanks to Dimitryl and Psi for trying to help, but the processor is a PICC and the data sheet says that the input pin must not exceed Vcc+.3 or Vss-.3V. Tried your circuit with just a light bulb and the triggering point went crazy and the analog input pins give erratic readings and I have trouble resetting the MCU. Also this sounds dangerous to have the 240VAC to be sitting on my breadboard. Also your simple circuit now changes from erratic to working different erratic triggering when I touch the ground or any point on the breadboard.I want to build this MCU controller zero crosser/speed control on a small PCB as small as possible and put the PCB into the old foot switch and use an optocoupler for speed input, have speed control by mechanical link to the foot pedal position and want to sense the speed getting a tach feedback from the motor drive somewhere.But first I need to get stable, reliable IRQ's of zero-cross.But it has to be safe! No electric shock tickles for me while I am sewing.

author: dannyf
author_rank: Super Contributor
timestamp: February 08, 2014, 03:24:03 pm
content: QuoteMaybe it is better if you used a proven design.QuoteThat circuit works by utilizing the clamping diodes, which with a few exceptions, your PIC has as well. So it should work. If it didn't for you, the issue is somewhere else.The ground, however, is floating in that design.

author: dannyf
author_rank: Super Contributor
timestamp: February 08, 2014, 03:24:48 pm
content: An easier approach would be to use an optocoupler.

author: SuzyC
author_rank: Frequent Contributor
timestamp: February 08, 2014, 03:48:50 pm
content: Dimetryl,BTW I looked at the ootoiosolated version, circuit looks suspicious because the constructed model shown does not match the circuit or the circuit in the background of the picture and seems to have a large umteen-pin MCU on the right.I might not be an engineer but it seems to me that this circuit always reverse biases the 2N3904 transistor???Can anyone explain to me how this could work?To quote:"This DIY project presents one very clever variety of such a zero crossing detector, invented bythea utho odernelectronic equipment are nowadays typically powered by switch­-mode power supplies."What??

author: SuzyC
author_rank: Frequent Contributor
timestamp: February 08, 2014, 04:13:54 pm
content: Not that I need to re-invent the wheel on my sewing machine, but I wanted to know what anyone could find wrong with my circuit or if an insight could reveal a fault in my design.I Googledthea utho odern electronic equipmentbut this name appears to be pure panty lint.

author: Codemonkey
author_rank: Regular Contributor
timestamp: February 08, 2014, 04:42:06 pm
content: For what its worth, the circuit posted by DmitryL herehttp://www.dextrel.net/diyzerocrosser.htmdoes work fine. I built it a while ago and it performed exactly as it should. I also simulated it in LTspice (which is free by the way, search for it) beforehand and that also confirmed its correct operation.That "umpteen pin MCU" is the 4N35 opto transistor.

author: Codemonkey
author_rank: Regular Contributor
timestamp: February 08, 2014, 04:45:24 pm
content: Also, it doesn't take a rocket scientist to figure out that "invented by the autho odern electronic equipment" should in fact read "invented by the author, modern electronic equipment".

author: SuzyC
author_rank: Frequent Contributor
timestamp: February 08, 2014, 07:42:20 pm
content: Found out by building my circuit and testing it with a small transformer for safety that my Zero Crossing Circuit does work fine.EDN had several variations of the same theme that was presented by Dimetryl here that are quite interesting, simpler than mine, and one even saves a little power(attached file). I am grateful to know about EDN's treasure trove of circuits.Now I understand: the discharge of the electrolytic capacitor through the 22K resistor forward biases the 2N3906 during the zero-cross period and yields an output pulse through the optocoupler and so now I know how the circuit of Dimetryl works.I thought I was a rocket scientist. However, I can see these other circuits presented give a wider pulse at zero cross than mine, so they are somewhat less accurate a zero cross detector?Thanks to all!

author: DmitryL
author_rank: Regular Contributor
timestamp: February 08, 2014, 10:19:20 pm
content: Quote from: SuzyC on February 08, 2014, 03:15:30 pmThe controller type doesn't matter here. If unsure, add a couple of protective diodes to the input. Here is a schematics of my PIC-based dimmer, there are a lot of similar circuits everywhere. Works for many years. Yes, it is not isolated from the mains.

author: dannyf
author_rank: Super Contributor
timestamp: February 08, 2014, 10:22:02 pm
content: QuoteIt is up to you to decide how "tight" you want to make the zero-cross windows to be.The first zero crossing circuit is widely quoted. I use a similar version of it, but with a pnp - it can be made with a npn as well.

author: sacherjj
author_rank: Frequent Contributor
timestamp: February 09, 2014, 01:16:26 am
content: I've been working with an "AC" optoisolator for a voltage detect and switching board. That is basically an LED each direction. All that is needed in the high power side of the circuit is limiting the 120V or 220V to LED current (I believe I used somewhere around 90K for 120V in a pair of 0805 1/4W).If there is power you get pulses with a high duty cycle. The off time is at the zero crossing, twice a cycle, when the low voltage at the crossing can't drive either LED.