Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Speed Control Using PWM

By Harshad Ambulkar August 28, 2013

Today’s industries are increasingly demanding process automation in all sectors. Automation results into better quality, increased production an reduced costs. The variable speed drives, which can control the speed of A.C/D.C motors, are indispensable controlling elements in automation systems. Depending on the applications, some of them are fixed speed and some of the variable speed drives.

The variable speed drives, till a couple of decades back, had various limitations, such as poor efficiencies, larger space, lower speeds, etc., However, the advent power electronic devices such as power MOSFETs, IGBTs etc., and also with the introduction of micro -controllers with many features on the same silicon wafer, transformed the scene completely and today we have variable speed drive systems which are not only in the smaller in  size but also very efficient, highly reliable and meeting all the stringent demands of various industries of modern era.

Direct current (DC) motors have been used in variable speed drives for a long time. The versatile characteristics of dc motors can provide high starting torques which is required for traction drives. Control over a wide speed range, both below and above the rated speed can be very easily achieved. The methods of DC Motor speed control are simpler and less expensive than those of alternating current motors.

In this project, speed control is attained using PWM (Pulse Width Modulation) technique and PWM generation is done using microcontroller.

PRINCIPLE

Pulse width modulation (PWM) is a method for binary signals generation, which has 2 signal periods (high and low). The width (W) of each pulse varies between 0 and the period (T). The main principle is control of power by varying the duty cycle. Here the conduction time to the load is controlled. Let for a time t1, the input voltage appears across the load i.e. ON state and for t2 time the voltage across the load is zero.

• The average voltage at output is given by

Va = Vmax. *    

Where,

TON      =Time period for Pulse ON,

TOFF     =Time period for Pulse OFF

 

• The average load current Ia= Va/R = kVs/R where, T is the total time period =t1+t2, k = t1/T is the duty cycle.

• The duty cycle can be varied from 0 to 1 by varying t1, T or f. Therefore, the output voltage V0 can be varied from 0 to Vs by controlling k, and the power flow can be controlled.

• As the time t1 changes the width of pulse is varied and this type of control is called pulse width modulation (PWM) control.

For better understanding of PWM these diagrammatic representations can be used. These figures represent the waveforms obtained as output at different voltage requirements.

High Speed Signal (90%):The green part of the signal represents the ON time and the white part of it represents time when it is not receiving any voltage

Signal Diagram for 90 Percent Duty Cycle

Fig. 1: Signal Diagram for 90 Percent Duty Cycle

Signal with half voltage (50%):

Signal Diagram for 50 Percent Duty Cycle

Fig. 2: Signal Diagram for 50 Percent Duty Cycle

Signal with low voltage (10%):

Signal Diagram for 10 Percent Duty Cycle

Fig. 3: Signal Diagram for 10 Percent Duty Cycle

In this way the average value of resultant voltage is varied. When pwm technique is used to control the speed of dc motor, the average value of voltage given to motor is varied in similar manner, hence varying the speed of the motor.

WORKING

Pulse width modulation is implemented using a microcontroller, dependent on an input value for generating variable pulse widths, for driving motor at variable speed.

Therefore, the input value used is given with the help of potentiometer.

Internal Circuit Diagram of Variable Resistance

Fig. 4: Internal Circuit Diagram of Variable Resistance

The 2 terminals of potentiometer are connected to Vcc& GND, resulting in variable voltage in range of 0-5V, in the terminal W of potentiometer. This pin serves as the input for microcontroller.

The ATmega8L has inbuilt 10 bit ADC (Analog to Digital Converter), which means it can convert any analog value between 0-5V to digital value of 10 bit resolution.

The program for generating results for pulse width is written into microcontroller’s memory using ISP (In System Programmer).

The variable output (between 0-5V) goes to the A (Analog Input) pin of the ADC (Analog to Digital Converter) of the microcontroller and gets converted into 10 bit binary value. This 10 bit binary value gets converted into corresponding decimal value of range 0-1023 (as 210=1024), which is responsible for triggering the output pin of microcontroller, for particular time duration, which further triggers the MOSFET for same duration.

Block Diagram and Implementation

BLOCK DIAGRAM

Block Diagram of Avr based DC Motor Speed Controller

Fig. 5: Block Diagram of Avr based DC Motor Speed Controller 

For example, suppose the potentiometer knob is set to deliver out 1.25V at its pin W (see fig. 46463135), which becomes input for ADC, converts it to a value corresponding to, between 0-1023.

5/1.25 = 4                                            1024/4 = 256

            So the value comes out to be 256 !!

Now according to the program,

            TON time = 256 ms& TOFF time =1024-256 = 768ms

Now, according to the formula,

                                                Va = Vmax. *     

                                                Va = Vmax. * 

                                                Va = 25% of Vmax.

                                                            i.e. 25% duty cycle !!

