Let's Make Robots!

H-Bridge only drives motor one direction:What am I missing?

(Perhaps I should preface this with the notation that NOTHING is working right today and I may just have gremlins.  That said...)

I purchased an old Armatron off of eBaby to use in my Diamond Mine Challenge project.  As you can see, it's a pretty straightforward setup.  Tore it apart, shimmed some gears and all the motors work fine (tested with 6v batteries in both directions) so I set it up on a pair of 298 shields and started getting weird behaviour: the motors only drive in one direction on the h-bridges (battery here is actually a 7.2v NiCad.)  Here's a sample of the code that should be in theory producing a "wave hello" motion in the wrist (give me enough credit to have the setup and wiring right.):


void loop(){
  digitalWrite (directionPinWrist1, HIGH);
  digitalWrite (directionPinWrist2, LOW);
  analogWrite (speedPinWrist, 255);
  delay (1000);

  digitalWrite (directionPinWrist1, LOW);
  digitalWrite (directionPinWrist2, HIGH);
  analogWrite (speedPinWrist, 255);
  delay (1000);

When run, all this loop does is drive the wrist "up" for 1 second, then pause 1 second, then drive it up and so on until it locks against its DOF limit.  Here's the fun thing-when I reverse the motor wire connections to the h-bridge, it drives them down for a second at a time then pauses and stops at the other extreme eventually.  I've tried this on both the "wrist" and "shoulder" mechanisms with the same results.  Are there just some motors that don't respond well to h-bridged current?  Any other ideas here?  I'd rather not build electromechanical h-bridges (but I do have enough relays if I have to-it's just a pain to do it and I'd have all these left over bridge boards...)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


   I've seen some odd things with the L298 and the power supplies.  As a debug step, I'd change the jumper back to accept 2 independent supplies.  Then provide a 5-6V to Vss on the drivers and an independent regulated 5V to the Arduino and driver boards' 5V ( common ground, of course ).  The parasitic logic supply from the motor Vss feels highly suspect to me.  

you already know that the metal part of the l298 (or whatever it is on your board) is connected to ground? maybe its touching something else of your circuit. just some guesses..

Probably there is more friction in one direction than the other. Could you try removing the motor from driving the wrist, by taking the motor or one of the cogs out?

I think I got it?  You live in Iowa right?  This is one of those "Children of the Corn" things.  You need to find some tourists and take them into the corn field to sacrifice to the scarecrow.  You do get tourists in Iowa right?  If not, I will try and ship you a few from Florida, we have plenty ...LOL.

The weirdest thing is that the wrist motor does run in both directions when powered off of the h-bridge-but I have to physically reverse the connections to the screw terminals to acheive the reversal.  Any other motor runs back and forth off of that sketch on the same hardware.  WHAT THE HELL MAN?

You all must think I'm making this up.  I've had no to drink in over a month, I swear!

Must I sacrifice a virgin microcontroller in a pillar of blue smoke to the God Electronicus to get the oracle to show me a vision here?

I'm not sure if your lovely graphics above is exactly as you've wired it Max as I'm sure you would have looped the 5V from the arduino and right board  to the left board wouldn't you?
Just it's missing in the artwork.

The 5v represented to the right of the Gnd screw terminals on the Hex units here (my custom additions to Fritzing, no less!) is a regulated 5v output from the power (battery) fed into the motor driver rather than power to be supplied from the Arduino 5v rail. I'm using one to power the Arduino at Vin below the Gnd rail. These units have the option to power the bridge logic internally or from a micro rail by selecting with a jumper. If I looped them wouldn't it be the equivalent of a parallel battery connection (more amp hours at the same voltage?) Or would a failure to do this explain the behaviors I'm seeing?

Ah ok. I thought when I saw the empty 5v terminal it couldn't be that easy. Might pay to see that your getting the 5v to the l298 chip still. Just in case there's something wrong with the regulator on the board or jumper setting.

Went around the horn with the multimeter.  When I put it on the Motor output terminals, it was just what you'd expect (4.8v across to -4.8v and back again.)  The heatsink makes it a little difficult to reach some of the pins on this chip but I saw a steady 5v into pin 4 (if I'm reading it right-this is a weird DIP.)  The motors are regular Mabuchi 3-6v hobby or equivalents from the 80s.  Here's a shot of the shoulder one exposed:

(You can't see it but there are stubber caps on them.)

If I would just get off my arse and learn what I'm doing with the logic analyzer/oscilloscope I might be able to elucidate the mystery further, but since I only paid $80 I for it it doesn't seem like the fire it was when I bought it.  (Shameful first world BS, I know, but I blame the cancer.  If I felt better and could put the bench time in more often I'd have learned the sh!t out of it by now.)

 that cap..  it that an  polarized type? with a positive and negative pole?  then that could be your problem.  there is  some  different between a "capacitor" and an " elco"