Dual Channel Motor Driver Module L298N H-Bridge up-to 2 Amp, 5~35VDC

  • Was  RM20.00 
  • RM15.00

  • Product Code: motor driver l298n
  • Availability: In Stock

This driver module is based on L298N H-bridge, a high current, high voltage dual full bridge driver. It can drive up to 2 DC motors up to 2Amp each, or drive one stepper motor or 2 solenoids.

The driver can control both motor RPM and direction of rotation. The RPM is controlled using PWM input to ENA or ENB pins, while of rotation direction is controlled by supplying high and low signal to EN1-EN2 for the first motor or EN3-EN4 for second motor. This Dual H-Bridge driver is capable of driving voltages up to 46V.

 

Features:

  • Driver: L298N Dual H Bridge DC Motor Driver
  • Power Supply: DC 5 V - 35 V
  • Peak current: 2 Amp each bridge
  • Operating current range: 0 ~ 36mA
  • Control signal input voltage range :
    • Low: -0.3V ≤ Vin ≤ 1.5V.
    • High: 2.3V ≤ Vin ≤ Vss.
  • Enable signal input voltage range :
    • Low: -0.3 ≤ Vin ≤ 1.5V (control signal is invalid).
    • High: 2.3V ≤ Vin ≤ Vss (control signal active).
  • Maximum power consumption: 20W (when the temperature T = 75 ℃).
  • Storage temperature: -25 ℃ ~ +130 ℃.
  • Size: 3.4cm x 4.3cm x 2.7cm

Others pin:

Enable A  &   Enable B 
DC motor enable jumper. Leave this in place when using a stepper motor. Connect to PWM output for DC motor speed controller.

Control Inputs
IN1 , IN2 , IN3 , IN4

 

Below is the circuit uses the power of the Arduino itself, and should be done without the 5V Enable Jumper on (Active 5V). We use Two 5V DC motors.

 

The second circuit below uses external power and Two 12V DC motors. In this case we need to put on the jumper to Active 5v:

Arduino Sketch for controlling two [DC Motor] with Motor Driver Module L298N

Test your module by codes below, which can be used for two circuits we've seen before.
The program turns motor A clockwise, then turn off that motor and turns the engine B in the same direction.
Then repeat this procedure in an anti-clockwise.

// Program: Control 2 DC motors using L298N H Bridge

// Definitions Arduino pins connected to input H Bridge
int IN1 = 4;
int IN2 = 5;
int speedPinA = 9; // Needs to be a PWM pin to be able to control motor speed

int IN3 = 6;
int IN4 = 7;
int speedPinB = 10; // Needs to be a PWM pin to be able to control motor speed

  
void setup()
{
 // Set the output pins
 pinMode(IN1, OUTPUT);
 pinMode(IN2, OUTPUT);
 pinMode(IN3, OUTPUT);
 pinMode(IN4, OUTPUT);
 pinMode(speedPinA,OUTPUT);
 pinMode(speedPinB,OUTPUT);
}
  
void loop()
{
 analogWrite(speedPinA, 255); // Sets speed variable via PWM
 analogWrite(speedPinB, 255); // Sets speed variable via PWM
 // Rotate the Motor A clockwise
 digitalWrite(IN1, HIGH);
 digitalWrite(IN2, LOW);
 delay(2000);
 // Motor A
 digitalWrite(IN1, HIGH);
 digitalWrite(IN2, HIGH);
 delay(500);
 
 // Rotate the Motor B clockwise
 digitalWrite(IN3, HIGH);
 digitalWrite(IN4, LOW);
 delay(2000);
 // Motor B
 digitalWrite(IN3, HIGH);
 digitalWrite(IN4, HIGH);
 delay(500);
 
 // Rotates the Motor A counter-clockwise
 digitalWrite(IN1, LOW);
 digitalWrite(IN2, HIGH);
 delay(2000);
 // Motor A
 digitalWrite(IN1, HIGH);
 digitalWrite(IN2, HIGH);
 delay(500);
 
 // Rotates the Motor B counter-clockwise
 digitalWrite(IN3, LOW);
 digitalWrite(IN4, HIGH);
 delay(2000);
 // Motor B
 digitalWrite(IN3, HIGH);
 digitalWrite(IN4, HIGH);
 delay(500);
}

 

 

Arduino controlling two [Stepper Motor] with Motor Driver Module L298N

You will need to determine the A+, A-, B+ and B- wires. With our example motor these are red, green, yellow and blue. Now let's get the wiring done. 

Connect the A+, A-, B+ and B- wires from the stepper motor to the module connections 1, 2, 13 and 14 respectively. Place the jumpers included with the L298N module over the pairs at module points 7 and 12. Then connect the power supply as required to points 4 (positive) and 5 (negative/GND).

Once again if your stepper motor's power supply is less than 12V, fit the jumper to the module at point 3 which gives you a neat 5V power supply for your Arduino. 

Next, connect L298N module pins IN1, IN2, IN3 and IN4 to Arduino digital pins D8, D9, D10 and D11 respectively. Finally, connect Arduino GND to point 5 on the module, and Arduino 5V to point 6 if sourcing 5V from the module.

Controlling the stepper motor from your sketches is very simple, thanks to the Stepper Arduino library included with the Arduino IDE as standard. 

To demonstrate your motor, simply load the stepper_oneRevolution sketch that is included with the Stepper library, for example:

Finally, check the value for 

	const int stepsPerRevolution = 200;


in the sketch and change the 200 to the number of steps per revolution for your stepper motor, and also the speed which is preset to 60 RPM in the following line:

	myStepper.setSpeed(60);


Now you can save and upload the sketch, which will send your stepper motor around one revolution, then back again. This is achieved with the function

	myStepper.step(stepsPerRevolution); // for clockwise
	myStepper.step(-stepsPerRevolution); // for anti-clockwise

Write a review

Note: HTML is not translated!
    Bad           Good

 

Related Products

Tags: Motor Driver, L298