Electronic Basics #2: Dimming all kinds of LEDs!?

When Working with LEDs: A Guide to Controlling Brightness Using PWM

When working with LEDs like I do, one of the biggest questions at the beginning is how can I control the brightness of this LED? I'm going to tell you an easy way which you can accomplish with or without an Arduino microcontroller. It's called PWM, which stands for Pulse Width Modulation.

PWM is a technique that allows you to dim all kinds of LEDs, including normal five millimeter LEDs, LED strips, and high power LEDs, and many more. The principle behind PWM is simple: by switching the LED on and off at a high frequency, you can create a signal that varies in width, which corresponds to a varying brightness.

To understand how PWM works, let's look at an oscilloscope. We're still using 5 volts to power the LED, but not constantly. We switch between 5 volts and 0 volts so quickly that we can't see with our eyes. The duty cycle describes the on time in one period. When the duty cycle is 100%, the LED is fully bright. As you lower the duty cycle, the LED gets darker.

The range of duty cycles is from 0 to 100%. A 50% duty cycle represents around 2.5 volts, and a 20% duty cycle represents around 1 volt. Now that we've understood the theory of PWM, let's talk about how to create a square signal using an Arduino or other microcontrollers.

Firstly, the Arduino has an analog write function that can generate those signals. We just need to feed it with a value between 0 and 255. Zero means 0 volts, and 255 means 5 volts. For example, if you set the duty cycle to 100%, the signal will be at 5 volts for most of the time.

To control the value of the analog write function and therefore dim the LED on the PWM pin 3, we can use a potentiometer as an analog input. This is one way to avoid wasting the microcontroller. Alternatively, you can use the 555 timer chip, which is easy to wire and allows you to control the duty cycle with a potentiometer.

When using the 555 timer chip, be careful not to exceed the maximum current rating for your LED. You also need to make sure that the circuit is designed to handle the high frequency switching. In some cases, it's necessary to use a MOSFET to drive the LED.

In general, PWM is an efficient way to control the brightness of LEDs, especially when working with high power LEDs or long LED strips. By understanding how PWM works and using the right techniques, you can create reliable and efficient lighting systems for your projects.

As I mentioned earlier, I'm always experimenting with new projects and techniques. If you're interested in learning more about PWM and its applications, be sure to check out my other tutorials and projects. You can also follow me on social media to stay up-to-date on the latest developments and behind-the-scenes insights into my work.

Overall, PWM is a powerful technique for controlling the brightness of LEDs. With the right understanding and techniques, you can create reliable and efficient lighting systems that are perfect for your next project.

