Mains zero crossing detector

I am looking for a dip package zero voltage crossing switch for 240vac 50hz. I am making an analog phase control circuit using 24vdc.
I have seen one online solution which is a complicated arrangement of resistors, transistors and capacitors which could be incorporated on a single IC. Using that solution requires too much board space. That is why there must be somewhere a single IC to do the zero crossing detection.
I have made my own zero crossing circuit for digital control with a MCU. This has given me excellent phase control. The zero crossing pulse is very narrow at .076ms. This is ok for MCU control as no capacitor needs to be discharged. However for an analog circuit that pulse is too short to discharge a capacitor.
To sum up a preferable part would give a pulse width of .5ms or less. The above referred to complicated circuit gives a pulse length of 1ms. This is too long when you consider that at 50hz a half cycle of the mains is only 10ms.

Hey Peter,

As a general rule we don’t advise anyone on anything to do with Mains Power as it can be extremely dangerous to work with. We generally suggest that you get some advice from a licensed electrician who may be able to help with things like this.

Hopefully someone can suggest a suitable item that can be installed by an electrician so that you can get this project underway.


1 Like

Hi Peter
For a start Heed Blayden’s advice.
Secondly usually an IC cannot switch 240VAC mains directly. Any circuit will have to drive a secondary switch.

Most SSRs (Solid State Relay) commonly available are zero crossing switch devices with a 3VDC to 30VDC control voltage.

lots of choices here

lots more alternatives if you leave out the “ic” on the end and just google “zero crossing detector”.

If you simply want to switch 240V at zero V crossing then I think the easiest way to go would be the SSR. Be aware though that if you use a SSR and the load is only light like a few mA this device probably will not appear to turn off. The “contacts” will open but mostly there is a snubber circuit consisting of a resistor and capacitor in series across the “contacts” and there is enough leakage here to operate a light load once the SSR has been turned ON for the first time.
Cheers Bob


Thanks for that Bob. I have a SSR and I see that it must have a zero crossing detector to get the full mains output. I also have phase controllers from China. A 3000w and 6000w. The input is the mains and by turning a knob you can phase control at the output.
I have gone a step further with my MCU solution. I have a temperature sensor which varies the setting of the phase output. Suppose you have a heater at the output and you want a temp of 20c. Then you set 20c and at the ambient of 20c you have full power. This gradually reduces using phase control so at 21c the power is off. The result is you always have a comfortable temp between 20-21c or whatever temp you have set.
The MCU solution works great. However I would also like to have an analog solution . So far no luck as my zero crossing pulse at .076ms long is too short to discharge a ramp capacitor. I am looking at the possibility of using a cb,ce or cc transistor configuration to increase the pulse length. Do you think this is possible?

1 Like

Hi Peter

Doesn’t quite work like that. The zero crossing is so the load starts up with zero volts applied and does not get a sudden shock when say full peak volts appears suddenly. Makes for a smoother quieter switch.

That is a long time in some circles.

Look at the LM (or NE or whatever) 555. Very versatile timer. There are literally hundreds of applications and various ways to use this IC. I am sure there will be a pulse extender somewhere. Will probably only need 3 or 4 external components. Down side is the max voltage is 12 - 15V but there are other timers around similar which might work at your 24V.

A really good publication is IC Timer Cookbook by Walter G Jung. It is pretty old but still very relevant and worth while if you can get a copy at the right price, or borrow it.

Here is an example of a simple circuit which will do what you want copied out of that book. Might promote some ideas.

Disregard that bit of circuit connected to enable pin 4. Normally connected to VCC pin 8 for most applications (yours included).
Cheers Bob
Add On: The description and text for the above circuit.

This circuit requires a negative going trigger. That is the trigger has to go below 1/3 V+. Both outputs are positive going during the timing cycle.
There is an arrangement that can reverse this. Positive going trigger (>2/3 V+) and outputs going to ground during timing cycle.

1 Like

Thanks for the advice Blayden. I always am very cautious with mains power. Your average electrician knows nothing about integrated circuits. If something goes wrong with a controlling unit he would replace the whole unit. He would not be able to fix it internally.

Thanks for that Robert. I am very familiar with the 555. The first IC I played with going into electronics. That may very well work. I can input my very short zero crossing pulse and then at the output make a longer pulse attached to a transistor in switching mode. This longer pulse connected to the transistor base can be made long enough to discharge the capacitor. I can change my 24v to a lower voltage for my circuit to still work.
I can check this with Ltspice. I love working with that excellent simulation program. Makes designing electronic circuits easier. Although you must always remember that the models are not always exact replicas of real parts. They tend to be idealised parts.

Hi Peter

That is a big plus. You are probably also familiar with the publication the above info comes from.
The following section in that publication (4.2) deals with “inverted” operation. Positive going trigger.
Let us know the outcome
Cheers Bob

I believe I have seen that bit about inverted operation before. This is important because my zero crossing gives a positive going spike.

I will let you know the outcome Bob.

Hi Peter

I got the impression it did. That is why I mentioned inverted operation.
Be aware the whole thing is inverted. The output will be LOW when timing out.
The second output (Discharge pin 7) also goes low and being open collector could be possibly used to discharge your capacitor (via an appropriate current limiting resistor). Don’t know what size this cap is but could be worth considering. Saves some bits. and I think will sink about 150mA or more.
Cheers Bob

Hi Robert, My 555 reference book is’ operational amplifiers and integrate circuits’ by F.Driscoll. This has a whole chapter on the 555.
An example is given of a monostable with timing of R=10k and C=.2uf. The capacitor is connected directly to the discharge terminal. On simulating this with ltspice the discharge current of the capacitor is 547ma.
I cannot find anywhere if there is a maximum discharge current. But this seems pretty large. Presumably though the author has tested the circuit before publication. I have searched for data on a maximum discharge current of a 555 as have many others and cannot find anything.
Do you have anything on this in your 555 cookbook?

Hi Peter
Over the past couple of weeks I too have searched the data sheets but like you I could not find a collector current figure.

However my cook book has a detailed description of each pin. The reference to pin 7 (discharge) follows

The last paragraph is the one of interest.

The spice model in your simulator therefore comes under question as it should have been aware of this surely. I can’t simulate at the moment as my Windows machine is not playing the game. I used to use Tina but they don’t have a Mac version and these days I can’t justify the cost of the cloud version.

If you are using this as a current sink for an external load like a relay you should work on about 150mA but if it is OK to discharge a timing capacitor it should be OK to discharge yours. This discharge is usually pretty short and will drop to about 37% in one time constant. The resistor element in the Cap discharge situation would be the ON resistance of the transistor so the time constant would be very short.
Cheers Bob
By the way. While my book deals with other timers as well (I believe no longer available) you can get publications where the whole book is dedicated to 555.

Hi Bob, Yes the spice model is probably wrong. “the maximum collector current is internally limited”. This would prevent overload. The capacitor discharge probably happens over a period which is very short that does not effect the overall timing.

Hi Peter

I could be wrong here and jumped the gun a bit. With the transistor fully ON the internal resistance is the governing factor and the spice model could be correct. The value and thus the stored energy of the capacitor would have some influence on current I would think.

Without knowing a lot more about the transistor and being able to calculate the current at any instance in time I tend to believe the people on a higher pay scale and go with what is published or in this case simulated. I believe that in most cases figures of this nature are proven by experiment at some stage.

I found a little (really little) bit of info in the National Semiconductor 555 data sheet.with a couple of graphs.

And note 7
Note 7: No protection against excessive pin 7 current is necessary providing the package dissipation rating will not be exceeded.

Which agrees with the note in my Cook Book.

When you think about it the publication of definitive figures for this could be difficult given the vast difference in individual operating conditions.
Cheers Bob