In many applications, it is important to control the speed of DC motor where precision and protection are essence. 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 Microcontroller based system provides 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. Here we do the same experiment by using a microcontroller.
For that purpose, here we will use ATmega8 controller to produce PWM wave. By varying the width of this PWM wave, we can control the speed of DC motor. In ATmega8 controller, timer1 and timer2 have PWM mode. In this article we will see how to control the speed of DC motor using timer2 PWM mode.
PWM Based DC Motor Speed Control using Microcontroller Circuit Principle:
The heart of this project is ATmega8 controller. These controllers consist of 2 PWM modes. Now we will see how to generate PWM wave using timer2 PWM mode.
Before writing the program to the PWM mode we need to know the register description of all the registers that are used for PWM mode.
OCR2 register contains an 8 bit value that is continuously compared with counter value.
PWM Program:
For more detail: PWM Based DC Motor Speed Control using Microcontroller