How to control a lamps intensity

I realize this is an old topic but I will just give my input as others might be working on a similar project.
Asuming you have a dimmable lamp (not all lamps are dimmable) i Think the easiest way would be to use an electronic dimmer where you control the dimmer with your digital output. Keep in mind that most dimmers require a minimum load to work correctly. Connecting a lower load might couse your lamp to flicker and reduce lifespend.

Say your dimmer requires a minimum load of 40W to work correctly and you have a 10W dimmable CFL, you would need to connect 4 lamps to reach your minimum load.

Basically you could probably send the direct PWM signal to a traic and it should work ok.

Basically you could probably send the direct PWM signal to a traic and it should work ok.

That may not work directly controling a traic < --- proper rated , with a traic opto-coupler, yes, much better. the digital output control the led of the opto, and the triac reacting and controling the bigger triac. Now, that may work. And dealing with main voltage, safety is a must.

Techone:

Basically you could probably send the direct PWM signal to a traic and it should work ok.

That may not work directly controling a traic < --- proper rated , with a traic opto-coupler, yes, much better. the digital output control the led of the opto, and the triac reacting and controling the bigger triac. Now, that may work. And dealing with main voltage, safety is a must.

I oversimplified it. Hooking up a TTL IC to a triac directly will probably make the magic smoke come out.
You should always use proper isolation like an optoisolator or magnetic isolator when dealing with high voltages.

I will do an experiment this week-end using a opto and triac. I will use a 12 V AC source to control a light bulb and see what happen <--- that could be breadboard. And I will construct a test rig for the AC main test.

Techone:
I will do an experiment this week-end using a opto and triac. I will use a 12 V AC source to control a light bulb and see what happen <--- that could be breadboard. And I will construct a test rig for the AC main test.

I have some people use peak detection and complex logic to implement dimming.
I really do not see why. Personally I have not tested it but in theory, chopping the 60 or 50hz at "random" points in the wave with hardware PWM shouldn't make too much difference since it will still average out the same. Light bulbs are fairly effective low pass filters.

I did the experiment. I use a 12 V AC in with a 12 V light bulb. I included picture of my setup and a schematic. No 120 V AC test yet. I need to change the value of R2 to control the curent going into the Triac gate. My setup is about 6 mA to the gate using 1 K.
The limiting resistor of 330 is the LED side of the optocoupler.

First, I did the "blink" test. Pass and it is flashing. But I did the PWM test, and I did not see a difference at all. Because, when the light bulb is on and going off, a next pulse will turn on and so fourth. A led can switch on / off fast, but not a light bulb, it is just too slow to responce an PWM signal. So to my eyes, it seem ON. A slow pulse will blink it.

So, the light bulb need to see a voltage reduction for a dimming effect to work. Therefore, a different circuit is needed for a dimming to work.

ACcontrol.jpg

Techone:
I did the experiment. I use a 12 V AC in with a 12 V light bulb. I included picture of my setup and a schematic. No 120 V AC test yet. I need to change the value of R2 to control the curent going into the Triac gate. My setup is about 6 mA to the gate using 1 K.
The limiting resistor of 330 is the LED side of the optocoupler.

First, I did the "blink" test. Pass and it is flashing. But I did the PWM test, and I did not see a difference at all. Because, when the light bulb is on and going off, a next pulse will turn on and so fourth. A led can switch on / off fast, but not a light bulb, it is just too slow to responce an PWM signal. So to my eyes, it seem ON. A slow pulse will blink it.

So, the light bulb need to see a voltage reduction for a dimming effect to work. Therefore, a different circuit is needed for a dimming to work.

Even with PWM values down to like 1??
I find this very surprising.
Using a similar but 6v version of the same bulb on DC, it dims just fine with PWM.
If the duty cycle is significantly reduced, I find it hard to believe that the filament will reach and maintain full temperature.
I would guess maybe the triac is not behaving how you expect it to. Do you have a scope to test it with?

To control AC lamp intensity using arduino outputs and thyristors is more complex then it may first appear. First you need a AC zero crossing detector so that the Arduino knows the proper time to start waiting until firing of the triac device, zero delay would equal full brightness, 8.333 millisecond delay would give 0% brightness. Triacs are just back to back SCRs and you can only control when they start conduction, as once fired only at zero crossing will the device turn off and be avalible for the next trigger command. As the built in arduino PWM analogWrite() command has no built in way to synchronize with an external AC zero crossing detector signal, one really has to roll their own PWM like function. Also one should use a optoisolator between the ardino output pin and the triac gate circuit.

Lefty

