arnuvm
Posts: 6
Joined: Fri Feb 06, 2015 2:29 am

Help Controlling a Motor in One Direction

Sat Sep 03, 2016 7:16 pm

Hi everybody,

I want to create a program that runs a motor triggered my motion from a PIR motion sensor. I've already gotten my motion sensor working, but I'm having trouble figuring out how to build the circuit for the motor. When I looked online, most of the responses assumed that the motor was to be spinning in both directions; however, I only need my motor to spin in one direction, so I don't think I need the L293D chip or any other motor controller.

I thought this would simplify the process significantly, but I can't seem to build the circuit. The motor uses a 6*1.5V battery pack which I have taken out, and the pack has a positive and negative wire. I was thinking that the circuit would go from the battery pack to the motor to a GPIO pin and back to the negative end of the battery pack. What I was worried about is if I need to connect any wire back to a GND pin on the Pi.

All help would be greatly appreciated and please contact me if I lacked clarity anywhere in my post.

Thank you very much

klricks
Posts: 6550
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Help Controlling a Motor in One Direction

Sat Sep 03, 2016 8:37 pm

arnuvm wrote:Hi everybody,

I want to create a program that runs a motor triggered my motion from a PIR motion sensor. I've already gotten my motion sensor working, but I'm having trouble figuring out how to build the circuit for the motor. When I looked online, most of the responses assumed that the motor was to be spinning in both directions; however, I only need my motor to spin in one direction, so I don't think I need the L293D chip or any other motor controller.

I thought this would simplify the process significantly, but I can't seem to build the circuit. The motor uses a 6*1.5V battery pack which I have taken out, and the pack has a positive and negative wire. I was thinking that the circuit would go from the battery pack to the motor to a GPIO pin and back to the negative end of the battery pack. What I was worried about is if I need to connect any wire back to a GND pin on the Pi.

All help would be greatly appreciated and please contact me if I lacked clarity anywhere in my post.

Thank you very much
If you don't care about controlling speed and/or direction then you don't need a motor controller for a simple DC motor.
However no motor can be directly powered by the RPi GPIO.
One option would be to use a relay board. A GPIO can be used to control the relay which will then control power to the motor.
Of course you will need a separate 9V power supply or batteries to power the motor.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Help Controlling a Motor in One Direction

Sat Sep 03, 2016 8:58 pm

arnuvm wrote: I was thinking that the circuit would go from the battery pack to the motor to a GPIO pin and back to the negative end of the battery pack. What I was worried about is if I need to connect any wire back to a GND pin on the Pi.
It doesn't worry you that you are going to put 9 volts to the gpio? They are only 3.3 volts. It would be best to just assume that you can't directly drive any mechanical thing with a pi, you need to drive something else and it will drive the bigger thing. Even LEDs need to have their current limited.

arnuvm
Posts: 6
Joined: Fri Feb 06, 2015 2:29 am

Re: Help Controlling a Motor in One Direction

Sat Sep 03, 2016 9:34 pm

Thank you for the very informative replies.

From these two posts, can I conclude that in order for the Pi to be able to control something of higher voltage, there needs to be a relay which will drive the motor while being controlled by me?

masa-aud
Posts: 144
Joined: Fri Feb 26, 2016 9:20 am

Re: Help Controlling a Motor in One Direction

Sun Sep 04, 2016 2:06 am

reply to arnuvm on Motor Control
Basically important knowledge for controlling things by GPIO is that the GPIO's power of each output is only for information for controllings via little voltage and thin current such as 3.3 v and several mA, rather than for mechanical controlling with realistic power by motors. Then you need to
use device for changing that information to real power such as relay or power transistor etc.. This is not a difference of voltage or apmere but a great difference of power.
masa-aud

Return to “Beginners”