Author Topic: Toggle double-coil bistable latching relay with ONE momentary switch  (Read 461 times)

KarenColumbo

After an unsuccessful (disorganized) foray into relay territory I came back to the original idea of switching the states of a double-coil bistable latching relay ((https://produktinfo.conrad.com/datenblaetter/500000-524999/504024-da-01-en-PR_REL_2UK_12VDC_8A_RT2_BIST_1.pdf) ) using a single momentary switch. So I've been combing the web for a solution that …

a) … leaves both coils usable
b) … powers two LEDs to signal the states
c) … works without programming a micro PC

After sifting through tons of schemtaics I found a circuit that looks sensible to my, alas, very untrained eyes:


It uses DC that I have available, it demands the type of relay I have available and it seems to have debounce circuitry wchich, I gathered, is mandatory. The only fatal drawback: It utilizes two switches. I want to use a single one, because that's ... sexy?

Now the term "flip-flop" springs to mind.

I, once again nose-to-screen, found tons of circuitry that allegedly does what I need. But these circuits look a bit "bloated" to me. And, of course, I don't know how to splice them into above schematic.

Since my type of relay (https://produktinfo.conrad.com/datenblaetter/500000-524999/504024-da-01-en-PR_REL_2UK_12VDC_8A_RT2_BIST_1.pdf) has two terminals for actuating the separate coils, I'd need kinda "toggle circuitry" that toggles the switching DC through two alternating outputs by the press of a single button.

Now the model name "555" sprang to mind.

And that's where I get stuck.

Could you once again help a sinner out?
« Last Edit: September 13, 2019, 06:41:27 AM by KarenColumbo »
"In the beginning there was nothing - which exploded" - Terry Pratchett

GibsonGM

  • more
  • Poster2
  • *****
  • Posts: 5505
  • Total likes: 696
  • Mike Parker (aka. Guitar Mike, Parks, etc)
Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #1 on: September 13, 2019, 07:16:41 AM »
There has to be a way to do this using a flip-flop.  Boss does it, after all!   I'd be interested in this as well, for switching internal 'stuff' in amplifiers.   I played with this a little in the past for a different application (model railroad) - I discovered that it's easier to use 2 coils like you have, rather than trying to reverse polarity with one coil!  Gonna watch and see what a switching guru can come up with here, definitely is a design problem to overcome.
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

KarenColumbo

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #2 on: September 13, 2019, 07:29:51 AM »
I think the above circuit could work. It I only could substitute both of the "Test" switches with transistors wired as switches. On closes on "High" (I guess 5V because there's digital involved), the other closes on "Low". If that were possible, I guess it's an easy thing with a simple logic IC that reverse both states (high and low) at the press of a button, so one transistor switch closes when the other one opens and vice versa. Isn't it?
« Last Edit: September 13, 2019, 07:51:36 AM by KarenColumbo »
"In the beginning there was nothing - which exploded" - Terry Pratchett

R.G.

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #3 on: September 13, 2019, 10:37:37 AM »

R.G.

Quick IQ Test: If anyone in a governmental position suspected that YOU had top-secret information on YOUR computer, how many minutes would you remain outside a jail cell?

KarenColumbo

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #4 on: September 14, 2019, 07:39:56 AM »



OMFGWTF! Thx, R.G:! <3 There's about every single other solution to be found in the web - except this one. Relays seem to be avoided in the DIY community. At least thats my impression after searching the heck out of this. Only places I almost found similar solutions were in extremely unfriendly german forums where you get burned for asking the wrong question while never knowing which would be the right one ...

Would a 4049 suffice? Happen to have a couple in a drawer :) And the ratings seem to be okay (18V max supply voltage).
« Last Edit: September 14, 2019, 08:14:48 AM by KarenColumbo »
"In the beginning there was nothing - which exploded" - Terry Pratchett

R.G.

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #5 on: September 14, 2019, 10:43:10 AM »
The CD4049 is what the circuit was designed for. Should work fine. Let me know if you have any problems with it. I've used bits of that circuit in commercial production pedals, and it's pretty reliable. The only funny stuff might be adjusting the pulse timing and the base drive.
R.G.

Quick IQ Test: If anyone in a governmental position suspected that YOU had top-secret information on YOUR computer, how many minutes would you remain outside a jail cell?

duck_arse

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #6 on: September 14, 2019, 10:47:12 AM »
..... The only funny stuff might be adjusting the pulse timing and the base drive.

and don't forget to mention the [not shown] supply connection to the K end of the two diodes. no juice in the coils without it.
duck a-duckka not fade away .....

Kipper who?

R.G.

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #7 on: September 14, 2019, 02:34:32 PM »
Yep, that's another funny thing.  :icon_lol:

No wonder I had so much trouble getting that to work.  :)
R.G.

Quick IQ Test: If anyone in a governmental position suspected that YOU had top-secret information on YOUR computer, how many minutes would you remain outside a jail cell?

KarenColumbo

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #8 on: September 20, 2019, 08:21:03 AM »
The recent two posts awoke my superstition.

This here won't work, I gather?




Damn :(

So this will have to wait :)



« Last Edit: September 20, 2019, 08:22:37 AM by KarenColumbo »
"In the beginning there was nothing - which exploded" - Terry Pratchett

duck_arse

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #9 on: September 20, 2019, 10:28:24 AM »
why won't it? if you've added the un-shown positive supply, as seen in your amended dia, to yore bord layout it should work as intended.
duck a-duckka not fade away .....

Kipper who?

R.G.

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #10 on: September 20, 2019, 12:35:33 PM »
Yes. As D.A.notes, with the added power supply connection, it works.

I have used a variation of that circuit in my commercial pedal work. It is very reliable.
R.G.

Quick IQ Test: If anyone in a governmental position suspected that YOU had top-secret information on YOUR computer, how many minutes would you remain outside a jail cell?

KarenColumbo

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #11 on: September 21, 2019, 01:27:40 AM »
The simplicity of this particular solution is almost uncanny - i expected something along the lines of "Nah, Andreas, this can't possibly work because ..." and then either someting glaringly obvious (for you) or highly abstract :)

Anyway: thank you gents, yet another step forward for this one :)

BUT: In my PCB layout I had to rip apart the switching circuit and the relay circuit itself. The last ground reference is at the transistors' emitters, which are situated on the "switch pcb". The "relay pcb" has no ground, so I give it some via the 4-pole-connector. Which makes my head spin.

Shouldn't I move the transistors from the switch to the relay pcb after the 10k resistors? Including ground from the switch pcb ...
« Last Edit: September 21, 2019, 02:04:01 AM by KarenColumbo »
"In the beginning there was nothing - which exploded" - Terry Pratchett

R.G.

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #12 on: September 21, 2019, 12:55:17 PM »
BUT: In my PCB layout I had to rip apart the switching circuit and the relay circuit itself. The last ground reference is at the transistors' emitters, which are situated on the "switch pcb". The "relay pcb" has no ground, so I give it some via the 4-pole-connector. Which makes my head spin.

Shouldn't I move the transistors from the switch to the relay pcb after the 10k resistors? Including ground from the switch pcb ...
Good! You're thinking about the right things, which is an important milestone for beginners.

Electricity can only flow in complete loops. This is where the use of the English word "circuits" comes from, current flowing in a complete circle. We mostly make our closed loop circuits be a bunch of partial circles which all include passing through one "power supply" link.

In driving a relay with transistors from an IC, there are three loops to worry about. One is the loop from the power supply to the relay coil, through the transistor's collector and emitter, then back to the power supply. This loop contains the high(er) current of the relay coil when the transistor is on, zero current when the transistor is off, and the sudden, sharp edges when the transistor is turning on and off.

A second loop is the power to the IC which drives the transistor. This is generally a quiet, low current loop in CMOS ICs, but it can be noisy in things like the bipolar 555 timer.

The third loop is the loop which contains part of the IC's incoming DC power, through the IC to the output pin, to the transistor base, back from the transistor's emitter to ... what, exactly? It ultimately has to get back to the power supply return to complete its loop, but it comes out of the transistor's emitter, mixed in with the relay coil current. The simplest thing to do is to let it return back to the power supply with the relay coil current by providing a conductor from the transistor emitter directly to the power supply.

The lowest-noise way to wire this (in perfect-world mental concepts) is to have the relay coil power supply and return to the power supply on a single pair of wires, ideally a twisted pair. This does two things for you. One is to make the loop containing the sudden sharp pulses of the relay coil on/off changes have the smallest possible area. The magnetic signal caused by any current loop is proportional to the area of the loop, so making the tiniest possible loop by supplying the relay coil and transistor with a power-in, power-out pair of wires is as quiet as you can make that. (note that at radio frequencies, other issues crop up, but this if for your low-frequency, audio case).

The second thing is does for you is to make sure that the return current from the coil doesn't share a wire with the other circuits. That means that the resistive loss of the wire returning power to the power supply cannot cause a  <click> when you change the current in the coil by causing a "ground shift".  I would take four wires to the relay board: power, ground, and two transistor-base wires. The power and ground signals would return to the power supply. [It's a little difficult to make distinctions in power and ground paths on such tiny circuits, but you'll need to know this stuff in the future, I promise.] It also makes sense to put a "temporary power supply" very near the relay - an electrolytic capacitor which acts like a "bucket of electricity" for the coils when they switch. I would put a 10uF to 100uF electro cap as close to the relay and transistors as I could reasonably get it, ideally on the relay board. Low-profile electros make this easier.

Now, back at the driver IC. That CMOS CD4049 uses vanishing-small microamperes, and it has good noise immunity on its inputs. In (my own, internal) ideal world, it would be right at the relay too. Is there some reason you have two PCBs? Can this all go on the same PCB, right at the relay?
R.G.

Quick IQ Test: If anyone in a governmental position suspected that YOU had top-secret information on YOUR computer, how many minutes would you remain outside a jail cell?

KarenColumbo

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #13 on: September 22, 2019, 02:08:59 AM »
BUT: In my PCB layout I had to rip apart the switching circuit and the relay circuit itself. The last ground reference is at the transistors' emitters, which are situated on the "switch pcb". The "relay pcb" has no ground, so I give it some via the 4-pole-connector. Which makes my head spin.

Shouldn't I move the transistors from the switch to the relay pcb after the 10k resistors? Including ground from the switch pcb ...
Good! You're thinking about the right things, which is an important milestone for beginners.

Electricity can only flow in complete loops. This is where the use of the English word "circuits" comes from, current flowing in a complete circle. We mostly make our closed loop circuits be a bunch of partial circles which all include passing through one "power supply" link.

In driving a relay with transistors from an IC, there are three loops to worry about. One is the loop from the power supply to the relay coil, through the transistor's collector and emitter, then back to the power supply. This loop contains the high(er) current of the relay coil when the transistor is on, zero current when the transistor is off, and the sudden, sharp edges when the transistor is turning on and off.

A second loop is the power to the IC which drives the transistor. This is generally a quiet, low current loop in CMOS ICs, but it can be noisy in things like the bipolar 555 timer.

The third loop is the loop which contains part of the IC's incoming DC power, through the IC to the output pin, to the transistor base, back from the transistor's emitter to ... what, exactly? It ultimately has to get back to the power supply return to complete its loop, but it comes out of the transistor's emitter, mixed in with the relay coil current. The simplest thing to do is to let it return back to the power supply with the relay coil current by providing a conductor from the transistor emitter directly to the power supply.

