Pages

Monday, 30 June 2014

L298N Motor Drive Shield

Quick Overview

L298N is a high voltage, high current motor driver chip, with the highest working voltage of 46V, continuous operating current of 2A, and instantaneous peak current up to 3A. The chip contains two "H bridges" which are high-voltage and high current full-bridge drivers that can directly drive two DC motors.

L298N Motor Drive Shield  

 

Features:
  • Driver: L298N Dual H Bridge DC Motor Driver IC
  • Motor Power Supply Vs: +5 V to +35 V
  • Max average current 2A
  • peak current Io: 3A
  • Logic Level Power Vss: +5 V ~ +7 V (Onboard 5V Regulator can be used if Motor Power is > 7.0V)
  • Logic level power: 0 ~ 36mA
  • Two motor direction indicator LEDs.
  • Screw-terminals for power and motor connections.
Sample codes:
//Program 1: PWM Speed Control 
int E1 = 9; 
int M1 = 4; 
int E2 = 10; 
int M2 = 5; 
 
void setup() 
 pinMode(M1, OUTPUT); 
 pinMode(M2, OUTPUT); 
 
void loop() 
 int value; 
 for(value = 0 ; value <= 255; value+=5) 
 { 
 digitalWrite(M1,HIGH); 
 digitalWrite(M2, HIGH); 
 analogWrite(E1, value); //PWM Speed Control 
 analogWrite(E2, value); //PWM Speed Control 
 delay(100); 
 } 
 
//Program 2: Motor Direction control
int ENA=9; //Connect on Pin 9
int IN1=4; //Connect on Pin 4
int IN2=5; //Connect on  Pin 5
int ENB=10; //Connect on Pin 10
int IN3=6; //Connect on  Pin 6
int IN4=7; //Connect on  Pin 7
 
void setup() {
 pinMode(ENA,OUTPUT);
 pinMode(ENB,OUTPUT);
 pinMode(IN1,OUTPUT);
 pinMode(IN2,OUTPUT);
 pinMode(IN3,OUTPUT);
 pinMode(IN4,OUTPUT);
 digitalWrite(ENA,HIGH);// Activate motor A
 digitalWrite(ENB,HIGH);// Activatemotor B
}
void loop(){
 
 digitalWrite(IN1,LOW);
 digitalWrite(IN2,HIGH);
 digitalWrite(IN3,HIGH);
 digitalWrite(IN4,LOW);
 delay(1000);
 digitalWrite(IN1,LOW);
 digitalWrite(IN2,HIGH);
 digitalWrite(IN3,LOW);
 digitalWrite(IN4,HIGH);
 delay(1000);
 digitalWrite(IN1,HIGH);
 digitalWrite(IN2,LOW);
 digitalWrite(IN3,LOW);
 digitalWrite(IN4,HIGH);
 delay(1000);
 digitalWrite(IN1,HIGH);
 digitalWrite(IN2,LOW);
 digitalWrite(IN3,HIGH);
 digitalWrite(IN4,LOW);
 delay(1000);
}

For more details Click Here