Bipolar stepper motor controller using AVR microcontroller and L298N motor driver from Priyank Bolia on Vimeo.
In this video, we'll see how to control the bipolar stepper motor using the AVR ATMega32 microcontroller and L298N motor driver. Both the motors ports A & B are enabled, by connecting the EnableA and EnableB lines to PB0 and PB1 respectively. Both the PB0 and PB1 pins are always at high volatge. The input lines of the L298N motor driver board 1,2,3,4 are connected to Port PB7, PB6, PB5, PB4 respectively. Now, the voltage is varied on the input lines of the L298N motor driver using the ATMega32 microcontroller, causing the change in voltage at the motor input lines, i.e., the L298N motor driver output lines. This causes the stepper motor to rotate.
#include <util/delay.h>
int main(void)
{
DDRB=0xFF;
while(1)
{
//Normal Bipolar Stepping
PORTB = 0b10010011;
_delay_ms(10);
PORTB = 0b01010011;
_delay_ms(10);
PORTB = 0b01100011;
_delay_ms(10);
PORTB = 0b10100011;
_delay_ms(10);
}
}