You Are Here: Home » AVR ATmega Projects » Motor Projects » Speed and Direction Control of DC Motor using AVR Microcontroller

Speed and Direction Control of DC Motor using AVR Microcontroller

Controlling direction and speed of DC motor is very essential in many applications like

·         Robotic application – to change direction and speed of moving robot

·         Industrial application – to change direction and speed of rotating machinery

·         Domestic application – to vary speed of battery (DC) operated portable fan

·         Defence application – to rotate radar, automatic gun, tank gun in either direction

·         Communication application – rotate dish antenna upward – downward or clockwise – anticlockwise

Speed and Direction Control of DC Motor using AVR Microcontroller

Thus we can count number of such applications where there is a need to change direction and/or speed of DC motor. The direction of DC motor can be controlled by just reversing the polarity of given supply. And for varying speed, there are various ways to vary speed of DC motor but the best amongst them is PWM – pulse width modulation technique. In this technique we shall vary the width of applied pulse that will vary average voltage applied to motor and its speed will change.

So this project demonstrates how to vary the speed and change the direction of simple 12V 500 RPM DC series motor using AVR microcontrollerATmega32.


System block diagram: –


The major building blocks of this system are as shown in figure that are ATmega32 and DC motor driver chip L293D. Along with them we need some push buttons for controlling and LEDs for indications. Each block is described briefly here.


Push buttons – five push buttons are given to run, stop, change speed and direction of DC motor



Button 1Run motor in clockwise direction
Button 2Run motor in anticlockwise direction
Button 3Stop motor
Button 4Increase speed
Button 5Decrease speed

L293D chip – this chip takes input from micro controller and drives DC motor. The micro controller output current is not enough to drive DC motor directly. The chip has quad half H bridge drivers. It will provide up to 600 mA current to motor that is enough to drive it.

Speed and Direction Control of DC Motor using AVR Microcontroller

LED indications – six LEDs are used for different indications






Blinks when motor runs in clockwise direction



Blinks when motor runs in anticlockwise direction



Blinks when speed in increased



Blinks when speed is decreased



Lits ON when speed limit is maximum



Lits ON when speed limit is minimum
AVR micro controller ATmega32 is low power, high performance, 8-bit, Advance RISC architecture based micro controller. It has 32 KB of in system programmable FLASH. Also it has built in peripherals like 10-bit, 8 channel ADC, 4 PWM channels, 1 16-bit and 2 8-bit timers/counters, USART, SPI, IIC etc. In this system it performs following tasks

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Neutrons probe structure of enzyme critical to development of next-generation HIV drugs

A team led by the Department of Energy's Oak Ridge National Laboratory used neutron analysis to better understand a protein...

Scroll to top