Go Down

Topic: [SOLVED] My robotic car of two motors is not working with L298N (Read 675 times) previous topic - next topic

aberope

Hello everybody,

I'm building a robotic car of those who are sold in a lot of places (just search on google: "robot chasis") and I'm not going to tell you the whole story because the problem is trying to make the motors move... but if you want to know how I am making it remote controlled with joysticks and controlling turnings with MPU-6050 I can tell you a bit with code (I think the part of code it's okay for me, and I've learn a lot googling).

So, I bought that L298N in amazon and I found that pretty pdf by googling...

So, as said in the pdf I removed all jumpers because I want to control the speed of each motor with pulses and also I'm sourcing the L298N module with a LiPo of 4S that gives a voltage upper than 12V.
I think I did well and then the 5V regulator is not working and then won't burn but something in my mind is telling me that also the module is not working by some reason because I removed that jumper, but I'm not sure and as I don't want to break anything I'm asking here.

The Arduino is Leonardo and is powered by a jack connector directly with and switch to the LiPo and the GND and 12V entries of the L298N are connected to the battery also, so GND is shared between the uC and the motor driver...

I connected to the Leonardo first and didn't work, then tested with Arduino UNO and also didn't worked so I guess is not a problem in the microcontroller, maybe I'm avoiding to connect something, but I think GND is shared, but also I used a wire to connect GND on the Leonardo with the GND of the L298N and nothing is moving... I still thinking maybe the jumper of the 5V regulator is maybe making it to don't work or maybe I need to give a 5V power by Arduino to the driver... it's a new idea I'm not going to try now until an answer to avoid breaking anything, It cost more than 7€ and I don't want to make extrange experiments because I'm just a hobbist, but maybe is that the problem (I repeat, I don't know why it doesn't work).

So, after of that description (hoping it to be clear, please ask for more information if you need) I put the code I'm using to be more clear:

Code: [Select]
#define LEFT_MOTOR_PWM 9
#define RIGHT_MOTOR_PWM 10
#define LEFT_MOTOR_IN3 8
#define LEFT_MOTOR_IN4 7
#define RIGHT_MOTOR_IN1 13
#define RIGHT_MOTOR_IN2 12

void setup() {
  // put your setup code here, to run once:
  pinMode(LEFT_MOTOR_IN3, OUTPUT);
  pinMode(LEFT_MOTOR_IN4, OUTPUT);
  pinMode(RIGHT_MOTOR_IN1, OUTPUT);
  pinMode(RIGHT_MOTOR_IN2, OUTPUT);
  pinMode(LEFT_MOTOR_PWM, OUTPUT);
  pinMode(RIGHT_MOTOR_PWM, OUTPUT);

  digitalWrite(LEFT_MOTOR_IN3, HIGH);
  digitalWrite(LEFT_MOTOR_IN4, LOW);
  digitalWrite(RIGHT_MOTOR_IN1, HIGH);
  digitalWrite(RIGHT_MOTOR_IN2, LOW);
  analogWrite(LEFT_MOTOR_PWM, 20);
  analogWrite(RIGHT_MOTOR_PWM, 20);
}

void backwards() {
}

void forwards() {
}

void loop() {
}


That's for the latest test with Arduino UNO using PWM pins with same base frequency without modiying anything and the motors are not moving. Now the value of the
Code: [Select]
analogWrite is 20 (very low) but because I was doing it by security to prevent the car going fast when wiring one arduino over the other, without screws on the car (hoping hearing some noise if not movement) but also without 100 were not moving. Seems like the L298N is dead.

Please, help me to finish this project as I want it to play with a kid in my town on the park, I used to test my robots on the park and one kid was hallucinated with the latest project and now I built an Remote Controlled car and she saw me playing on the parking in the same building and his mother told me to play with them after school and the true is that I bought this module which never had before with that amount of jumpers, and never had that problem with L298N. Seems this is the most used board as it has protection for the on board regulator and maybe needs powering for the L298N... I'm not sure.

Thanks in advance, and please don't hesitate in asking about information of the project, I'll try to do my best.

Hope you can help me.


aberope

"To avoid damage the voltage stabilizing chip, please use an external 5V logic supply when using more than 12V driving voltage"

I've read that now on the amazon product site, so sorry by using this forum for nothing, maybe just connecting the 5V of the Leonardo to the 5V of the L298N will work, I'm going to test right now and then mark as solved (another thing I don't know how to do but I'll try to learn) and just if you want to know here is more information and I'm open to tell you information about the project.

So, at the moment thanks for the free forum and thanks for watching, but sorry again... I need to write that post to find the answer I hope to be understandable. I'm marking SOLVED if it works.

Go Up