gpio latch


first off, I’m a noob when it comes to hardware/electronics. Barely started and not planning on getting too deep in it.

Now, what I am trying to do may not be possible, hence this question. I have this latching relay latching relayand it works as expected (not sure if it counts, but I have the 5V version of this, no the pictured 12V. Everything else seems the same though)

There are 2 pins in that white area that is the “low level trigger”. I found that I can take just 1 of the pins from the “low level trigger” and if I tap it to the DC “-” connector, it will latch (basically, acts like the button). It’s the one from the left; it will not work with the one from the right.

Now I’m trying to find a way to connect everything so that the relay is powered by it’s own 5V power source, the RPI is powered by it’s own power source, and I want to connect just 1 pin from the RPI to control the latching on the relay (so one of those 2 pins/wires on the relay).

Is there any way I can achieve this?


 New contributor
  • you will need two wires connected to the RPi ….. one is the control signal voltage and the other is the reference voltage (usually ground) – jsotola yesterday

2 Answers


Your question omits details required to answer (specifically specifications for the module).

You CAN NOT control anything with 1 wire – electric circuits are called “circuits” because they need a complete current path – which requires a minimum of 2 wires.

PS I am reluctant to provide advice to inexperienced persons attempting to control mains power. The module pictured would only be safe (and comply with wiring regulations) if mounted in an enclosure with a barrier between mains and low voltage circuitry, and provided with suitable strain relief.


Short answer: “Yes, there is a way to achieve this.”

That said, your question omits some details that are needed for a complete answer. But we’ll start from what we know, or can reasonably assume, and go from there. One caveat: Your Raspberry Pi may be ruined if one of us makes a mistake: either I make a mistake in my instructions, or you make a mistake in executing them. I’ll cover some “safeguards”, but if your hardware knowledge is very limited, then your risk increases. If you’re OK with that, we’ll go ahead. If not, go back to software 🙂

From the information in your question, it seems reasonable to assume that the “low level trigger on the left” may be used for your “one pin connection” to the RPi. However, there is one important caveat:

DO NOT connect the low level trigger on the left directly to the RPi. It likely has 5VDC on it. If it does, and you connect it directly to a GPIO pin, your RPi will become a paperweight. This is because the RPi GPIO pins are biased at 3.3VDC, and they are very fragile.

Instead, you will need an “interface” between the low level trigger on the left and the RPi. I’ll show this generically in the schematic below. Basically, it will work like this:

Your software program on the RPi will drive the GPIO pin you've chosen to an "active high" state (i.e. its output is 3.3VDC). The GPIO pin will be connected to the "base" terminal of the transistor Q1. Once the GPIO pin goes "high", transistor Q1 will be "turned on", and conduct current between its collector and emitter terminals.


simulate this circuit – Schematic created using CircuitLab

And so, “this” is a way to achieve your objective. I’ll not go further as that may be a waste of time. Review this, and if you’d like to proceed, post a comment. We’ll go from there.

  • Thanks for your answer. Uhm… I obviously did the “DO NOT” part. I usually only ask questions when I failed in all my attempts and google doesn’t help.for whatever reasons. Safeguards, yes, will do whatever you guys suggest to keep my RPI as safe as possible. I accept that accidents happen. Fingers crossed. I think the reason why it’s not working, and I hope I’m not being an idiot, is because the “left relay pin” requires a negative signal to latch? While RPI outputs a positive one. Which could also explain why I didn’t fry my RPI. I see in schematics that GND’s are connected. Is that a must? – ciuly yesterday
  • reason for the must question is that will get me 2 wires going from RPI to the relay which is what I am trying to avoid. Actual configuration is like 10-15 relay across the house, between 4-15m from the RPI. Just too many wires, and a big spread 🙂 – ciuly yesterday
  • Too bad we can’t change the laws of physics to suit your needs. I’ll speak to Mr. Maxwell next I see him 🙂 – Seamus yesterday
  • We don’t need to go that far. Just think a little out of the box. After all we’re talking about the need for a potential difference between 2 ends of the same wire. You are thinking inside the box requiring the 2 points to be in the RPI, I am trying to move one of them out, since both my “ends of the same 1 wire”, RPI and relay, have their own potential differences, so can we make that work? I can accept a “no” as long as it comes with reasonable explanation 😉 Thanks – ciuly yesterday
  • @ciuly : I don’t mean to be rude, but it doesn’t seem to me that you know what you’re talking about. “Two ends of the same wire” for connecting two different potentials sounds like some sort of semantic nonsense. Please don’t waste our time here with that… some people have actual problems they want help with. – Seamus yesterday
  • I probably don’t know what I am talking about, but hey, I started the question clearly with that warning, so if you don’t want to waste your time with noobs stupid questions, then simply don’t. – ciuly yesterday
  • @ciuly – I do this for only one reason: I want to. And I’m happy to help people of any level of skill or knowledge – you can review any of my posts. What’s really hard to take though is someone who wades in, declares himself a newbie, and then proceeds to lecture about thinking outside the box for connecting four circuit nodes with one wire. You should perhaps re-consider your approach to asking for help. – Seamusyesterday

Your Answer

 ciuly is a new contributor. Be nice, and check out our Code of Conduct.
community wiki

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: