Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to connect DC motor to Raspberry Pi?

  1. Oct 11, 2014 #1
    I have recently taken apart a few old DVD drives to see if there were any stepper motors available for a Raspberry Pi project I am currently working on. When I opened one of the older drives I found a motor which was unlike the others as it only seemed to have two wires going directly to the coils. Is this a standard DC motor?

    If this is a standard DC motor, how would I connect this to the RPi ports? Is there a procedure for this for example, checking coil resistance and then determining resistor sizes required to be in series with the motor or can I just directly connect the red wire to the positive output of the RPi and the black wire to ground?

    Please see the following links to images for this:



    I am new to working with motors and have very little experience with electronics therefore, would greatly appreciate some help with this. Thanks.
  2. jcsd
  3. Oct 12, 2014 #2


    User Avatar

    Staff: Mentor

    Hi sur4j. snJL9SLm.gif

    Have you tried a google search? That is sure to turn up plenty of material for you to examine while you are waiting for someone here who's familiar with what you are planning.

    Good luck.
  4. Jul 12, 2016 #3
    First you need to Learn about Raspberry Pi. If you simply connect the DC motor to the RPi's power and GND pin, it will only rotate in one direction at particular speed, and you cant control it, and hence no use of RPi, you can simply do this by connecting DC motor to 9v battery.
    But if you want to control its speed and direction then Rpi comes into picture, and it can be easily done by using a Python Script. There are plenty of tutorial on it, I am referring one here, which have a demo Video DC motor with Raspberry Pi. It basically uses PWM and duty cycle concept to control its speed.
    But if you are new with Raspberry please go through this officcial raspberry pi Quick start guide where you will learn to install and configure OS on Pi board
    Last edited: Jul 12, 2016
  5. Jul 12, 2016 #4


    User Avatar
    Gold Member


    above is a dc motor driver for the raspberry pi. it can drive up to 16 motors using pwm.


    do not every drive power electronics directly off the raspberry pi pins. You should provide the power from a 3/5 V rail created by the external source (even if its the same source powering the pi). Then use a switch (bjt, mosftet, etc) to switch the power supply.

    There are likely other shields/hats for the pi that might be able to help you as well.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted