I really want to be able to PWM my 220v ac lights. I know I can't do this with the traditional relays, they are not fast enough. I was just thinking if it can be done with solid-state-relays?Many thanks

I really want to be able to PWM my 220v ac lights. I know I can't do this with the traditional relays, they are not fast enough. I was just thinking if it can be done with solid-state-relays?Many thanks

Most SSRs also cannot be used with the arduino analogWrite command as the pwm frequeny is much too fast as most SSRs only switch on or off at AC zero crossings (8.333 msec) and once turned on can't be turned off until the next 8.333 msec AC zero crossing time. You need to look for a SSR that is designed for phase control triggering.

A triac it a device that will conduct when it receives a pulse on its gate.Once it is conducting it will not stop conducting until the voltage and current on it has dropped to a value close to zero.It is what is inside SSRs.To make one dim you have to wait until the AC line is at zero volts. Then you delay for a short time then fire the gate pulse. The triac then conducts until the rest of the half mains cycle. The delay at the start controls the time before coduction and hence the brightness of the lamp.

You can get some forms of SSR with all this built in. It is called phase angle control.

I see. Thank you. I was just thinking, can I use MOSFETs to PWM it? Or can I convert it to DC then MOSFET it? Thanks.

Maybe you should define your needs and then find a solution?

SCR's & Triacs behave differently. Triacs are bidirectional! (so we can have higher resolution and less flicker)

We know the frequency of the AC being about 50/60Hhz depending where you are.

So we know the time between 1/2 cycles

We also know that if we apply a tiny gate voltage pulse the device starts to conduct, and will continue until the voltage across it's main terminals is zero. (zero crossing point - Mains is AC and the voltage will pass through a minimal voltage during each half cycle)

Thus by adjusting the time of the pulse relative to 0V crossing (after 0V occurred) we can vary how much of the (half) cycle that the Triac conducts. The further from the zero crossing detection, the shorter the conduction time (to the next zero crossing), so the less average voltage appears across our lamp.

Isolation from the mains is important so we are talking transformers, or optically isolated devices, hence opto zero-voltage detectors and opto-isolated diacs (diac NOT triac)

So, basically your code will be

read zero crossing devicedelay for Tbrightnes (in uS to give you lots of resolution)output high to diacdelay for XuSeconds (see data sheets)output low to diacrepeat

True but no one mentioned SCRs until you did.We were talking about SSRs.You can get SSR that accept a 0 to 10V signal and do all the phase stuff for you. You get that by putting the PWM output to a transistor connected to 10 or 12 V and then smoothing the resultant signal before feeding it into the phase controlled SSR.Do not play about with doing it yourself in the controller.

The term Solid State Relay covers several semi-conductor devices that are used to switch a load electronically, thus a Triac, SCR, Thyristor, etc. even MOSFETS can be described as SSR. Indeed, I suppose that you could extend that to any transistor or any 'black box' that replaces a mechanical relay.

Buying an off the shelf device is a valid method (I've not tried it, but I would think that hitting it with a 590Hz PWM would be a bit hit and miss without tying it to the mains frequency, but then that depends whether it has additional circuitry to manage this). Using a Diac removes the need for other power supply.

I would imagine that since arduinohabib is on a microprocessor forum, and hasn't opted for a light dimmer from his local electrical factors, he is looking to learn how to do it himself. That is why I suggested a method that he can research and try, thus expanding his understanding of AC voltages, switching devices, timing etc. He can of course pick and choose the method to follow. It's all fun, and many have us have already been there many times over.

One lesson for him to learn, is to understand exactly what he wants to achieve, what the bounds are and then to explore ways of accomplishing this.

As an aside, arduinohabib, one might consider using an SSR with a mechanical relay (not in a dimming, but in a pure switching mode of course). The advantage of this is that the load begins to switch at zero volts and the SSR need only be quite small as the mechanical relay is in parallel and will take the full load within a cycle or two (relays tend to take about 20ms to pull in), and the relay suffers little or no arcing across the contacts, reducing pitting and extending life. (switching off gracefully is a little more complicated)

The term Solid State Relay covers several semi-conductor devices that are used to switch a load electronically, thus a Triac, SCR, Thyristor, etc. even MOSFETS can be described as SSR.

No it is not.The term Solid State Relay covers ready built modules that could consist of anything, however generally they have opto isolation and full wave control. They may or may not incorporate phase control circuits. Some even work with DC and are in effect FETs. But they are all modules not discrete components.

Quote

but I would think that hitting it with a 590Hz PWM would be a bit hit and miss without tying it to the mains frequency, but then that depends whether it has additional circuitry to manage this

Yes feeding raw PWM into a SSR is not going to work. No one said it would. I was suggesting filtering the PWM to give smooth DC to feed into phase controlled SSRs. If you misunderstood what I said then please re read it.

Quote

I would imagine that since arduinohabib is on a microprocessor forum, and hasn't opted for a light dimmer from his local electrical factors, he is looking to learn how to do it himself.

When you have a bit of experience with this forum you will know that most beginners just want a solution. If the know about a soloution but want to do it themselves they generally say so.As he says:-

Quote

I really want to be able to PWM my 220v ac lights.

He is not very up on the theory of these things, which is fine but is a good indicator of the answer he needs.

No sure I'd like to learn the theorys--I don't want you to tell me just how to do it. Of course I want to know how it works, and I am willing to experiment and experience failure. Thanks.PS @lizhenan I think I want to do it myself. Do you live in China?