how to control 220 AC lamp with pwn to fade it

hello every one,
i want to fade in & fade out a 220 volt ac lamp
how to td this what is mosfet mubers and how to connect it to arduino ?

i have arduino duemilanove and 6 of 220 ac lamps

thank you

Can you use a relay

Can you use a relay

??? How would a relay be made to have a lamp fade on and fade off? Relays do full on and full off pretty well, but fading, not where I come from.

This type of project is not a easy one. You are trying to control AC. ---> 120 V / 220 V "Dangerous" if you don't know what you doing !!! Relay usage ? NO

The only way I am thinking to control AC with PWN is the principle of a "Light Dimmer" or like a "Temparature Control Soldering Iron" It use a SCR / TRIAC design.

To interface your Ardiuno. Use Opto-coupler !!! To connect an opto-coupler is the same as connect to a LED. ( Check datasheets of opto-coupler )

I think for AC , a "LED / TRIAC" type may work.

It is the other side ( of the opto-coupler - ) you need to worry about. You need a proper design to interface with TRIAC's and 220 V AC.

Again : Not easy with regard to AC Line. Dangerous.


The lighting effects industry use either dmx or 10v to control various 230v devices, and you may have some luck there.
In the meantime there is a cct on this page using a LED to control an LDR in the dimmer cct.
You can detect the zero volts point using an ac power pack and a transistor.
The transistor will conduct as soon as the voltage exceeds about 0.6v, and this fed into the arduino will be a low.

Whatever method you follow, I would suggest that you leave the 230 volts contained in the 230 part, and extend the LED/low voltage wiring only out to your arduino.
ie maximum human isolation.
There is a section of care when constructing…


Use PPM from the servo library to control a servo coupled to the knob of a domestic dimmer.

You would need to ensure that you use a plastic shaft, for isolation...

Good idea, you can get really small steppers they use for aircon units or car mirrors.


What kind of lamp is it? Some kinds of lamps cannot be dimmed, CFLs for example. Halogens can be dimmed, but will probably have a short life if you run them dimmed for extended periods. Ordinary incandescent lamps can be dimmed.
As suggested above, isolate your Arduino from the AC power using an optocoupler and it /should/ work. Let us know how it goes :slight_smile:

hello every one, thank you for this replies,
i have a like halogen christmas light that work on 220

i know relays, but it's only on and off ,
i want to fade it but i know 220 are Dangerous to connect a mosfet to arduino

i know about Opto-coupler but can it fade mosfet? i think it's like relay on and off only

servo it's more hard and i can't find it in stores in my coutry

any help,
thank you in advanced

Look in a doc, page 4 and 5 as an example, for controlling MOSFET by microprocessor.
You need transistor capable to withstand 350/400 V and follow safety rules.

U2102.pdf (321 KB)


Good idea ! Servo or stepper motor.

@ markB

Thanks for the link. ( I will use it ) That solution may work with the help of opter-coupler.

@ ejasoft

Look like you are trying to use the parts you have. I don't know how easy you can get parts in your country ( mail order, local electronics store, hardware store )

Can you salvage some parts ? A home lamp dimmer could be open ( make sure it is off and disconnected ),check datasheet , find a schematic, reversed engineer and located the part you think and can be replace by an opter-coupler just markB sudjested. Or a stepper motor from an old printer for AWOL idea.