Skip to main content

PWM (Pulse Width Modulation)

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).

PWM signal graph.
PWM Signal

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.


Popular posts from this blog

How to Make Blink LED with PIC16F628A

How to Make Blink LED With PIC16F628A In this project tutorial, we are going to make blink-led projects with a pic microcontroller. After you read this tutorial you can build a PIC microcontroller project with XC8 on MPLAB IDE. We are going to make 3 different blinking projects. These projects are basic. Just learn how to make a basic project with a PIC microcontroller. You can see below which projects we are going to make; Blinking LED with 1s delay, LED with button, Blinking LED with a button.

Ultrasonic Sensor HC-SR04 With PIC Microcontroller

How Ultrasonic Sensor Works An ultrasonic sensor is a very useful sensor that measures distances with sounds. We used the PIC16F628A microcontroller for this project. This microcontroller has TMR1 which we are going to use. We need 2 I/O pins for TRIG and ECHO pins. For showing distance, we used an LCD. For more information about the LCD library and usage click the button below. LCD Interfacing with PIC Using XC8

DC Motor Speed Control With PIC16F628A

DC Motor Speed Control Simulation In this project, we will control the speed and direction of a DC motor using the PIC16F628A microcontroller. We will write the software in MPLAB IDE with the XC8 language that will send a PWM signal to L293D to control the motor. Finally, we will simulate it through the Proteus software. PWM (Pulse Width Modulation) You can get more information about the PWM signal from the link above. Now let’s examine the L293D motor driver.