realtek
Posts: 34
Joined: Wed Jan 09, 2013 3:16 pm

Connecting two GPIO pins together?

Sun Mar 24, 2013 11:48 pm

Hi,

Is it possible to detect if two GPIO pins have been basically linked together or would this short something out?

I was hoping to work the opposite and have a relay that is switched externally and tell the PI it has been switched??

Thanks!

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Connecting two GPIO pins together?

Mon Mar 25, 2013 8:26 am

If your relay has two contacts use one for switching the load and one foir signalling the Pi.

Ebsure Pi input has a pullup, connect a Normally Open contact (NO) to Pi GND, Connect the associated Common to the Pi GPIO input.

Just like a switch. This assumes you have a Double Pole Relay and you only need one pole to switch your load.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

cae2100
Posts: 143
Joined: Tue Jan 08, 2013 10:35 am
Contact: Website

Re: Connecting two GPIO pins together?

Mon Mar 25, 2013 8:57 am

another solution could be to do it in software instead just using one pin for output, then switch it to input and read the state, then set it back as output again. when you switch it to input, it stays at whatever state it was at before switching.
If it isnt smoking and blown into pieces, it's not pushed far enough yet. :P
http://cae2100.wordpress.com

tophat
Posts: 6
Joined: Sun Mar 03, 2013 6:11 pm

Re: Connecting two GPIO pins together?

Sun Mar 31, 2013 12:30 pm

Following on from this : I have GPIO2 configured as an input port to count relay closures on a flowmeter.
To test this I want to use GPIO1 as an output port.
Do i need to connect GPIO1 to a transistor and relay circuit (control side of relay) then I would to simulate the flowmeter and connect GPIO2 to the power side (say a Normally open contact) of the same relay ?
Or is there an easier way ?

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Connecting two GPIO pins together?

Sun Mar 31, 2013 5:21 pm

Not sure what exactly you are trying to achieve, see if you post a diagran of how you were thinking of wiring and what the function of each GPIO is for now and in final installation.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

User avatar
aTao
Posts: 1094
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Connecting two GPIO pins together?

Sun Mar 31, 2013 6:16 pm

If you want to use a GPIO in to monitor another GPIO out then just connect the 2 with a resistor, 1k0 will do just fine.
Its slightly better to use a resistor instead of a wire for those "Dohh!" moments when you realise they are both outputs and have different output levels. sure the RPi current limits its outs but if you make a habit of it then you start asking a lot from the power supply.

*Edit:

The outputs are not current limited, the current setting on an output determines the maximum current you can draw while still getting a valid output.
>)))'><'(((<

Return to “Python”