Why doesn't the L298N motor driver module work?

Thread Starter

Temeraire

Joined Feb 26, 2019
23
Hello, i have a little 12v dc motor from a drilling machine, an L298N motor driver modul, 9v battery and an arduino uno.
I tried various basic example projects,. but none of it seems like working. Lets talk about this one for now: https://www.instructables.com/id/L298-DC-Motor-Driver-DemosTutorial/. I wire everything as on the site, start the arduino code, connect the battery, and then the motor driver's onboard led lights up, but the motor dont want to rotate, just takes a tiny little step everytime it has to do something (the tiny little step is almost none, but i can feel a little vibration if i hold the motor in my hand)
I don't think the wiring would be the problem. The motor works fine too if i attach it directly to the 9v battery. I have allready triedd an other arduino uno, and other sites' basic example programs too.

What could be the problem? How can i tell if i f***ed something up accidentally on the motor driver modul while wiring?

Here is the code:
C:
//Setup Motor Pins

#define in1 3 //We are not using PWM for this demo.
#define in2 4
// in1 and in2 are the pins on the L298 drive board,
// 3 and 4 are the pins on the Arduino board.

void setup() {
  //set the pins for output
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
//set the pins low - this will keep the motor from moving.
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
}

void loop() {

  //set the pins low - this will keep the motor from moving.
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);

  //Spin Motor in one direction
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  delay(10000); //let it spin for about 10 seconds

  //Stop the motor
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);

  //Spin Motor in the other direction
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  delay(1000); //let it spin for about 10 seconds

}
Mod edit: code tags
 

Attachments

Last edited by a moderator:

sghioto

Joined Dec 31, 2017
2,395
I would verify the operation of the L298 module before connecting the Arduino.
Use the inputs on the module and connect to the appropriate voltages to test.
SG
 
Last edited:

AlbertHall

Joined Jun 4, 2014
11,524
1. What is the voltage of the battery when connected directly to the motor? It must be above 4.5V for correct operation of the L298.

2. You will lose perhaps 2.5V across the L298. Maybe there isn't enough voltage left to run the motor. Can you measure the voltage across the motor when it powered from the L298?
 

Thread Starter

Temeraire

Joined Feb 26, 2019
23
1. What is the voltage of the battery when connected directly to the motor? It must be above 4.5V for correct operation of the L298.

2. You will lose perhaps 2.5V across the L298. Maybe there isn't enough voltage left to run the motor. Can you measure the voltage across the motor when it powered from the L298?
You were right. While the program is running i can measure just 0.12-0.13V between the motor's + and - sides (the program is switching the direction of the rotation, and i can measure first 0,12V then -0,12V so it switches really). The battery is on full, i measured it too. What could cause this huge drop? I read it too that there is a 2-3V drop through the motor driver modul, but this is madness. I locked the screws well too.
 

Yaakov

Joined Jan 27, 2019
3,565
You were right. While the program is running i can measure just 0.12-0.13V between the motor's + and - sides (the program is switching the direction of the rotation, and i can measure first 0,12V then -0,12V so it switches really). The battery is on full, i measured it too. What could cause this huge drop? I read it too that there is a 2-3V drop through the motor driver modul, but this is madness. I locked the screws well too.
9V batteries have very poor current performance. It is just being pulled down by the load. If you have no other supply, you could try using more than on 9V battery in parallel, not series to increase the current capacity.
 
The stepping motor is to connect the four output terminals to the four motor wires of the motor.

Equivalent to L298N can drive two dc motor or a stepper motor.

The function of the optocoupler is to isolate the signal, so that L298N will not immediately feed back to the MCU if there is a problem, and the MCU will be burnt out.

The four-way input signal means that the high and low levels of the dc motor cause it to change direction, and the stepper motor has a timing table.

PWM is used in dc motor speed, stepping motor is not required, is based on the frequency of MCU positive contrast speed.
 

Thread Starter

Temeraire

Joined Feb 26, 2019
23
9V batteries have very poor current performance. It is just being pulled down by the load. If you have no other supply, you could try using more than on 9V battery in parallel, not series to increase the current capacity.
I tried it with 6 AA batteries and the motor works fine! Thanks for the idea.
 
Top