0

I've got a circuit motor which has one end attached to a wire, and the other end is attached to another wire cut in half with a resistor in between the two ends. I've carefully calibrated what resistor to use so that my motor, which works best with around 1.5V, can be supplied by GPIO's 3.3V output when connected to one currently loose end. The other end will be grounded. When I place a 1.5V battery to complete the circuit, the wheel spins (slower than at top performance, since I've placed a resistor to cut down the voltage given to the motor). However, when I finish the circuit off with the GPIO, nothing happens. I doubt my GPIO isn't working properly, since I've already connected it to an LED in a breadboard and made the light flash.
Here's the code that I'm using:

from RPi import GPIO
import time

def __main__():
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(4, GPIO.OUT)
    GPIO.output(4, True)
    print "Voltage On"
    raw_input()
    GPIO.output(4, False)

if __name__=="__main__":
    __main__()

I have the GPIO end connected to GPIO4, as in this diagram. What could be wrong with my circuit?

1 Answer 1

1

The GPIO can output only 16mA (50mA total across all the GPIO pins) which is likely not enough to make your motor turn. Furthermore, the resistor will also limit the current through the motor, so the motor is not even getting the 16mA it could possibly get. You will need to use a transistor and a separate power source to make this setup work. The separate power source could be your 1.5V battery, or the 5V from the GPIO header converted down to 1.5V using a buck converter.

2
  • Would probably need a fly-back diode as well to protect the transitor I guess.
    – joan
    Commented Sep 10, 2015 at 14:14
  • @joan yes, or a simple motor driver board like the DRV8835. My answer was not intended to be a full schematic of the solution, but rather pointers to what to look for. This question has been answered hundreds of times on this (and other) sites already.
    – Phil B.
    Commented Sep 10, 2015 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.