October 21, 2011

Bidirectional Motor With 1 Pin of Microcontroller (Proteus Simulation)

How to drive a motor with a single pin of microcontroller?
A tough question but I have got the answer and the answer is “H-bridge connection”
Now you may be think that normally all the motors are driven by H-bridge connection and it would be even easier to drive them with motor driver IC so what is new here?
Here is a new configuration that can drive entire H-bridge with a single pin of micro controller, but for that you have to insert some extra hardware in that
A simple configuration is given below…
Bidirection Motor control

                    You can change the frequency of pulse to change the speed of motor and you can also vary PWM to generate asymmetric motor drive, and this entire thing at the cost of just one micro controller pin

                    we can easily stop the motor by tri-stating the microcontroller pin by just two simple lines of code that is 


                    But when working with Proteus you realize that some things are out of your control, i mean to say that when port pin is not connected to H-bridge it is tri stated properly but as soon as you connect it to bridge your tri-stated output is magically "converted" into ground that's why i could not include "stop motor" action in this demo.
                    Here I have just used a simple program to generate a 2 second delay and run motor in clockwise or anticlockwise.
                   The program is written for Atmega 8535(crystal frequency=16Mhz ; I am using earlier made header file)
#include "delay.h"

void main(void)
            DDRB=0x08;                                   // Port B data direction declaration as output.
            while(1)                               //This is for the infinity loop.
             delayms(2000);                //2 second delay
             delayms(2000);                //2 second delay

You can download source code file for this project and ISIS Proteus design HERE.


Post a Comment

Related Posts Plugin for WordPress, Blogger...