Sunday, October 23, 2011

Bidirectional Motor With 1 Pin of Microcontroller.....


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 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…


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
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<avr/io.h>                     
#include <delay.h>

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

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

No comments:

Post a Comment