So it should spin the motor for 1s, then wait for 5s and repeat. This only happens once or twice and then Arduino either freezes or restarts and the motor stays on.
Here's the schematic:
I use a separate power supply for the driver board, connected GND of Arduino and the driver, and also have a 100nF capacitor connected. These are the first most obvious issues I found on other forums, so this shouldn't be a problem.
The external power adapter is 5V 1A, and the motor current draw shouldn't exceed 500mA. Yet, it still doesn't work. Could anyone point me in the right direction as to where to look?
The motor power supply is inadequate. The free running current draw for the tank motor is specified as 200 mA, and the start/stall current (briefly drawn every time it starts moving) can be more than 10X that, or 2 Amperes.
A modern MOSFET motor driver would be a much better choice than the very inefficient L9110. Pololu has the best selection.
hmm, so are you saying the problem could be with the motor driver? But how can it affect the Arduino board (being restarted), if they both have their own power supply? Just trying to understand what's going on there
There IS a problem with both the motor power supply and the motor driver.
I don't know why that problem should cause the Arduino to restart, though. If you have long, looping wires, radiated electrical noise from the motors and wiring could be a problem.
No, that ancient dinosaur has an even higher internal voltage drop (up to 4V wasted as heat). Use a modern motor driver.
The wiring is a mess, and the photo shows that your schematic is not correct, as not all the parts are shown. So, no one can guess what is causing the reboots.
haha do you have a specific driver in mind that would work in this case?
regarding the wiring and the schematic, I know it's a mess, heh. The code that I posted here is what's in Arduino now, I just didn't remove the rest of the sensors from the board, I'll try to remove everything, and only run it with the motors, but I think I'll need a new driver anyway, after what you said.
edit: the reboots only started happening when I started implementing the motors part, other sensors and Bluetooth are working as expected
If you disconnect the motors and run the code, does it reset?
Otherwise;
Remove all the other peripherals and just have what you posted in post #1 connected.
NO other gear.
I just connected the TB6612FNG driver board and the motors are spinning I'm using an external power supply but it works now.
And I can confirm that those Arduino restarts were caused by drawing too much current by the motors.