The lowest-noise way to wire this (in perfect-world mental concepts) is to have the relay coil power supply and return to the power supply on a single pair of wires, ideally a twisted pair. This does two things for you. One is to make the loop containing the sudden sharp pulses of the relay coil on/off changes have the smallest possible area. The magnetic signal caused by any current loop is proportional to the area of the loop, so making the tiniest possible loop by supplying the relay coil and transistor with a power-in, power-out pair of wires is as quiet as you can make that. (note that at radio frequencies, other issues crop up, but this if for your low-frequency, audio case).

The second thing is does for you is to make sure that the return current from the coil doesn't share a wire with the other circuits. That means that the resistive loss of the wire returning power to the power supply cannot cause a  <click> when you change the current in the coil by causing a "ground shift".  I would take four wires to the relay board: power, ground, and two transistor-base wires. The power and ground signals would return to the power supply. [It's a little difficult to make distinctions in power and ground paths on such tiny circuits, but you'll need to know this stuff in the future, I promise.] It also makes sense to put a "temporary power supply" very near the relay - an electrolytic capacitor which acts like a "bucket of electricity" for the coils when they switch. I would put a 10uF to 100uF electro cap as close to the relay and transistors as I could reasonably get it, ideally on the relay board. Low-profile electros make this easier.

Now, back at the driver IC. That CMOS CD4049 uses vanishing-small microamperes, and it has good noise immunity on its inputs. In (my own, internal) ideal world, it would be right at the relay too. Is there some reason you have two PCBs? Can this all go on the same PCB, right at the relay?
Thank you R.G., again, for making this thing visible to an outsider.

In my mind I thought that the transistors kind of function as a "valve" between all the current coming through the relay coil and ground. As long as the "valve" is closed the relay coils are somehow "suspended in mid-air", floating, so to say, the way from V+ to ground is barred. So the circle is open, no current in the coils. The circle closes when the transistor opens its "valve" and lets the current(s) flow to ground, thus activating the coil.

As you kindly asked me: When I really think about this, there is no argument against merging those two boards into one as you suggested. I thought the smaller footprint of TWO boards would let the whole amp seem less cluttered on the inside. Which it won't because I have to connect those boards with a lot of wires. But I also thought that there's probably a lot of current running through the relay (it's a tube amp, after all, and with one of the planned two relay constructions I will switch a complete gain stage in and out), so i wanted to keep this phat amperes and volts away from the intricate CMOS logic.

I will try and Eagle up a board with your suggestions.

(Do you have a book suggestion that explains electronics the visual/metaphoric way? I have quite a collection, but they're straight to the scientific point - I need quite a lot of "Eselsbrücken" (dict.cc says "aide-memoire") to translate all this via my visual imagination.)
"In the beginning there was nothing - which exploded" - Terry Pratchett

KarenColumbo

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #14 on: September 22, 2019, 03:01:12 AM »
Well, I came up with a single board.



Ah, forgot: this is the pinout of my relay (https://produktinfo.conrad.com/datenblaetter/625000-649999/629513-da-01-en-MINIATURRELAIS_HFD2_012_S_L2_D.pdf): (It's seen from the solder side, obviously. Strange ...)



I have two questions remaining:

1. As you suggested, I put in a "reservoir" or "bucket" cap – C6 in the PCB layout above – right at the relais. The only position for it I could find, was right at V+ of the coils. Is that correct?

2. Are the connections "set" and "reset" of the relay interchangeable? As far as I see it, they just determine the position at first power-up. Is that so?


« Last Edit: September 22, 2019, 04:13:04 AM by KarenColumbo »
"In the beginning there was nothing - which exploded" - Terry Pratchett

chbeer

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #15 on: September 22, 2019, 08:48:16 AM »
If you‘d only need one of the 2 switches, you could use the other one to switch the coils.

KarenColumbo

Re: Toggle double-coil bistable latching relay with ONE momentary switch
« Reply #16 on: September 22, 2019, 10:34:22 AM »
Alas, I need both
"In the beginning there was nothing - which exploded" - Terry Pratchett