Problem with powering motors

So, I tried powering two motors with the L298N motor driver and an Arduino MKR WiFi 1010 and I used a program that turns the motors on for 1 second, and off for one second etc.
But when I power up the Arduino to run the program, the motors do not turn off.
I tested it and it is very confusing, the motors and driver work, and the program works with leds, but not motors. Also, the program works if you only use one motor, but not two.
Please let me know if I am doing anything wrong. Here is some info about the motors and driver: the driver works and has worked with the Arduino before. The motors are nine volts and the hole thing is grounded properly.

I am new to Arduino so again thanks if you can help.

Please read and follow this topic: How to get the best out of this forum - Using Arduino / Project Guidance - Arduino Forum

Your post lacks all information needed...

No Schematics.
No code.

How do You suppose any helper will give You anything but useless guesses?

1 Like

Always use a separate power supply for motors and servos, capable of supplying the total stall current (usually 5-10X the free running current).

Don't forget to connect all the grounds.

Hi, @btrahan

How much programming experience do you have?

Please supply the information asked by @Railroader in post#2.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

1 Like

Sounds like a power supply issue with your power supply not being able to supply enough current needed.

Alternatively it could be that you have no interference suppression in the motors and the interference from the motors is resetting your Arduino.

It could be very well both issues.

But this is just a wild guess given the lack of a schematic and code. Note posting the code by itself is insufficient, we need to see both.

void setup() {
  // put your setup code here, to run once:
  pinMode(7,OUTPUT);
  pinMode(6,OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(7,HIGH);
  digitalWrite(6,HIGH);
  delay(1000);
  digitalWrite(7,LOW);
  digitalWrite(6,LOW);
  delay(1000);

}

That was the code. Where is the other needed information?

If the wiring is correct that code would not turn the motors on.
The two input to the motor drive chip have to be different logic levels to turn the motors on and the same level to turn the motors off.

So we really need to see your schematic.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.