Motor Circuit Diagrams

Circuit Diagram Of DC Motor Speed Control Using Microcontroller

This article will tell you how to manage the energy or speed of  dc motor using microcontroller. Later we will take a look at the  circuit diagram of DC motor speed control using microcontroller. So, we used PWM to supply limited amount of power to a load and by this we can manage the energy or speed of the DC Motor with ease. You are thinking that we can manage the speed or energy by using different type of resistor like (variable resistor). But we can not used resistor to manage the speed of DC motor at see in below.

  • The first problem and important thing is that we are using variable electrical load DC motor. So, the working of this motor is quite different we other motors. It consumed large amount of energy to start. After the starting of  motor it draw more energy when load applied on motor shaft.
  •  The other fact is the constant use of resistors the produce some different kinds of energy like (heat). So, heat energy is not health for battery products.
  • That motor produces more current to drop the excess energy or current we have to use higher resistors to handle excess current.


Pulse width modulation(PWM) will easily produce using built-in CCP function of programmable interface controller (PIC) Microcontroller. CCP stands for Capture/Compare/PWM. CCP modules are available with a number of PIC Microcontrollers.In PIC Microcontrollers mostly they have CCP function. To make easy task we will used the ready-made library or function of MikroC Pro by PIC Micro controller.

In this project DC Motor is interfaced with PIC Micro controller by means of L293D Motor Driver. To manage the speed of motor we are using to different type of button. Button up we can use this to speed up the motor and the other one is down so it will decreased the speed of motor. But here I am using dc Motor of 12V and appling some constant values to dc motor so, motor will generate different duty ratio of PWM, So, how we guess the power so DC battery, if 0 percent  duty cycle that mean 0vDC, 25percent  duty cycle that mean 3vDC, 50percent  duty cycle that mean 6vDC, 75percent  duty cycle then mean 9vDC,and 100percent  duty cycle then mean 12vDC.

Circuit Diagram Of DC Motor managing  Using Micro controller

Circuit Diagram Of DC Motor Speed Control Using Microcontroller
Circuit Diagram Of DC Motor Speed Control Using Micro controller

Attention!: Voltage Drain (VDD) and Virtual  Switching System(VSS) of the PIC microcontroller is not display is this diagram. VDD is connected to the Positive side of a battery and VSS is connected of the ground of the Circuit.


Buttons switch are connected with 1st pin and 2nd pin of Protd, This Buttons is used to manage to working ratio of Pulse Width Modulation Generator. For increasing the power ratio press up button and do the same with down button to decreasing power ratio. Basically though this process we are controlling the speed of our DC motor.we can  CCP1 module of PIC 16F877A to generate PWM and it is given to the enable pin of L293D. To change the rotation used 1pin and 2pin in Protb.

Mikro C program

void main()
short duty  = 0; //Starting value of working

TRISC = 0x00; //Portc this is used for giving output

TRISD = 0xFF; //PortD this is used for input

TRISB = 0x00; //Portb this is used for giving output
PORTB = 0x02; // this portb is used to run motor anti-clockwise

PWM1_Init(1000);  //Starting of Pulse width modulation1
PWM1_Start();  //start PWM1
PWM1_Set_Duty(duty); //giving the Pulse width modulation1

while (1)        // true loop of infinite loop
if (!RD0_bit && duty<250) //if button on RD0 pressed
duty = duty + 10;  //increment current_duty
PWM1_Set_Duty(duty);  //Change the duty cycle
if (!RD1_bit && duty >0) //button on RD1 pressed
duty = duty – 10;  //duty is decreasing by 10
Delay_ms(10);      //it will slow the system.

We can pass some different type of parameter is PWN1_Set_Duty() like 0 to 255. So, 0 means 0 percent duty and 255 means 100percent  duty.


For more detail we can study induction motors:

Read>>Circuit Diagram Of Soft Starters For Induction Motors

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button