If it were me (and assuming your printers are named Huey and Louie:
Printer |
Raspi3 |
Mode |
Huey |
huey.local |
master |
Louie |
louie.local |
slave |
You would, in theory, have two tabs in your browser: one for http://huey.local/ and one for http://louie.local/ as well. There are other ways but this is the simplest.
Each OctoPrint installation of the two would point to its respective printer. Each OctoPrint would need the same plugin, only one is configured as master and the other as slave. I'm not sure if the plugin actually needs to know about the other printer; the underlying shell or python script would need to know the other hostname. The shell script for the slave especially needs to know the master's hostname because its doing remote GPIO to read a remote pin and then to clear that pin as well.
Yes, a RAMPS board runs Marlin, for example, and is the one with the transistors (hardware drivers) for the motors.
The plugin (which doesn't exist) needs to "hook" into the serial communications of OctoPrint. Hopefully, the OctoPrint hook will allow you to block its functionality and continue when the GPIO pin has been set. In this way, you stop both printers until that pin is ON. When the pin turns ON both plugins then release control back to OctoPrint to send the GCODE command through the serial mechanism.
At this moment, the slave then clears the pin, turning it OFF.
When the master's serial hook gets fired off again, the plugin's code is running again. It might decide to add a 20 millisecond delay then to set the pin, turning it ON. Both plugins see the ON status and send their respective GCODE command to the RAMPS board and everything repeats.
These plugins are almost always written in Python. Gina has examples as do several of the authors here.
As I mentioned before, GPIO is fairly easy.
Toggle on PIN 17 on the local Raspberry Pi in a shell script:
set-pin17.sh
#!/bin/sh
echo "1" > /sys/class/gpio/gpio17/value
Similarly, a zero would clear the bit.
There are many places on the Internet where you can get more information.
GPIO pin control from the command line
How to control GPIO of another RPI
Set up a Pi and host PC for remote GPIO access using gpiozero in Python
(Note that "gpiozero" does not refer to a Raspberry Pi Zero but to the name of the library.)
somepython.py
import pigpio
PIN17 = 17
louie = pigpio.pi() # accesses the local (slave) Pi's GPIO
huey = pigpio.pi('louie') # accesses the remote (master) Pi's GPIO
print("Huey's PIN17 is {}".format( huey.read(PIN17) ))
huey.write(PIN17, 0)
print("Huey's PIN17 is now {}".format( huey.read(PIN17) ))
More info about setting up pigpio