0% found this document useful (0 votes)
6 views11 pages

PWM Based DC Motor Speed Control Using Microcontroller

This document details a project on PWM-based DC motor speed control using the 8051 Microcontroller. It explains how to generate a PWM signal using timers and interrupts to control the speed of a DC motor, along with a circuit diagram and code implementation. The project highlights the advantages of using PWM for power savings and its applications in various industries.

Uploaded by

ABBASSEN
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views11 pages

PWM Based DC Motor Speed Control Using Microcontroller

This document details a project on PWM-based DC motor speed control using the 8051 Microcontroller. It explains how to generate a PWM signal using timers and interrupts to control the speed of a DC motor, along with a circuit diagram and code implementation. The project highlights the advantages of using PWM for power savings and its applications in various industries.

Uploaded by

ABBASSEN
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

 

([Link]

Home ([Link]
8051 Microcontroller ([Link] Electronics
([Link] Embedded ([Link]
project-circuits/embedded/), Free Project Circuits ([Link] Mini Projects
([Link]

PWM Based DC Motor Speed Control using


Microcontroller
October 29, 2018 By Administrator([Link]

In this project, I will show you how to generate a PWM signal using 8051 Microcontroller
([Link] and also a PWM based
DC Motor Speed Control using Microcontroller.

Outline

Introduction
It is important to control the speed of DC motor in many applications, where precision and
protection are essential. Here we will use a technique called PWM (Pulse Width Modulation)
to control the speed of DC motor.

We can achieve speed control of DC motor using mechanical or electrical techniques but they
require large size hardware to implement but a Microcontroller based system provides an
easy way to control the speed of DC motor.
Earlier, we have already seen how to control the speed of DC motor using PWM without
Microcontroller (/speed-control-of-dc-motor-using-pulse-width-modulation/). Here, we do
the same experiment by using a microcontroller.

For that purpose, here we will use 8051 controller to produce PWM wave. By varying the
width of this PWM wave, we can control the speed of DC motor. In 8051 microcontroller, the
timers are used to generate the PWM wave.

In this article we will see how to generate a PWM Signal using timers in 8051 Mocrocontroller
and also how to control the speed of DC motor using tthat PWM signal.
PWM Based DC Motor Speed Control using Microcontroller
Circuit Principle
The heart of this project is the 8051 Microcontroller ([Link]
microcontroller-architecture/). If you have worked with any variant of the 8051
Microcontroller, you might remember that 8051 doesn’t have a dedicated PWM circuitry to
enable PWM Mode. So, in order to generate a PWM Signal, we have make use of Timers and
switch the I/O pins ON and OFF using the timers.

In this project, I will make use of Timer0 in 8051 Microcontroller along with Timer Interrupt to
produce the PWM Signal.

Also Read the Related Post – How Stepper Motor Driver Circuit Works
using 8051 Microcontroller? (/stepper-motor-control-using-8051-
microcontroller/)

How to Generate PWM in 8051 Microcontroller?


Most modern microcontrollers like AVR (Arduino, for example), ARM, PIC, etc. have a
dedicated PWM hardware and pins to activate PWM mode instantly. However, 8051
Microcontrollers do not have this provision. So, how to generate PWM in 8051
Microcontroller?

For this we have to use Timers and Interrupts in 8051 Microcontroller. The Timer0 of 8051 is
configured in Mode0. By carefully adjusting the High and Low levels, we can maintain a
constant period of the signal.
Circuit Diagram of PWM Based DC Motor Speed Control
using Microcontroller

Circuit Components ([Link]


circuits-componentstypes/)
8051 Microcontroller
11.0592 MHz Crystal
Capacitors – 33pF x 2, 10µF
Resistors – 1KΩ x 4, 10KΩ x 2
12V DC motor
L298N Motor Driver
Push Buttons x 5
1KΩ x 8 Pull-up Resistor Pack ([Link]
Serial cable
12V battery or adaptor
Connecting wires

PWM based DC Motor Speed Control using Microcontroller Circuit Design


The circuit consists of one 8051 Microcontroller (and its supporting circuitry related to
oscillator and reset), L298N Motor Driver Module, a DC Motor and a few push buttons.

A 12V DC Motor is connected to the L298N Motor Driver Module at its OUT1 and OUT2 Pins.
The IN1 and IN2 pins of the motor driver are connected to +5V (VCC) and GND. The EN1 pin
of the Motor driver is connected to Port0 Pin P0.0.

Four Push Buttons are connected to Port0 Pins P0.4, P0.5, P0.6 and P0.7.

Generally, we can interface switches to the micro controller in two configurations; one is Pull-
up configuration and the other is pull-down configuration.

Pull-up configuration: In pull up configuration, the microcontroller pin is pulled HIGH to


LOGIC 1 and the button is connected to GND. When button is pressed, microcontroller pin
receives LOGIC 0

Pull-down configuration: In pull down configuration, the microcontroller pin pulled down to
LOGIC 0 and the button is connected to VCC. When button is pressed, microcontroller pin
receives LOGIC 1.

In our circuit we are using pull up configuration. So, we need to check for logic 0 in order to
know whether the button is pressed or not.
Code
The code for the project is given below.

1 #include<reg51.h>
2
3 sbit PWM_Pin = P0^0;
4 sbit low = P0^4;
5 sbit medium = P0^5;
6 sbit high = P0^6;
7 sbit off = P0^7;
8
9 void InitPWM_timer(void);
10
11 unsigned char PWM = 0;
12 unsigned int temp = 0;
13 char a=1;
14
15
16 int main(void)
17 {
18 low=1;
19 medium=1;
20 high=1;
21 off=1;
22 PWM_Pin=0;
23
24 InitPWM_timer();
25
26
27
28 while(1)
29 {
30 if(low==0)
31 {
32 PWM=102;
33 a=0;
34 }
35 else if(medium==0)
36 {
37 PWM=153;
38 a=0;

39 }

40 else if(high==0)

41 {

42 PWM=255;

43 a=0;

44 }

45 else if(off==0)

46 {

47 a=1;

48 PWM_Pin=0;

49 }

50 }
51 }
52
53
54 void InitPWM_timer (void)
55 {
56 TMOD &= 0xF0;
57 TMOD |= 0x01;
58
59 TH0 = 0x00;

60 TL0 = 0x00;

61
62 ET0 = 1;

63 EA = 1;

64
65 TR0 = 1;

66 }

67
68
69 void Timer0_ISR (void) interrupt 1

70 {
71 TR0 = 0;
72
73 if(PWM_Pin==1 && a==0)
74 {
75 PWM_Pin = 0;
76 temp = (255-PWM);
77 TH0 = 0xFF;
78 TL0 = 0xFF - temp&0xFF;
79 }
80 else if(PWM_Pin==0 && a==0)
81 {
82 PWM_Pin = 1;
83 temp = PWM;
84 TH0 = 0xFF;
85 TL0 = 0xFF - temp&0xFF;
86 }
87
88 TF0 = 0;
89 TR0 = 1;
90 }

/elktros/40c9bd72ad16155a24c7fda737b38663/raw/f872631e7b094f700b1f7acb7c492091ec5954d0/PWM_DC_Motor_Speed_Control.c)
PWM_DC_Motor_Speed_Control.c ([Link]
pwm_dc_motor_speed_control-c) hosted with ❤ by GitHub ([Link]

How to Operate the Circuit?


1. Connect 12V battery or adaptor to the development board.
2. Switch on the supply.
3. Burn hex file to the 8051 controller with the help of programmer.
4. Make the necessary connections as per the circuit diagram.
5. Now switch on the supply and press switch 1. You can observe the starts rotating but at
only 40% capacity.
6. If you press switch 2, the motor runs with slightly greater than half the speed (60% duty
cycle).
7. Pressing switch 3 will make the motor to rotate at full speed (100% duty cycle).
8. To stop the motor, press switch 4.

Advantages
Using this PWM method, we can save the power.

Applications
Used in industries to control the speed of motors.
Used in shopping malls.
We can use this concept to control the light intensity.

Related Posts:
MOSFET as a Switch ([Link]
Screw Gun Vs Drill - Which One Should Buy? ([Link]
gun-vs-drill/)
Arduino RC522 RFID Module based Access Control System
([Link]
system/)
How to Generate PWM Signal using 555 Timer IC? ([Link]
Leave a Reply
timer-pwm/)
Generator
Your vs Motor
email address will |not
What are the Differences?
be published. Required fields are marked *
([Link]
Open Loop
Comment * System ([Link]
Name *

Email *

Website

Post Comment

(htt (htt
ps:/ ps:/
/ww /ww (htt
[Link] (htt w.y ps:/
ceb p:// out /ww
([Link]

ook. twit ube. [Link]


comter. comstag
/ele co /use ram
ctro m/e r/el .co
nics h_o ectr m/e
Get Our Latest Newletters
hub rg) onic h_o
No Ads Or Spams,shu rg/)
Get Great Content That You Love.
.org We Promise.

) bor
g)
Enter your email Sign Up

Your Privacy Is Important To Us

General 

Projects 

Projects 
Tutorials 

About Advertise with us


([Link]

Contact
([Link]

Affiliate Disclosure([Link]
Disclaimer([Link]
Terms and Conditions([Link]
Privacy Policy([Link]

Copyright © 2023 [Link]

A RAPTIVE PARTNER SITE

You might also like