Simple way to control 12V DC Motor using Raspberry Pi’s GPIO port and NPN transistor

I needed to control a DC motor from my Raspberry Pi’s GPIO port as part of my time-lapse dolly project. I had to be able to turn the motor on for approximately 150ms which would in turn move the dolly along by 3mm.

Parts

Simple way to control 12V DC Motor using Raspberry Pi’s GPIO port and NPN transistor.jpg

Circuit Diagram

  • The NPN transistor acts as a switch. It allows current to flow from the collector to emitter when a potential difference is applied the across base and emitter. See Wikipedia for more info on how they work.
  • The 270Ω resistor (R1) protects the Raspberry Pi’s GPIO port by ensuring that not too much current flows from the GPIO port.
  • The 10kΩ resistor (R2) helps pull the base back down in case there is some leakage. You may not require this one but add it if you see the motor turning very slowly.
  • The diode ensures that reverse current generated by the collapsing of the DC motor’s field when the motor is turned off does not damage the NPN transistor and GPIO port. Diodes only allow current to flow in one direction.
  • The 12VDC motor in this circuit draws up to a maximum of 50mA under full load. To check the max load of your motor connect an ammeter in series with the motor to a battery and hold the shaft and watch where the current maxes out.

 

For more detail: Simple way to control 12V DC Motor using Raspberry Pi’s GPIO port and NPN transistor


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top