Full AC Light Dimmer Angle Control Tutorial

Warning this circuit showcased in this video uses mains voltage. Mishandling of such a high voltage can lead to fatal injuries. Replicate the circuit at your own risk. A while ago a friend of mine gave me this LED light bulb which emits quite an interesting to look at screen lights and he asked me whether I could create a circuits to dim brightness. And since the packaging of the LED bulb stated that it is dimmable.

I said: – Yes, that should be possible. What I didn’t expect though Was that dimming AC LED lights can be a very confusing and complicated topic But let’s postpone this problem for now. Instead let’s start with analyzing how common AC dimmer works and how we can easily create our own. Improved version by coming up with a custom PCB design controlled by a small ATtiny microcontroller. So that at the end of this DIY or Buy episode we can determine whether it makes sense to create a DIY AC light dimmer. Or whether we should stick to the commercial solutions instead.

Let’s get started! * Intro music * This video is sponsored by JLCPCB whose new full automatic PCB batch production factory is being used since April They produce 600,000 square meter of PCBs per month and you can get your own 2 layer prototype PCB for as low as two dollars. The AC dimmer I got online was a pretty generic one. That uses Phasenanschnitt in German or face anger control in English.

To dimmer, 3 to 35 watt LEDs and 7 to 110 watt halogen lamps. So I hooked it up to mains voltage and in E27 sockets according to the wiring diagram offers instruction manual. As the first simple test subject, I will be using this 42 watts halogen light bulb. After securing it inside the sockets. It was a breeze to dim the brightness of its the main potentiometer of the dimmer. But let’s think a bit deeper by removing a couple of screws and lifting up the dimmer slits in order to have a closer look at the circuits.

I have to say that these circuits is a lot simpler than what I anticipated and the solder quality is certainly not the best. But I guess this is what you get at a price point of twenty four euro. If we reduce the component counts to only the mandatory bonds, then the schematic for the circuits would look something like this.

With a resistor, potentiometer, capacitor, DIAC and TRIAC. To understand how it works, let’s imagine, we got our AC sine wave voltage applied after the zero crossing point the voltage slowly increases Which charges up the capacitor through the resistor and potentiometer? The capacitor voltage increases up to value of, for example, 32 volts — which is the break over voltage of our DIAC.

At this voltage the DIAC becomes conductive and thus the capacitor discharges through its and through the gate of the TRIAC Which turns it on and thus lets current flow through the light bulb for the remainder of this half wave As soon as the next zero crossing point comes however the TRIAC turns off.

Since the current value fell beneath the holding current. But feel free to watch my basics video about TRIAC’s to understand they’re working behavior better. anyway, for the next reversed polarity half wave, the process almost tastes the same and thus only part of the half wave gets once again applied to the light bulb Now by increasing the resistance of the potentiometer, the charge up time of the capacitor increases and thus the ignition point of the track gets delayed.

Which means less average voltage less current and thus less brightness for the light bulb Now, of course, the commercial dimmer got a couple more components. Two, for example: suppressed noise and voltage spikes. But, in a nutshell, this is how such an analog face anger control dimmer functions. And after hooking up these circuits to the oscilloscope. We can see that the waveform of the mains voltage applied to our light bulb, pretty much looks like the theory we just talked about.

Awesome! For such a halogen light bulb which can be modeled as a resistor such dimmer circuit is definitely suitable But for an LED light bulb which comes with capacitors inductors and LED drivers such circuits is oftentimes not suitable. Because the current path goes through the light bulb and thus and more complex loads can lead to the malfunction of the analog dimmer.

That is why from our own design I wanted to teach this old analog light bulb serious concepts and instead go the digital way here with this SMD ATtiny 85 microcontroller. First off, I needed a potentiometer to set the desired phase angle of the AC voltage The other mandatory input for the microcontroller needs to get connected to phototransistor Optocoupler like it’s shown here.

When the mains voltage is high enough the LEDs inside the optocoupler get powered properly and thus connect the input of the microcontroller on to ground But as soon as the mains voltage reaches its zero crossing point, the voltage is too low to power the LEDs The transistor turns off and thus the microcontroller inputs connects to five volts through its internal pull-up resistor This way we have a zero crossing point indicator From whose occurrence we can use the timer to delay the ignition of the track according to the set potentiometer value and thus get our desired phase angle.

And speaking of ignition for that I use an output of the microcontroller hooked up to an optocoupler track driver and finally a TRIAC like it shown here. As soon as the ignition point is reached the microcontroller lights up the LED for small inputs time which activates the first TRIAC and thus also the second TRIAC. And just like that, we should be able to create a digital microcontroller dimmer.

But what I forgot was how to supply five volts power for the circuits Well, initially, I wanted to use a capacitive dropper circuits — which I showed you how to build in a previous video. But then I realized that there’s a risk of having a voltage potential of 230 volts across the potentiometer to earth. And thus I decided that this was not the best idea. Instead I got myself this pretty small Hi-Link five volts mains power supply.

That can deliver more than enough current for our circuits. So what I did next was searching for suitable SMD components. And then calculating the complimentary passive components for them according to the datasheet specifications. This resulted in this a bit confusing to look at hand-drawn schematic which through the help of easy EDA. I turned into a more pleasant to look at schematic to which I also edit an ISP-header to later easily program the microcontroller.

So next I clicked the converter PCB button installed arranging the components in a logical order After then connecting the components with copper traces Adding the outline of the boards and creating a ground copper layer on the top and bottom sites I think the PCB did not look half bad. So I clicked the generate Gerber files button and ordered my PCB from JLCPCB for only two dollars — plus shipping, of course.

After not even a week. I did not only receive my PCBs which looked even better in real life than on a computer screen but also all of the SMD components. And through the help of a lot of flux. I’ll find soldering tip as well as thin soda I added all of the SMD components to the PCB in less than an hour After then also soldering in all of the THT components this circuit was finally completes. And only came with one minor package size problem To program the microcontroller, I connected the ISP-header to on Arduino Uno according to pretty much any Arduino Uno ISP programmer tutorial ever and started writing the code for the ATtiny.

Now, I will not go through the code line by line and explain it. Since I commented the function of each line in the final codes. And I already told you the functional concepts of a microcontroller dimmer a couple of minutes ago. But if you’re still confused then make sure to watch my Arduino 101, 102, 103 and microcontroller timer videos. Nevertheless though, the code is pretty simple and easily customizable which is always a plus point when it comes to microcontroller designs.

And after burning the bootloader to the ATtiny and uploading the codes it was time to connect the mains voltage wires For which I also added a fuse in series for safety reasons And luckily after powering the circuits nothing exploded. That is why I added the E27 socket with halogen light bulb to the circuits in a very unsafe way.

And tested whether I could dim its brightness which was certainly possible And after connecting the voltage of the light bulb to the oscilloscope we can see that the waveform is pretty much what we hoped for. Awesome! Even dimming the LED light bulb from my friend was partly possible with a bit of flicker Other LED light bulbs, however, work perfectly fine with my DIY dimmer while others did not work at all.

The reason for that is pretty complex, which is why I will save this topic for future video For now, though, we can say that my DIY dimmer costs around the same as the buy version. Is easily customizable and reaches a lower face angle than the buy version However, the safety aspects of my circuits are quite honestly terrible While the buy version obviously had to follow safety standards So if we consider that we can get better working commercial dimmers for slightly higher price points, which I might test in the future

Leave a Comment