06 May 2010

One Step Forward, One Step Back

Tonight's goal was to get that motor driver board fired up and turn some motors. Well ... things didn't quite progress that far. But progress was made nonetheless.

The 298 driver board has six opto-isolated inputs, three for each H-bridge in the 298. First step was to tweak the arduino to operate three digital outputs, so at least the 298 board could be tested one half at a time. This was easy enough, just using digitalWrite() on pins 2, 3 and 4. Not having a lot of instrumentation, it would be hard to tell if the 298 board would even be getting any input, so before wiring to that, I connected pins 2, 3, and 4 each to a regular LED in series with 470 ohms to ground. This gave visible confirmation that the test sequence in the arduino was working correctly. The test sequence was just a cycle through all 8 combinations of the 3 bits to control half the 298, sitting about 1.25 seconds in each state, just about long enough to get stable readings on the DVM.

Next came the 12V smoke test on the 298 driver board, in isolation from the logic of course. The concern here was whether the board was wired up correctly. So I connected the return side of the driver to the battery, put the DVM across the battery to monitor that, and momentarily made contact to the positive battery terminal with the board's Vcc line. Open circuit this battery was showing 13.25V, a little low but not abnormally so for this kind of battery. A couple of quick taps with no exploding capacitors later, I noticed that with the driver board connected, the battery dropped to 10.5V. Not good. The driver board wasn't even driving anything, should be pulling maybe 50mA at most, and the battery should be good for 10 times that current.

So now for a reality check, I hooked the battery to my r/c plane starter motor and hit the switch. Absolutely nothing. This battery was on the charger all last week in preparation for this, and here it was, dead. Well, it was on the shelf for about four years before this last week. Then I noticed, amongst the other things printed on the battery, there at the bottom, "Replace every 3-5 years". Oh well, that's the step backwards. Did I mention my r/c plane starter? Yeah, it came with its own 12V sealed battery, about five times bigger than the one depicted last post. A quick spin of the starter motor confirmed *that* one was not dead. Back in business!

The size of the plane battery was a bit worrisome. If something shorted, this battery would make the event just that much more exciting. So, for a current limiter, I used that plane starter motor. It's practically a piece of wire, compared to the L298 driver setup, and it has a switch, and even if the 298 board totally shorted out, the most energy that would be involved would be no worse than that from hooking the starter to the battery directly and hitting the switch, which is the normal operation for those two things. OK, so the circuit under test is now L298 board return connected to battery (-), battery (+) to the starter-motor with integrated switch red clip, start motor black clip to L298 board +V line. DVM across the battery. Brief contacts with the starter switch resulted in (1) virtually non-existent droop on the battery voltage (2) a complete lack of the start motor spinning madly and (3) No Smoke. Time to connect the 298 and the arduino!

But wait - what to use for a load for the L298 board? The chassis with the motors is too big for the coffee table I have taken over for a lab bench. Instead of using a motor, I put two LEDs back to back, then a 2K-ohm in series with the LEDs, and put that across one of the H-bridge sections. Using two LEDs like this, each one protects the other from reverse voltage excursions. One is biased backwards, but only by the forward voltage drop of the one that's lit. This way it's easy to see which way the current is flowing. Using 2K-ohms with a nominal 12V and figuring 1.5V for diode drop would put about 5mA through the LEDs, just about right for easy visibility.

Fortunately the 298 driver was working according to the design, there were only a few moments of confidence-shaking loose breadboard wires (typical), and once the wonky wires were tamed I had confirmation from the LED setup that (1) code in the arduino was producing the test sequence, (2) the arduino was in fact driving the opto-isolator inputs hard enough, (3) the opto-isolator outputs were driving the L298N well enough, and (4) the L298 H-bridge was gating the motor-output leads to +12V and ground as controlled by the test sequence. Success! Well, with lights standing in for motors. For half the board at least. I didn't solder enough leads onto the 298 board last night to test the other section.

And there's tomorrow's plan: get the setup off the breadboard, get some nice soldering done and hook up actual motors. If I get that far, then cable up those archaic game paddles and maybe do some test driving. I mean, load testing. Yeah.

0 Comments:

Post a Comment

<< Home