Drive Problems
I finally did solder most of it up and, initially, found only a couple of minor issues. One was that my screw terminals for my motor wires did not fit. Which is frustrating since that footprint was also wrong in my initial version. Now instead of two close together the pin holes are too far apart. Anyway, not a big deal as I can just solder the wires onto the board directly.
The sonar module in the front of the tank (right side of the above image) was just hot-glued into some crude cut-outs and ended up pointing slightly downward such that it was reflecting against the ground. The led strip is just thrown into the tank (This strip comes with the tank and has a mounting position on the top chassis. I wanted it in my tank for debugging purposes: I am able to light two of the LEDs and give some visual feedback as to what is going on with the microcontroller). Anyway, aside from some minor issues, everything looks pretty tidy, right? I was especially happy that the FTDI programmer worked so well.
Well, after an initial spin of the motors (which, actually, didn't happen right away as there was an embarrassingly long elapse of time before I remembered that I had added a motor enable pin), I wanted to test them in actual working conditions but first I wanted to figure out a better mount for the front sonar, so that my tank wouldn't run into stuff. I also kinda guessed that instantly reversing motors could be bad for them (Though I wasn't able to find a ton of information about this online. My query to /r/electronics got sent to the spam folder.). So I spent a few hours programming in 100 millisecond delay for motor reversal.
When all that was done I flipped the on switch and, with heady anticipation, set the tank down on the floor. And: it did not work. Or rather, it kinda sorta worked but not really well. The tank could go fine in either direction but, once it started to turn, the inside track motor would slow and then stall which would cause the other track motor to have to work even harder and eventually that motor would stall, also. More often than not, a stall would cause the microcontroller to reset or, worse, get stuck in some undefined state.
The crossed motor traces thing probably doesn't matter so much. But it's totally unnecessary: like, I can just update which pin drives which side of the motor in software. There's no need to stick to the schematic in this way.
A really small ground trace, the size of a signal trace, is a much larger issue. And, since I screwed this up in my first design, I don't really have a good explanation for why it still exists in my second.
It's a rather pitiful thermal relief area (I ran out of room!) and the H-bridge got hot to the touch. Which I guess means either that my thermal relief area is inadequate or that I'm driving the chip past its limits. (Or both.)
And, then, pretty soon, I had ended up with this:
Well that got messy and terrible really fast. Not pictured is the part where I tore the motors out of the gearbox and replaced them with some motors I had purchased from Adafruit. At that point, the motors weren't turning at all and I put the original motors back in and they sorta kinda worked again but the gearbox sounded like a coffee grinder. I guess I reassembled it incorrectly or screwed-up the plastic gears when I switched them back and forth between motors.
So, anyway, with the bodged wires, the tank works better but it still stalls when turning.
Just to make sure I wasn't crazy, I pulled out the one RC tank that I have not yet torn apart and drove it around. It did 360s with aplomb. Just drove around everywhere with no trouble at all. Even more maddening, the wires this tank uses on it's motors are really tiny! Like, it doesn't seem like I am dealing with super high currents here.
More maddening still, I had built this circuit with a breadboard and I don't remember this being an issue (Now, of course, I'm questioning whether my prototype spent enough time trying to spin in circles. Also I suppose that I had a separate power supply for my Arduino.).
But the fact that the Adafruit motors failed did bring to mind one interesting point. I had been more or less relying on their specs, (https://www.adafruit.com/product/711: 250 mA loaded current, 500 mA stall current) to guide my PCB design and my selection of motor-driver IC. I mean: the motors look more or less the same (and can be interchanged in the gearbox). But the Adafruit motors could not turn the tank treads (or even the bare gearbox) which means it's likely that the stock motors are drawing more current, maybe much more.
This failure was hugely frustrating and the sort of hitch that makes me want to just throw everything in a box and forget about it, especially when I couldn't hack a working version together and I couldn't explain why it was not working versus my earlier breadboard.
But there's always a way forward. Some things I am thinking about:
- I need to measure the actual current draw of the stock motor. Probably shoulda done that in the first place.
- I need to look at other motor driver options, besides the L293D. I ordered a couple of L293Bs from Digikey to play with. Another interesting-looking IC is the LMD18245T, though that particular chip requires at least 12 volts.
- I will of course need to fix the ground traces on my PCB. I also need to consider expanding the thermal relief area.
Some other things to consider:
- People always suggest a separate power supply for logic and motors. I really, really didn't want to do this. But I may have to concede that this is the only right approach. I think a big question is whether or not my microcontroller will reset/screw-up even when the motors aren't stalling. A separate question is whether it's even reasonable to expect the motors to not stall with normal robot operations, even when supplied with the proper current. I think it's fair to say that the tank is going to run into stuff, even after I refine the sonar ranging. The tank treads might be more apt to spin on a hard, flat surface, as opposed to carpet. I looked briefly into stall-sensing circuits but I would have to give up a controller pin, I think, in order to use one.
- I could just "give up" and use an off-the-shelf motor controller. I might still have power supply issues but they could be either to solve, at that point. Motor drivers can be had for as cheap as $5 and would (probably) fit in my chassis.
- I should probably go back and do a barebones test of an Arduino and a L293D on a breadboard with a single power supply.
Comments
Post a Comment