Page 1 of 1

Motor won't reverse

Posted: Sun Apr 14, 2013 6:29 pm
by rickseiden
Hello all,

I have hooked up a DC motor to the Gertboard, and run the motor test program, and the motor only turns in one direction. I also run the following code from the command line:

Code: Select all

sudo python

>>> import RPi.GPIO as g
>>> g.setmode(g.BCM)
>>> g.setup(18,g.OUT)
>>> g.setup(17,g.OUT)
>>> g.output(18,g.HIGH)
>>> g.otuput(17,g.LOW)
And the motor spins one way (REALLY FAST). Then I do:

Code: Select all

>>> g.output(18,g.LOW)
>>> g.output(17,g.HIGH)
and I expect the motor to stop when I set 18 to low, which it does, and then start up in the opposite direction when I set 17 to high. But nothing happens. The motor won't reverse.

I've reversed the leads on the connection to the motor to see if it will turn in the reverse direction at all, and it does turn "backwards" just fine. It just won't turn both ways "on command."

A bit about my setup:

-RPi to the Gertboard
-GPIO 18 to Buffer 1
-Buffer 1 to Motor A
-GPIO 17 to Buffer 2
-Buffer 2 to Motor B
-12v connected between Mot+ and Mot-
-DC Motor connected between MOTA and MOTB connectors

Any ideas what I'm doing wrong?

Thanks

PS:

I've tried some PWM stuff too, but with no better success:

Code: Select all

>>> p=g.PWM(18,100)
>>> p.start(10)
Motor starts turning slowly

Code: Select all

>>> p.stop()
>>> p2=g.PWM(17,100)
>>> p2.start(10)
Nothing.

Re: Motor won't reverse

Posted: Sun Apr 14, 2013 7:00 pm
by alexeames
Try without the buffers just to see if it makes any difference? (It will eliminate a variable)

Re: Motor won't reverse

Posted: Sun Apr 14, 2013 9:06 pm
by rickseiden
alexeames wrote:Try without the buffers just to see if it makes any difference? (It will eliminate a variable)
I actually didn't use the buffers at first, but added them in so I could see the status of the pins on the LEDs. There was no difference with our without the buffers. Should have mentioned that.

Thanks
Rick

Re: Motor won't reverse

Posted: Sun Apr 14, 2013 10:52 pm
by domesday
some motors are not reversible, if you reverse the polarity of the leads to the motor does the opposite happen ?

Re: Motor won't reverse

Posted: Sun Apr 14, 2013 11:12 pm
by joan
domesday wrote:some motors are not reversible, if you reverse the polarity of the leads to the motor does the opposite happen ?
Apparently that was tried and the motor did go in reverse.

Re: Motor won't reverse

Posted: Mon Apr 15, 2013 7:23 am
by alexeames
This may seem a bit off base, but I'm struggling for ideas here Rick.
Have you tried changing the strap wires for different ones? I wonder if there's a marginal connection somewhere? (I know - clutching at straws) :lol:

Re: Motor won't reverse

Posted: Mon Apr 15, 2013 9:59 pm
by rickseiden
alexeames wrote:This may seem a bit off base, but I'm struggling for ideas here Rick.
Have you tried changing the strap wires for different ones? I wonder if there's a marginal connection somewhere? (I know - clutching at straws) :lol:
Well, I tried a different motor today, and got the same results. But here's something interesting. I was switching the cables around, and noticed that I can leave MOTB near the GPIO ports unconnected, and the motor still turns. I can send high to both MOTA and MOTB, and the motor still turns. I checked my soldering, and all looks good. I wonder if I might have a bad hBridge chip.

Re: Motor won't reverse

Posted: Mon Apr 15, 2013 11:00 pm
by silverfox0786
possible MOTB is faulty

either a faulty screw connector on MOTB

or faulty motor IC

Remember MOTA high and MOTB Low is one direction
MOTA low and MOT B high is the reverse of that

MOTA low and MOT B low is stop
and same if both are HIGH

Re: Motor won't reverse

Posted: Tue Apr 16, 2013 6:41 am
by Gert van Loo
Well, I tried a different motor today, and got the same results. But here's something interesting. I was switching the cables around, and noticed that I can leave MOTB near the GPIO ports unconnected, and the motor still turns.
That is very likely. CMOS inputs are so high impedance that they respond even if not connected.
I have the exact same behavior with my motor controller.