2

Im trying to use two Pi's as a bridge to trigger a garage doors button from an automation system that uses its own GPIO. My thoughts where give them each a static address and script one to ssh into the other and than have a script that says triggers sets pin 1 high when pin 1 goes low on the other. Is there a better way or possibly a similar project that I could modify?

2 Answers 2

3

My pigpio Python module supports this mode of operation.

You have the pigpio daemon running on each Pi. You have a control script on the master Pi which connects to its own Pi and the remote Pi. This allows you to manipulate both sets of GPIO from the one script.

1

If you are looking for something extremely simple, consider using netcat (this is similar to the ssh approach, but likely a little faster). netcat is including in Raspbian by default.

On the "server" RasPi (the one that will be setting a GPIO, assuming GPIO4):

echo 4 > /sys/class/gpio/export 
echo out > /sys/class/gpio/gpio
nc -kl 9999 > /sys/class/gpio/gpio4/value

On the client, assuming you want to set the GPIO high:

nc 192.168.1.16 9999 <<< 1

and that the IP address of the server is as shown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.