bluetape66
Posts: 42
Joined: Thu Jan 24, 2013 1:59 pm
Location: EARHT
Contact: Website

GPIO pin control

Mon Apr 29, 2013 11:19 pm

Simple question how do you use the gpio pins to control something like a fan?
I was also wondering if you could put more then 3.3v through the pis pins, to control something like a large fan.

I have minimal knowledge in python and the more detailed explanation the better!
Don't Cry because it's over, smile because it happend. :D

User avatar
jbeale
Posts: 3675
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: GPIO pin control

Mon Apr 29, 2013 11:26 pm

The GPIO pins come directly from the SoC device on your Pi (the CPU+GPU chip). It is fixed at 3.3 V and low current, this is a logic-level signal, not a motor drive. You should not try to draw more than about 10 mA of current; most motors need much more than this. To drive a motor you want some additional circuitry that will work with higher currents and voltages.
Maybe something like this, can work with 12 V up to 2.5 A: http://www.piborg.com/picoborg

bluetape66
Posts: 42
Joined: Thu Jan 24, 2013 1:59 pm
Location: EARHT
Contact: Website

Re: GPIO pin control

Mon Apr 29, 2013 11:38 pm

jbeale wrote:The GPIO pins come directly from the SoC device on your Pi (the CPU+GPU chip). It is fixed at 3.3 V and low current, this is a logic-level signal, not a motor drive. You should not try to draw more than about 10 mA of current; most motors need much more than this. To drive a motor you want some additional circuitry that will work with higher currents and voltages.
Maybe something like this, can work with 12 V up to 2.5 A: http://www.piborg.com/picoborg
WOW this is great! It might sound childish but I want to make the pi fly! Could you control the speed of all four motors from one data pin?
Don't Cry because it's over, smile because it happend. :D

User avatar
jbeale
Posts: 3675
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: GPIO pin control

Mon Apr 29, 2013 11:42 pm

Well, it is definitely possible to make a quadcopter using a R-Pi. :-)
For example, http://www.youtube.com/watch?v=bVv83PGtmnM
More details: http://www.raspberrypi.org/phpBB3/viewt ... 46#p301745

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13092
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: GPIO pin control

Mon Apr 29, 2013 11:54 pm

No in principle the GPIO's are simple on/off ports, to control motor speed something more complex is needed.

It often done with "pulse with modulation" (PWM) which means that a constant stream of logic level pulses is created, where the width of the pulses can be varied, that is the length of the time the pulse is "high" can be varied, often when the high time is increased the low time is decreased just as much, so that the frequency of the pulse stream stays the same.

Image

PWM is often used to control the angle of a servo motor, but it can also be used to control a motor driver/controller (IC). And it's quite easy to convert a PWM signal into an analog signal (that can control how much current is fed to a motor)

The some of the PI's GPIO pins can do more than just switching on or off, for example some can send/receive serial data, to/from a RS232 driver. One of the GPIO's has extra hardware, so that it can act like a dedicated PWM generator, but just one GPIO pin knows how to do this trick.

However, creating a PWM signal can also be done in software, and someone already wrote software to create not one, but many PWM signals!

bluetape66
Posts: 42
Joined: Thu Jan 24, 2013 1:59 pm
Location: EARHT
Contact: Website

Re: GPIO pin control

Tue Apr 30, 2013 11:33 am

Well this is all great on the hardware side but what about software?
Don't Cry because it's over, smile because it happend. :D

keybeeper
Posts: 26
Joined: Wed Aug 08, 2012 10:15 am

Re: GPIO pin control

Tue Apr 30, 2013 12:11 pm

bluetape66 wrote:Well this is all great on the hardware side but what about software?
You may find some help here

http://code.google.com/p/raspberry-gpio ... i/Examples
No Microsoft products were used in the creation of this message

Return to “Python”