Recently I have been putting together the electronics for the tank project. I could have kept it very simple and directly driven the DC motors from the Arduino, but that only allows for on and off and limits voltage as well as possibly frying the board. Instead i am using a L289N H bridge motor controller, which will allow me to run both track motors forward and backward and to vary the speed of the motor using pulse width modulation (PWM).
It took a little back and forth with wiring the first motor until I realised that as well as the power input for the motor, you need separate 5v supply to power the logic circuit. Once I had that sorted I modified my Arduino code and wired up motor number 2.
Surprisingly only one motor was running, the last one set in the Arduino code. Puzzled, i tried swapping variable orders to change the pins and diagnose the issue. Splitting the code to set motor 1 and then motor 2 with 10ms delay between them I hit on what appears to be the issue, with slightly slower response from the hardware than the code, the delay allowed both motors to start.
After a few seconds I found that the circuit needs more power as the tracks slowed to a halt. I was testing with a 9v battery, but as the L289N board can take up to 35v i have plenty of room yet. I need to source a larger battery pack before I go further, so this part of the project is parked again for now. In the meantime I can look at how I am going to control the tank.
![]() |
| There is some method in this madness |

Comments
Post a Comment