2

I'm looking for a method to share one GPIO device/HAT/pHAT between two Raspberry Pis. For example, I'd like to connect one HyperPixel 4.0, which attaches via the 40 GPIO pins, to two different Raspberry Pis.

I found products that offer the opposite of what I am looking for, connection of multiple devices/HATs/pHATs to one Raspberry Pi (e.g. pHAT Stack by Pimoroni).

Ideally I could switch the active Raspberry Pi programmatically. A last resort would be to connect all 40 pins to a custom switching mechanism using relays or mosfets, which is controlled by a third Raspberry Pi or a microcontroller.

The goal would be to share a screen and programmatically switch the Raspberry Pi using the screen.

6
  • attaches via the 40 GPIO pins ... not all pins in the header are GPIO ... some are power and ground
    – jsotola
    Jul 20 at 15:28
  • 2
    what are you trying to achieve? ... please describe the finished project
    – jsotola
    Jul 20 at 15:33
  • I shouldn't write while hungry, understand that not all 40 pins are GPIO but I assumed, the phrasing is understandable. I edited the question.
    – emma.makes
    Jul 20 at 15:50
  • the phrasing is understandable ... I'm just throwing out information
    – jsotola
    Jul 20 at 16:51
  • Install the HyperPixel on one pi, and use vnc to connect to the other? It may not be exactly what you asked for, but it will probably work.
    – NomadMaker
    Jul 20 at 23:52

2 Answers 2

1

A hardware solution is theoretically possible, but is fraught with difficulties. The signals to an LCD will be quite fast, so cabling will have to be very short, and any switching circuitry will have to be capable of handling the high speeds; 2-into-1 multiplexer (or tri-state buffer) chips can do this, but it'll take quite a few of these to handle 40 lines, and you'll need a very tight circuit layout to avoid noise problems.

Then there are software questions: what happens at the switchover? Might the glitch on the I/O lines disrupt the screen, such that it needs re-initialisation? Then there is the issue of the i2c interface, which has to be shared, and unlike the display signals, this is bi-directional.

There are ways round these problems, but they will be quite complicated, and the end-result could just be unreliable.

So I'd suggest you find another way of screen-sharing, maybe using VNC as others have suggested.

1
  • Thank you for the elaboration. As others mentioned as well, I believe the most sensible approach for me is to share the screen via VNC/remote desktop.
    – emma.makes
    Jul 21 at 12:10
1

One way to achieve this is to get an small HDMI screen and use an HDMI switch. Unlike custom GPIO video interfaces, HDMI is a standard with lots of available compatible hardware, and screen switching is more complex than it looks. Typical HDMI switches have either a button (which you could drive from a GPIO, perhaps using an optocoupler), or switch to a different source if the current one shuts down (which can be done programmatically, e.g. by running tvservice --off on the Pi which is currently displaying in order to switch to the other one).

Sharing a screen in software (VNC, RDP, etc.) can be even easier, the only requirement for it is that both RPIs should be connected to a network.

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.