The thing I didn't realize is that a triac is an SCR.
I wonder if it is possible to have a PNP and a NPN transistor in parallel E <-> E and C <-> C each with a diode facing the opposet direction in series with it
And using two opto-isolators, driving the base with the polarity of the other line.
I have posted a schematic for a device that may theoretically work but it is completely untested.
Resistors omitted for simplicity but obviously necessary. This should allow for instantaneous switching almost irregardless of the AC wave phase.
oops, forgot to attach.
I actually tested it on LTSpice circuit simulator and it seems to work great.
I just do not have two opto-isolators to test it.
Basically it applies the base current through the opto-isolators. This resolves the polarity difference of the base current.

acsw.jpg

Let re-cap here.

A dimmer work by reducing the voltage at the load. It "cut" the AC sine wave, to created a lower voltage effect.

So you need a circuit at the AC side to convert the PWM pulse into a partial cut AC sine wave.

I included a diagram what I am talking about.

Techone:
Let re-cap here.

A dimmer work by reducing the voltage at the load. It "cut" the AC sine wave, to created a lower voltage effect.

So you need a circuit at the AC side to convert the PWM pulse into a partial cut AC sine wave.

I included a diagram what I am talking about.

A light bulb is mostly a resistive device so that all that matters is average power.
It does not care much what the sine wave looks like. If you make "chops" out of the AC wave with a PWM signal, then the bulb will heat less proportionally. If you tried the same test circuit with a mosfet instead of a triac and DC instead of AC, I am willing to bet that it would dim exactly as you would want it to. The reason your test circuit did not work is because the triac does not stop conduction instantaneously.

I respect your opinion.

You have to agree with me with this : A light bulb don't react quickly.

My experiment raison is : if it work on a small scale --> 12 V ac, than I simply modify the circuit to control 120 V AC main. I know a simple ON / OFF will work. <-- The "blink" code. As long I change the resistor value going to the Triac gate to acoomodate for the higher voltage.

The point on this tread is to control AC main going into a light bulb and doing it safely. Let work on this. I will try it at my end.

The point on this tread is to control AC main going into a light bulb and doing it safely. Let work on this. I will try it at my end.

Again you will need to include a zero crossing detector for any chance of success when using thyristor class devices (triac/scr). They are switch devices and require proper gate trigger timing relative to the AC waveform.

@retrolefty

Again you will need to include a zero crossing detector for any chance of success when using thyristor class devices (triac/scr). They are switch devices and require proper gate trigger timing relative to the AC waveform

Thanks for the tips. I will look into that. And experiments with a lower AC voltage like 12 V from the secondary of a transformer.
And I agree with you.

Techone:
You have to agree with me with this : A light bulb don't react quickly.

The reaction time does not matter if the average power is reduced.
I certainly do not suggest testing it with full AC line voltage. Testing it will full AC line voltage should only be done if the small scale is working good. Using the circuit I posted should work to PWM the AC wave instead of a triac. Unfortunately I do not have the parts to test it. The LTSpice simulation works good though.
I know that electronics simulations are hit and miss but I have attached the waveforms.
The first shows the input, output, and about 40% PWM duty signal. As you can see, the average power is reduced.
The second shows it with a constant input signal passing the AC near as-is.
RED is 60hz 4v input
GREEN is the ~1.5v control signal
BLUE is the output

OK... I do have parts here for the breadboard test. And I do have a scope. And I have a sim call Circuit Wizard. I will try it on that too.

Your schematic is not too clear. A redraw of the schematic will help me out. Did you have a BOM ? Parts lists ?

I hope the sim did not use the same ground.

I will tested it with a 12 V AC and use the Arduino for the PWM and see what happen.

Techone:
Your schematic is not too clear. A redraw of the schematic will help me out. Did you have a BOM ? Parts lists ?

I attached another schematic. Its alittle better but still alittle unclear.
I do not have a BOM or parts list because the resistors, transistors and opto-isolators all depend on how much voltage and current you run through it.

I hope the sim did not use the same ground.

It did but thats to satisfy a silly simulator requirement.

I will tested it with a 12 V AC and use the Arduino for the PWM and see what happen.

Good luck and be-careful. Using AC around an Arduino even at low voltage can be a disaster if you are not careful.
Note: I may have drawn the opto-isolators backwards.
Note2: R1, R4 are relatively high value and R2 and R3 were relatively low value.

FYI, in this tread, I post two link. It a "How a dimmer switch work" The OP did post a schematic - link . The Arduino is being use to act like a controller and to sync the PWM pulse with the AC wave and act like a dimmer switch waveform according to my understanding of the working of a dimmer switch. The only thing you have to do : Select the proper parts, and code it right.

BTW, I don't like the AC sensing circuit, I prefer the telephone ring detector circuit design.