bgw
Posts: 11
Joined: Fri Jun 01, 2018 4:29 am

Motor Driver Not Working

Sat Jun 16, 2018 4:07 am

I'm having a problem getting my motor driver board working to run a basic motor. I'm new to this so I'm wondering what I'm doing wrong.

The driver I'm using is located here. There is a wiring diagram included in the link:

https://www.pololu.com/product/2990

And here is a mock up of my current wiring. I am assuming that the logic power can be provided by the RPi 3.3v pin. I'm not using the two bottom points on the driver board, as I don't think they're necessary for my purposes.
Webp.net-compress-image.jpg
Webp.net-compress-image.jpg (152.93 KiB) Viewed 353 times
I picked up a multimeter just to make sure my pins are outputting correct power, but that seems to be the case. I'm wondering if I'm just missing some fundamental piece in wiring up the circuitry.

My code is here:

Code: Select all

#!/usr/bin/env python
import RPi.GPIO as GPIO
import time

MotorPin_A	= 16
MotorPin_B	= 18

speed 		= 50
pwm_B		= 0

def motorStop():
    GPIO.output(MotorPin_A, GPIO.HIGH)
    GPIO.output(MotorPin_B, GPIO.LOW)

def setup():
    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(MotorPin_A, GPIO.OUT)
    GPIO.setup(MotorPin_B, GPIO.OUT)
    motorStop()
  #  global pwm_B
  #  pwm_B = GPIO.PWM(MotorPin_B, 2000)

def motor():
  #  global pwm_B
    GPIO.output(MotorPin_A, GPIO.HIGH)
    GPIO.output(MotorPin_B, GPIO.LOW)
    time.sleep(3)
    GPIO.output(MotorPin_A, GPIO.LOW)
    GPIO.output(MotorPin_B, GPIO.HIGH)
    time.sleep(3)
  #  pwm_B.start(0)
  #  pwm_B.ChangeDutyCycle(50)
  #  time.sleep(10)

def loop():
    while True:
        motor()

def destroy():
    motorStop()
    GPIO.cleanup()

if __name__ == '__main__':
    setup()
    try:
        loop()
    except KeyboardInterrupt:
        destroy()
To be honest, my driver board is just resting on the breadboard pins, not soldered. So I suppose it's possible I'm just not making a necessary connection. But I wanted to make sure my wiring is not flawed first. Any expert opinions out there?

(My driver board was not available in the diagramming software, so I combined a couple that looked close. Assume the board diagrammed is the board in the pololu link.)

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

Re: Motor Driver Not Working

Sat Jun 16, 2018 4:17 am

Please add a photo of the connections between the Pi and the motor (including the motor driver board).

bgw
Posts: 11
Joined: Fri Jun 01, 2018 4:29 am

Re: Motor Driver Not Working

Sat Jun 16, 2018 5:09 am

Webp.net-compress-image (1).jpg
Webp.net-compress-image (1).jpg (78.86 KiB) Viewed 338 times
This is the current wiring. Note: the board is inverted (upside down) from the diagram to display the nodes available. So the wires are going to the opposite side of the board than what I diagrammed. Let me know if you need a different angle.

User avatar
rpdom
Posts: 12748
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Motor Driver Not Working

Sat Jun 16, 2018 5:23 am

bgw wrote:
Sat Jun 16, 2018 4:07 am
To be honest, my driver board is just resting on the breadboard pins, not soldered. So I suppose it's possible I'm just not making a necessary connection.
Your wiring looks right in the diagram. Do you mean you haven't yet soldered on the header pins supplied with the driver board? In that case it is very likely that you do have a bad connection.

bgw
Posts: 11
Joined: Fri Jun 01, 2018 4:29 am

Re: Motor Driver Not Working

Sat Jun 16, 2018 6:02 am

Correct. The board is just resting on the pins sticking out from the breadboard. It is entirely possible one of the pins is not making the connection. I was just hoping to test this setup to make sure I was wiring correctly.

I wanted to make sure that I wasn't missing something obvious in the wiring, since I'm new to this. If this setup is what a more experienced person would do, then I have to assume it is a bad connection or bad board.

I can definitely (learn how to and then) solder the pins in place. I just wanted to make sure I wasn't missing something obvious since I've never done this before.

Edit: Time to buy a soldering iron!!

User avatar
DougieLawson
Posts: 33620
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Motor Driver Not Working

Sat Jun 16, 2018 9:33 am

bgw wrote:
Sat Jun 16, 2018 6:02 am
Edit: Time to buy a soldering iron!!
Get a temperature controlled iron. Get lead based solder if you can, it's easier to use than lead-free. (It's OK to use leaded solder unless you're selling something as a commercial product). Get some rosin impregnated solder wick so you can take solder off if you make a mistake.

https://mightyohm.com/files/soldercomic ... mic_EN.pdf
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

bgw
Posts: 11
Joined: Fri Jun 01, 2018 4:29 am

Re: Motor Driver Not Working

Sat Jun 16, 2018 10:55 pm

Thanks for the tips! Driver board has been soldered to the headers and I can confirm that the motor is running in both directions now according to the code. Even threw in a little PWM for good measure. Now I just need to think of a practical purpose for putting it all together. Thanks for the help! :D

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 13 guests