bharadwajtk
Posts: 65
Joined: Sun May 26, 2013 10:22 am

GPIO output current

Mon May 27, 2013 4:34 am

Hi friends,
I am new to Pi interfacing.Please help me understand this scenario (thought experiment)

I set the GPIO-17 drive strength to 16mA and the pin as an output port [My understanding is, the output voltage available at the GPIO-17 pin will be 3V3 and, it will vary depending on what drive strength I set]

What will happen if :

1.I short circuit it by connect this pin to Ground(Pin 9 on P1 connector)
2.I connect a resistor of 150 Ohm between GPIO-17 and Ground (the current which should flow in the circuit is 22mA = 3.3/150)
3.I connect a resistor of 50 ohm between GPIO-17 and Ground(the current should be 66mA)I have read at many places that the maximum current which can be drawn from all the GPIOs is 51mA .Will the processor burn in this case ?

Please also comment about what's the best way to move if I am trying to interface different components (Going forward I will interface motors,sensors etc.. through GPIO).Please fwd a neat and clean link if you have .

Thank you !

Regards,
Tk

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: GPIO output current

Mon May 27, 2013 11:20 am

bharadwajtk wrote:Hi friends,
I am new to Pi interfacing.Please help me understand this scenario (thought experiment)

I set the GPIO-17 drive strength to 16mA and the pin as an output port [My understanding is, the output voltage available at the GPIO-17 pin will be 3V3 and, it will vary depending on what drive strength I set]

What will happen if :

1.I short circuit it by connect this pin to Ground(Pin 9 on P1 connector)
You blow up the Pi.
2.I connect a resistor of 150 Ohm between GPIO-17 and Ground (the current which should flow in the circuit is 22mA = 3.3/150)
You blow up the Pi.
3.I connect a resistor of 50 ohm between GPIO-17 and Ground(the current should be 66mA)I have read at many places that the maximum current which can be drawn from all the GPIOs is 51mA .Will the processor burn in this case ?
You blow up the Pi.
Please also comment about what's the best way to move if I am trying to interface different components (Going forward I will interface motors,sensors etc.. through GPIO).Please fwd a neat and clean link if you have .

Thank you !

Regards,
Tk
Firstly, I'd strongly suggest forgetting about changing the drive strength values. It's designed to guarantee a logic 1 for a given current - the default is set to "3" which means that you can pull 8mA while maintining sufficient voltage to register as a logic 1 to another 3.3v logic device.

The drivers will allow you to pull more current - the SoC might get warm - to the point of burning out the pin drivers or the entire SoC. I have pulled 35mA out of a single GPIO pin in the past - I feel I was lucky that day and got away with it. It's not something I would recommend. I have also caused a Pi to reboot by shorting a GPIO pin to 0v. Again, something I would not recommend.

So treat the Pi's GPIO output drivers as something that can drive external logic or small LEDs, but nothing more.

Also treat the Pi's 3.3v supply as a precious resource - so don't try to pull more than 50mA from it - if you do, then you'll likely cause it to malfunction is strange and unpredictable ways. (Or just reboot if you're lucky - if unlucky you might be looking at SD card corruption, etc.)

However... I have in the past pulled a lot more than that via the Pi's GPIO - way back when we were foolish and didn't know better...

My infamous 17 LED photo:

Image

So connect up LEDs, but for anything bigger, use buffers or some sort - e.g. ULN2803's for simple relays and small motors or something more powerfull for bigger motors, steppers, etc. and if you're at all concerend or lack confidence in your ability to build interface boards, then get a Gertboard or PiFace.

If you want some simple introductions to interfacing, then have a look at this - https://projects.drogon.net/raspberry-p ... -crossing/ that's just LED and buttons, but good enough to start with.

-Gordon
--
Gordons projects: https://projects.drogon.net/

bharadwajtk
Posts: 65
Joined: Sun May 26, 2013 10:22 am

Re: GPIO output current

Wed May 29, 2013 7:25 am

Thanks for your reply Gordon :

1. I found,@ few places people directly interfacing servos and motors to Pi GPIOs [http://learn.adafruit.com/adafruits-ras ... r/hardware] ..What do you recommend I don't wanna use Gertboard etc.. because I wanna learn the intricacies of interfacing circuit design.

2.You have said that
"treat the Pi's 3.3v supply as a precious resource - so don't try to pull more than 50mA from it - "

Do you mean that, if I power something from 3V3 supply pin (P1-01), the current drawn by the load shouldn't be more than 50mA [I mean a load between P1-01 and ground of Pi and a GPIO pin being used, for say control]

or

Is it the total current output of the GPIOs being used? [Say, I am driving loads by 2/3 Pins of the P1 connector]

Thanks !

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: GPIO output current

Wed May 29, 2013 8:06 am

bharadwajtk wrote:Thanks for your reply Gordon :

1. I found,@ few places people directly interfacing servos and motors to Pi GPIOs [http://learn.adafruit.com/adafruits-ras ... r/hardware] ..What do you recommend I don't wanna use Gertboard etc.. because I wanna learn the intricacies of interfacing circuit design.
The Pi only has one hardware PWM thats easy to access, so only one servo motor - if you want more, then look at the servoblaster kernel module, or a hardware servo motor driver board - which is probably more preferable. I'm personally not a big fan of RC type servo motors, so probably not the best person to really ask, but as far as I'm aware, most have high impedance inputs, so can be controlled directly from the Pi but you may need more power to drive them...
2.You have said that
"treat the Pi's 3.3v supply as a precious resource - so don't try to pull more than 50mA from it - "

Do you mean that, if I power something from 3V3 supply pin (P1-01), the current drawn by the load shouldn't be more than 50mA [I mean a load between P1-01 and ground of Pi and a GPIO pin being used, for say control]

or

Is it the total current output of the GPIOs being used? [Say, I am driving loads by 2/3 Pins of the P1 connector]

Thanks !
The Pi's current supply is limited to about 700mA when powered via the µUSB connector. Of that, the Pi itself uses some 3-400mA, leaving ~300mA for USB and GPIO peripherals. The Pi has an on-board 3.3v regulator and that's working fairly close to its limits - this is really where the limit is on the 3.3v supply - take too much out of th 3.3v supply (either directly or via the GPIO) and the Pi will likely crash or behave eratically, so not taking too much from the Pi's own 3.3v supply is wise. If you need more, then use your own 3.3v regulator - as is used on the Gertboard, Quick2Wire, Mini Piio boards, etc.

-Gordon
--
Gordons projects: https://projects.drogon.net/

bharadwajtk
Posts: 65
Joined: Sun May 26, 2013 10:22 am

Re: GPIO output current

Wed May 29, 2013 11:38 am

Thanks a lot Gordon. things are becoming clearer for me .

Can somebody please suggest steeper motor and servo specifications which I can use to start with .Easy to begin with and cheap .

User avatar
joan
Posts: 14193
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO output current

Wed May 29, 2013 11:58 am

Stepper plus driver board http://www.ebay.co.uk/itm/310643134044

Servo http://www.ebay.co.uk/itm/251130165871

You need a driver board with the stepper so that the Pi can drive it without additional hardware.

The servo can be driven directly from the Pi.

It's probably best to provide a separate power supply for the stepper and servo.

Return to “Interfacing (DSI, CSI, I2C, etc.)”