After reading through The Makerspace Workbench (which I mostly enjoyed), I thought the Arduino-controlled car project looked like a good introduction to programming and electronics for my two sons. The project involves an Arduino Uno (which I replaced with a Sparkfun Pro Micro clone), a 3D printed chassis, a Tamiya 70168 double gearbox kit, a 9-volt battery, a marble, and a L293D to control the motors. The instructions in the book could be better, but with a bit of Googling, I was able to learn enough to get the project together.
Since the project calls for a 9V battery, and the motors want 3-6V, I added a 5V regulator (L7805CV). I also added capacitors as in here.
The problem I'm having is that the car just pauses silently for a couple of seconds after a second or so of operation.
I'm using PWM to the L293D's enable pins to vary the speed of each motor, making the car do a sort of random walk. The useful PWM range on the enable pins seems to be 128 to 255 (2.5V to 5V). My code just picks a random direction (forward or backward) and an enable value (from 128 to 255), uses that to run the wheels for half a second, coasts to a stop for a quarter of a second, then repeats. Simple. But it runs for a couple of cycles, then sits silently for a couple of seconds, then continues. When programming the Arduino and with USB power available, the motors get power, but seemingly less as the motors turn more slowly, it only rarely pauses when run in this way.
Could this pausing problem be the current limiter on the L293D causing trouble?
I'm also wondering if "feedback" from the motors is causing issues. The pausing problem didn't seem to be an issue when my sketch would run the wheels in whatever direction they needed to go for a couple of seconds at a time. But I thought the capacitors would help with that.
I could be wrong, but the problem seemed to start when I began playing with sending a PWM signal into the L293D's enable pins. It's hard to say though, as we started running the motors in more interesting ways at the same time.
Another problem is that the little car eats 9V batteries in a hurry. If we get 10 minutes of runtime, I would be surprised. And the pausing problem seems to get worse as the batteries die.
My boys and I have had fun with this project, enough that we're looking for something similar but better thought out, although cheap is good. Any recommendations are welcome. We were looking closely at this 4WD chassis, but are hesitant to push further as we, clearly, have a lot to learn.