Speed control of DC motor using microcontroller part 2

Before continuing with second part of speed control of DC motor article , I recommend you to go through speed control of DC motor first article so that you can get basic idea about how to control speed of DC motor and which factor is common in all types of DC motors to control speed. To read first tutorial comment on link blow:

Speed control of DC motor using microcontroller part 1

I have already mentioned there are two methods to make pulse width modulator.These are Analog Electronics method and digital Electronics method using Microcontrollers. There are dedicated PWM controller IC’s are also available in market like SG3525, UC3842, SG2525 and many others. These PWM controller IC’s also use analog electronics method. Because their internal circuitry consists of operational amplifiers , resistors and capacitors.I will write also write article on PWM controllers for those who hate programming and don’t know about use of Microcontrollers. But there are few issues with these ready to use PWM controller IC’s. Most important issue are:

  1. you will require many extra components to make them ready to use.
  2. Exact frequency is not achievable. 1-2% error
  3. There is also a frequency limitation which in some cases generate audible in motors.

But there is no such issues with pulse width modulators of digital electronics type.

Components List:

  1. 7805 voltage regulator
  2. resistors
  4. IRL1004 FET
  5. UF4007 DIODE
  7. 1K Variable resistor
  8. 22pF capacitors

I have used PIC16F876 microcontroller to generate PWM and to change duty cycle by reading analog value of voltage across variable resistor. you can use any microcontroller you want. But logic will remain same.

Circuit diagram of speed control of DC motor
Circuit diagram of speed control of DC motor\

In above circuit diagram 12v is used as a power source.7805 voltage regulator is used to give 5 volt to variable resistor and supply to microcontroller. There is no need to give supply 5 volt in Proteus to microcontroller. Because by default 5 volt  and ground has been supplied to microcontroller in Proteus.Variable resistor is used to change duty cycle of PWM. By moving the knob of variable resistor you can change the duty cycle which is directly related with speed of DC motor. So you can adjust the speed of DC motor by adjusting variable resistor knob according to your speed requirement.

Circuit diagram of speed control of DC motor
Circuit diagram of speed control of DC motor

Video lecture on dc motor speed control

The PWM frequency is about 8Khz which will not make any audible noise.You can adjust it according to your motor specifications. IRL1004 is used as a switch. IRL1004 FET require only 5 volt logic level driver to operate FET and negligible amount of current.Therefore there is no need of any driver to drive IRL1004 FET. It can handle more than one ampere current very easily as it is mentioned in its data sheet. Diode 1N4007 is used as a free wheeling  fast recovery diode.Because motor is a inductive load and its back emf may damage circuit.Free wheel diode will provide flow path to back emf current and avoid sparking across motor terminals.

If you want to learn programming of PWM and ADC (analog to digital converter) using PIC Microcontrollers. Check PIC mircontrollers tutorails.

PIC Microcontrollers Tutorials 

If you want complete simulation and code of this project.Comment on this post with your email address and if you have any issue while making this project, feel free to comment on this post.

Future Recommendations :

  1. Feedback control mechanism to ensure constant speed
  2. Direction control of DC motor using H bridge
  3. Try to control more than one motors.
  4. Final year projects: Speed control of DC motor through wireless communication like GSM, GPRS, Bluetooth, ZigBee and many others wireless communication techniques.

I will also write on above articles soon. But to enhance your technical skills you should try it yourself.If you feel any problem.I will love to hear your problems and try to solve them.

64 thoughts on “Speed control of DC motor using microcontroller part 2”

  1. Hi Bilal, can you please send me the full project simulation and the source code, very much interested.
    Thank you

  2. i love this tutorial and this particular topic was given to me design and construction of microcontroller based speed of a DC motor. so I just want to ask if I can get the complete write up and guide

  3. hello,
    i am very interrested in this project as i am working on the same topic, DC motor speed control with thyristors interfacing circuit.
    i would like to receive the project files for this application.
    here is my mail adress: [email protected]
    thank you for your help

  4. It was a great experience to see this tutorial , please email me the code of this project . I will be so grateful to you .

  5. Hi Bilal ,
    tutorial based on controlling dc motor speed woth pic was quiet interesting.
    can u please send a code as i need this concept for my mini project.

  6. Hello Sir,
    Thank you for this tutorial. I hope it will help me a lot to understand the speed control technique of dc motor. Sir I want to control the speed of 220V DC Shunt motor using same technique. So can you please me what all the changes I need to make in the circuit as well as the code for the microcontroller. Thank you so much in advance. Hope to hear soon from you.

  7. hello sir,i went to do a program for dc motor control by using ardiuno.so, please help me .how i can be done this program?

  8. Wow great tutorial!!!

    Do you mind to share and PM the code??? Currently I’m stuck at the code since there’s no input to AN0 from potentiometer. And my project got 2 potentiometer which is need to use AN0 and AN1, I’m using PIC16F877A

Leave a Comment