Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

DC Motor Control using PWM with ADC

By Gurmeet Singh

 

Requirements:

1.AT89S52 microcontroller
 
2.ADC0804 ADC chip
 
3.Preset (10K)
 
4.555 timer (with apt. resistor and capacitor values)
 
5.7805 IC
 
6.L293D IC
 
7.DC motor
 
This project involves a combination of PWM (pulse width modulation) and ADC (Analog-Digital converter) to drive a DC motor at various speeds and in both clockwise and anti-clockwise directions.
 
PWM is a concept with which one can modify the pulse voltage varying from 0% to 100% duty cycle.
 
Duty cycle represents the time for which pulse is high when compared to the full pulse length.
 
For eg:
 
This image below represents various percentage of duty cycles for a 4ms wave.

Timing Diagram showing different duty cycles

Fig. 1: Timing Diagram showing different duty cycles

This means for a 25%  cycle, you’ll we get 25% of the input voltage and the criterion is same for the rest of them. Now in the coding part I have made changes in the duty cycle in accordance with the digital output  obtained from the ADC. The ADC is connected to my microcontroller at PORT1. The preset which I have used here to send the analog input can be replaced by a “joystick” with inbuilt preset to make it more realistic and interesting to operate.
 
Now talking about the ADC, it’s an 8 bit analog to digital converter  that converts all the analog values to 8 bit digital data i.e. (0-255 for which it requires a reference voltage. The resolution or step-up voltage is 19.531mV. This means that for every 19.531Mv rise in the analog input, ADC will increase the digital value by 1 starting from 0 and ending at 255.
 
The resolution depends upon the reference voltage as well as the type of ADC you’re using. Here the reference voltage is 5v, while I’m working on an 8 bit ADC therefore:

             Resolution = 5(Reference voltage)/256(due to 8 bit i.e. 2^8=256) = 19.531mV

AADC also requires a clock frequency to work  upon. I have given it a 640 KHz using a 555 timer IC in a-stable mode.

For further information about ADC, check out my project: ADC interfacing with 8051.
 
L293D is connected to microcontroller via pin P2^1 and P2^6

Prototype of 8051 Microcontroller based DC Motor Speed Controller

Fig. 2: Prototype of 8051 Microcontroller based DC Motor Speed Controller

 

 

Project Source Code

###



#include<reg51.h>
#include<delay.h>
sbit R=P3^0;
sbit WD=P3^1;
sbit INT=P3^2;
sbit n=P2^1;
sbit p=P2^6;
int read_ADC()
{
        int temp;
                       R=1;
                       WD=0;
                       WD=1;
                       while(INT==1);
                       R=1;
                       R=0;
                       temp=P1;
            return temp;
}
void main()
{
           unsigned char value=128;
           INT=1;
           P1=0xff;
           value=read_ADC();
           while(1)
            {
                        if(value>125 && value<130)
                                   {n=0;p=0;}
                        else if(value<=125)
                                    {
                                              n=0;p=1;
                                              delay_msec(6-(value/25));
                                              n=0;p=0;
                                             delay_msec(value/25);
                                    }
                        else if(value>=130)
                                    {
                                               value=255-value;
                                                n=1;p=0;
                                                delay_msec(6-(value/25));
                                                n=0;p=0;
                                                delay_msec(value/25);
                                    }
                        value=read_ADC();
           }          
}

###

 


Circuit Diagrams

Circuit-Diagram-8051-Microcontroller-Based-Dc-Motor-Speed-Controller

Project Video


Filed Under: Electronic Projects
Tagged With: 8051, adc, dc motor, pwm
 

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



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

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!


Featured Tutorials

  • Designing Gate Driver Circuit and Switching Mechanism for Modified Sine Wave Inverter – (Part 9/17)
  • Completing Modified Sine Wave Inverter Design with Full Bridge Circuit and Step Up Transformer – (Part 10/17)
  • Designing an Offline UPS – Part (12 /17)
  • How to reduce Switching Time of a Relay – (Part 15/17)
  • Testing MOSFET – (Part 16/17)
  • Driving High Side MOSFET using Bootstrap Circuitry – (Part 17/17)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • New automotive radar sensor enables reliable in-cabin monitoring system
  • TI breaks ground on 300-mm semiconductor wafer-fabrication plants in Texas
  • New wireless AR Smart Viewer reference design
  • Infineon launches scalable and wireless charging platform with configurable controllers
  • First single-core MPU with MIPI CSI-2 camera interface and audio

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd ldr led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • MAX2771 digital output processing
  • request for a good manual on rectangular waveguide feeding network
  • RC Extraction with black box option
  • what is internal pin in a standard cell
  • MOSFET ORing circuit simulation (LTspice)

RSS Electro-Tech-Online.com Discussions

  • Need help using a common power supply for two devices
  • NXP i.MX8 board vs Raspberry Pi?
  • Ampro 16mm Stylist projector woes.
  • Multistage BJT amplifier
  • Help me to start 24V BLDC (Star winding)
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 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 | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering