control a relay using GPIO TTL with an N-CHANNEL MOSFET. The relay is a latching relay, so a short pulse is applied at either input to latch the relay to state 1 or 2 (EveryCircuit Relays are non-latching and return to default state when coil pulse is removed). The SR latches are added to visualize the states.