WEBVTTKind: captionsLanguage: enwhen you're working with LEDs like I do then one of the biggest questions at the beginning is how can I control the brightness of this LED and I'm going to tell you an easy way which you can accomplish with or without an Arduino microcontroller it is called pwm which stands for pulls with modulation and with this knowledge you will be able to dim all kinds of LEDs like normal five millimeter LEDs LED strips high power LEDs and many more foreign I'm gonna use this basic green LED with a forward voltage of 3.2 volts as the test subject here I'm powering it with my bench power supply at 3.2 volts this threat of dimming is so simple I feel kind of stupid telling it to you right now when I crank up the voltage the LED draws more current and will eventually burn out but if I lower the voltage underneath the forward voltage level less current will be consumed and the LED gets darker and that my friend is the secret lower voltages but normally you don't want to use a variable bench power supply you want to use a fixed voltage like let's say 5 volts or 12 volts some people might say just using potentiometer in series to the LED which is sometimes the easiest and fastest solution but when you want to dim a high power LED there is a problem firstly you waste energy because the potentiometer heats up because it's just a variable resistor in the end and secondly your potentiometer must be really beefy and expensive when he wants to survive dimming LEDs which require much current like long LED strips so that's let's look at pwm on my old crusty oscilloscope we can see the way pwm works we are still using 5 volts to power the LED but not constantly we switch between 5 volts and 0 volts so the LED turns on and off really fast which we can't see with our eyes the duty cycle describes the on time in one period the LED is fully bright with 100 duty cycle and it gets darker while lowering the 2D cycle for example 50 duty cycle represents around 2.5 volts and 20 to the cycle represents around 1 volt now you can host your own wave it's it's it's okay just saying this is the basic theory of pwm now how to create the square signal firstly the Arduino the analog write function can generate those signals we just have to feed it with a value between 0 and 255 0 means 0 volts and 255 means 5 volts so 100 is around 1.95 volts here I'm using a potentiometer as an analog input to control the value of the analog write function and therefore to dim the LED on the pwm pin 3 and of course you can download the sketch and all schematics link is in description but sometimes you just don't want to waste the microcontroller no problem the grandfather of all electronic hobbyist ICS is here the 555 timer chip it is easy to wire and you can control the duty cycle again with a potentiometer when you use this schematic the pin 3 then spin out our rectangle signal or we can use it directly if we only need 20 milliamps I'm always using a mosfet when I even need more power or want to use a higher voltage for example with this LED strip the pwm signal goes to gate negative side of my led to drain and ground to source that was my quick and hopefully easy to understand dimming tutorial don't forget to subscribe like share and also you can now follow me on Twitter Facebook and Google Plus to see some behind the scenes action informations about upcoming projects and news about my channel and I will see you next timewhen you're working with LEDs like I do then one of the biggest questions at the beginning is how can I control the brightness of this LED and I'm going to tell you an easy way which you can accomplish with or without an Arduino microcontroller it is called pwm which stands for pulls with modulation and with this knowledge you will be able to dim all kinds of LEDs like normal five millimeter LEDs LED strips high power LEDs and many more foreign I'm gonna use this basic green LED with a forward voltage of 3.2 volts as the test subject here I'm powering it with my bench power supply at 3.2 volts this threat of dimming is so simple I feel kind of stupid telling it to you right now when I crank up the voltage the LED draws more current and will eventually burn out but if I lower the voltage underneath the forward voltage level less current will be consumed and the LED gets darker and that my friend is the secret lower voltages but normally you don't want to use a variable bench power supply you want to use a fixed voltage like let's say 5 volts or 12 volts some people might say just using potentiometer in series to the LED which is sometimes the easiest and fastest solution but when you want to dim a high power LED there is a problem firstly you waste energy because the potentiometer heats up because it's just a variable resistor in the end and secondly your potentiometer must be really beefy and expensive when he wants to survive dimming LEDs which require much current like long LED strips so that's let's look at pwm on my old crusty oscilloscope we can see the way pwm works we are still using 5 volts to power the LED but not constantly we switch between 5 volts and 0 volts so the LED turns on and off really fast which we can't see with our eyes the duty cycle describes the on time in one period the LED is fully bright with 100 duty cycle and it gets darker while lowering the 2D cycle for example 50 duty cycle represents around 2.5 volts and 20 to the cycle represents around 1 volt now you can host your own wave it's it's it's okay just saying this is the basic theory of pwm now how to create the square signal firstly the Arduino the analog write function can generate those signals we just have to feed it with a value between 0 and 255 0 means 0 volts and 255 means 5 volts so 100 is around 1.95 volts here I'm using a potentiometer as an analog input to control the value of the analog write function and therefore to dim the LED on the pwm pin 3 and of course you can download the sketch and all schematics link is in description but sometimes you just don't want to waste the microcontroller no problem the grandfather of all electronic hobbyist ICS is here the 555 timer chip it is easy to wire and you can control the duty cycle again with a potentiometer when you use this schematic the pin 3 then spin out our rectangle signal or we can use it directly if we only need 20 milliamps I'm always using a mosfet when I even need more power or want to use a higher voltage for example with this LED strip the pwm signal goes to gate negative side of my led to drain and ground to source that was my quick and hopefully easy to understand dimming tutorial don't forget to subscribe like share and also you can now follow me on Twitter Facebook and Google Plus to see some behind the scenes action informations about upcoming projects and news about my channel and I will see you next time