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.

Comments

Popular posts from this blog

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

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.

How To Make Android App To Connect Arduino via Bluetooth

In this project, we are going to make an Android App that will connect with Arduino Nano via the HC-05 Bluetooth module. This app will control the LED, and motor, and read the temperature-humidity of the environment. We will use a free MIT App Inventor website for building apps via blocks. We will give all the project files for this project. If you are ready let’s get started. Schematic Firstly we made an example circuit to make bidirectional communication. You can see in the picture below which components we use. The main component is Arduino Nano which controls the system. We connect the red LED to the D2 pin. We use the L293D motor driver to control the DC motor. We added AHT10 to get temperature and humidity from the environment. Finally, we added HC-05 to communicate with the Android App. Circuit Schematic Android App We made an Android App via MIT App Inventor which is easy to make basic apps. This app will get and send data via Bluetooth. Let’s start to explain what we did. App