rickseiden
Posts: 411
Joined: Thu Aug 02, 2012 12:21 pm
Location: Buffalo, NY, USA

Motor won't reverse

Sun Apr 14, 2013 6:29 pm

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.
There are 10 types of people in this world. Those that understand binary, and those that don't.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Motor won't reverse

Sun Apr 14, 2013 7:00 pm

Try without the buffers just to see if it makes any difference? (It will eliminate a variable)
Alex Eames RasPi.TV, RasP.iO

rickseiden
Posts: 411
Joined: Thu Aug 02, 2012 12:21 pm
Location: Buffalo, NY, USA

Re: Motor won't reverse

Sun Apr 14, 2013 9:06 pm

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
There are 10 types of people in this world. Those that understand binary, and those that don't.

domesday
Posts: 258
Joined: Fri Oct 21, 2011 5:53 pm
Location: UK

Re: Motor won't reverse

Sun Apr 14, 2013 10:52 pm

some motors are not reversible, if you reverse the polarity of the leads to the motor does the opposite happen ?

User avatar
joan
Posts: 14765
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Motor won't reverse

Sun Apr 14, 2013 11:12 pm

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.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Motor won't reverse

Mon Apr 15, 2013 7:23 am

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:
Alex Eames RasPi.TV, RasP.iO

rickseiden
Posts: 411
Joined: Thu Aug 02, 2012 12:21 pm
Location: Buffalo, NY, USA

Re: Motor won't reverse

Mon Apr 15, 2013 9:59 pm

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.
There are 10 types of people in this world. Those that understand binary, and those that don't.

User avatar
silverfox0786
Posts: 215
Joined: Mon Feb 04, 2013 10:32 pm
Location: Slough, UK
Contact: Website

Re: Motor won't reverse

Mon Apr 15, 2013 11:00 pm

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

User avatar
Gert van Loo
Posts: 2487
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Motor won't reverse

Tue Apr 16, 2013 6:41 am

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.

Return to “HATs and other add-ons”