adlersam
Posts: 6
Joined: Sat Aug 18, 2012 6:18 am

how to configure GPIO sink current

Wed Aug 22, 2012 3:21 pm

Hi,

Hope I'm asking this at the right place, please apologize if I'm wrong:

I've read at several locations that the RPI GPIO sink current is configurable from 2 to 16mA and that the details are described in a document called "GPIO Datasheet Addendum". But all I could find when googling for that document is an errata: "http://www.scribd.com/doc/101830961/GPIO-Pads-Control2" describing details w.r.t. _output_ current control. Can anyone help out with information on how to configure GPIO _input_ (i.e. sink) current control?

Background: I'd like to count pulses from S0 current counting devices, an as these are about 100m away from my RPI, I though I should configure a decently high input current. An as the maximum current through the S0 current counting devices is rated at 27mA, the 16mA sink current may come in handy, avoiding extra external pull down resistors.

Thanks for any help,

Chris

User avatar
Grumpy Mike
Posts: 973
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: how to configure GPIO sink current

Wed Aug 22, 2012 7:33 pm

adlersam wrote:I've read at several locations that the RPI GPIO sink current is configurable from 2 to 16mA
No that is not quite right. It is the drive current and hence the impedance of the output that is configurable. BUT this does not limit the current to a safe value or indeed a value equal to the drive current. For information on this see my page:-
http://www.thebox.myzen.co.uk/Raspberry ... tputs.html
how to configure GPIO _input_ (i.e. sink) current control?
Sink current is not a parameter for an input, sink current is an output value.

adlersam
Posts: 6
Joined: Sat Aug 18, 2012 6:18 am

Re: how to configure GPIO sink current

Thu Aug 23, 2012 4:54 am

Grumpy Mike wrote:
adlersam wrote:I've read at several locations that the RPI GPIO sink current is configurable from 2 to 16mA
No that is not quite right. It is the drive current and hence the impedance of the output that is configurable. BUT this does not limit the current to a safe value or indeed a value equal to the drive current. For information on this see my page:-
http://www.thebox.myzen.co.uk/Raspberry ... tputs.html
Yes, I read this already: It's an _excellent_ explanation to understand the RPI GPIO output behaviour.
how to configure GPIO _input_ (i.e. sink) current control?
Sink current is not a parameter for an input, sink current is an output value.
Oh, I see. So "source and sink current" mentioned in the GPIO wiki are not referring to GPIO output and input current but to impedance of the output between the GPIO pin towards +3.3V and 0V! Many thanks for the clarification.

Serac
Posts: 124
Joined: Wed Jul 18, 2012 2:49 pm

Re: how to configure GPIO sink current

Thu Aug 23, 2012 11:18 am

adlersam wrote:Background: I'd like to count pulses from S0 current counting devices, an as these are about 100m away from my RPI, I thought I should configure a decently high input current.
Signaling over a distance of 100m is going to cause you serious difficulties using basic 3.3V or 5V TTL logic levels. There will be significant scope for the cabling to pick up electrical noise and you'll also have the internal resistance & capacitance of the cabling to deal with. At a minimum, I'd suggest using differential line drivers between the Pi and the remote devices. The next step up would be to look at CAN bus or ethernet cabling.

User avatar
Grumpy Mike
Posts: 973
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: how to configure GPIO sink current

Thu Aug 23, 2012 1:10 pm

You can get this distance if you use an logic level signal from 0 to 12V, then at the Pi end you have it going into the base of a transistor through a resistor and then connect the collector to the GPIO pin with the internal pull-ups enabled and the emitter to ground. Also a resistor from base to ground will lower the input impedance and thus reduce pickup.

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