Let’s say you have a lamp. You want to change its brightness of it. You can use a set resistor to do this, but this will convert some of the electricity into heat. Instead, how to turn on and off the lamp at regular intervals. If we turn the lamp on and off too quickly, it will come to us as if the lamp never went out. Because the off time is shorter than the extinguishing time. If we increase the switch-off time slightly, we will see as the lamp brightness is decreasing. This mechanism is called PWM (Pulse Width Modulation).
We have a 5V voltage source. If we make this source 50% off and 50% on, the source will give us 2.5V. In fact, the source never gives us this value. It gives 5V at 50% time and 0V at 50% time. We perceive it as 2.5V. In fact, this mechanism is used in AC (Alternating Current). The sockets in our home right now are 50Hz or 60Hz (varies by country). That means doing 50 laps per second. We can think of a tour as (220V) – (0V) – (- 220V) – (0V). Increasing switching frequency means increasing efficiency. So the faster you turn it on and off, the better.
The percentage of electricity remaining on is called Duty Cycle. To find this, we divide the pulse width by the period and multiply it by 100.
Duty Cycle = Pulse Width / Period * 100
For now, I hope I will share Arduino and PIC applications in my future posts.