In this way, duty cycle from 0% – 100% is generated. In the circuit diagram of the project, consult this:

            PORT 4 – Programming Pins,

BT1 – Battery / DC Source,

Q2 – Motor Driver – MOSFET – IRF 740,

PB1 – RESET Push Button

COMPONENTS REQUIRED

             i.                 Zeroboard

            ii.                 Berg Strips

            iii.                Voltage Regulator – 7805

            iv.                Diode – 1N4007

             v.               Resistor – 330?

vi.               Microcontroller – Atmega-8L

vii.              Microcontroller bed

viii.             RESET Tic-Tac Switch

ix.              Potentiometer

x.               MOSFET – IRF 740

xi.              DC Motor

xii.             Breadboard Wire

xiii.            Jumper Wire

IMPLEMENTATION

With the help of above mentioned components and ckt. Diagram, all the components are soldered using hand solder on zero-board PCB.

Voltage regulator 7805 and diode are part of power supply module of the development board, microcontroller, RESET switch and potentiometer serve as the functional unit for input and processing/generation of PWM signals, while MOSFET acts as the motor driver IC to trigger DC motor.

The program is being burned using AVR Programmer.

Image of AVR Programmer

Fig. 6: Image of AVR Programmer

Image showing Different Components on AVR Programmer

Fig. 7: Image showing different components on AVR Programmer

Prototype of AVR based DC Motor Speed Controller

Fig. 8: Prototype of AVR based DC Motor Speed Controller

APPLICATIONS

i.                  Variable speed drives in machines, eg. Lathe Machines.

ii.                 In Textile Industry.

iii.                In Drives in Electric Vehicles.

iv.                Can also be used as intensity reducer in DC lamps.

RESULTS

i.       It fulfils all the requirements for its application.

ii.      The motor responds to the average value of the pulses and not to the individual pulses as the microcontroller works at high frequency.

iii.    Changing the duty-cycle of the pulse by changing the potentiometer changes the average voltage level.

 

Project Source Code

###


#define F_CPU 150000
#include
#include
#define  PORT_ON(port,pin) port |= (1<
#define  PORT_OFF(port,pin)  port &=  ~(1<
 
int  main(void)
  {
 
  unsigned  int adc_value;// Variable to hold ADC  result
 
  DDRD=0xff;// Set Port D for LED output
  PORTD  = 0x00;// Clear Portd pins
 
ADCSRA  = (1<
  ADMUX=0x05;//Binary equivalent of 0101
 
// Variable to hold ADC  result (adc_value)
  DDRD=0xff;// Set Port D for LED output
  PORTD  = 0x00;// Clear Portd pins
adc_value=0;
while(1)
{
ADCSRA  |= (1<
while (ADCSRA &  (1<
// wait until conversion  completes; ADSC=0 means Complete
 
adc_value = ADCW;//Store ADC result
//Port D Pin triggering
PORT_ON(PORTD,6);
 _delay_ms(adc_value);
 PORT_OFF(PORTD,6);
 _delay_ms(1023-adc_value);
}
}
 

###

 


Circuit Diagrams

Circuit-Diagram-AVR-DC-Motor-Speed-Controller


Filed Under: Electronic Projects
Tagged With: dc motor, PWM Modulation, speed control
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • RF-DC rectifier impedance matching
  • GanFet power switch starts burning after 20 sec
  • Four-MOSFET Synchronous Rectification for High-Efficiency LLC Converter
  • How to solve this electronic problem?
  • Colpitts oscillator

RSS Electro-Tech-Online.com Discussions

  • Need Help Figuring Out the Schematics Of Circuit Board
  • Wish to buy Battery, Charger and Buck converter for 12V , 2A router
  • applying solder paste from a jar
  • Question i-nears headphones magnetic drivers
  • An Update On Tarrifs

Featured – Designing of Audio Amplifiers part 9 series

  • Basics of Audio Amplifier – 1/9
  • Designing 250 Milli Watt Audio Power Amplifier – 2/9
  • Designing 1 Watt Audio Power Amplifier – 3/9
  • Designing a Bass Boost Amplifier – 4/9
  • Designing a 6 Watt Car Audio Amplifier – 5/9
  • Design a low power amplifier for headphones- 6/9

Recent Articles

  • Sienna Semiconductor data converters feature sample rates from 20 to 250 Msps
  • Delta’s 5,500 W power supplies achieve 97.5% energy efficiency for AI servers
  • Novosense Microelectronics releases digital isolators with capacitive-based design
  • MIPI C-PHY adds encoding option to support next-gen image sensor applications
  • Littelfuse gate driver delivers 1.9 A source and 2.3 A sink output current

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe