DIYstompboxes.com

DIY Stompboxes => Building your own stompbox => Topic started by: aion on June 28, 2017, 07:34:31 PM

Title: Latching relay driver with CMOS - difference between these two circuits?
Post by: aion on June 28, 2017, 07:34:31 PM
So I've not had the opportunity to dig into CMOS much before the past few weeks, but decided it was time. I'm trying to put together a latching relay driver, with the goals being:

- Use a "bouncy" momentary switch to reliably drive a latching relay
- Revert to bypass on power loss
- Start in bypass mode when first powered
- Ensure relay is in sync with the logic when first powered

I've been cooking out of Don Lancaster's wonderful CMOS Cookbook and using Art of Electronics as a reference, as well as studying Mictester's fantastic latching relay driver on FSB (topic "A Switching Scheme").

Here are two different schematics I've ended up with. I haven't tested either of them, I'm still just in the world of theory here. I understand the core relay driver portion (the half on the right) but it's the logic part that I'm trying to work through.

(http://i1249.photobucket.com/albums/hh506/aionelec/latching_relay_driver_a.png~original)

(http://i1249.photobucket.com/albums/hh506/aionelec/latching_relay_driver_b.png)

(note: C1 should be 1uF in circuit B)

And here are my questions.

1. Can circuit "A" be modified so it is in bypass state when first powered on? (i.e. logic-low, relay is off)

2. Is the "power-on reset" hooked up properly in circuit "A"? The IC1C stuff on the far-left is supposed to send a positive pulse on initial power-up. This is a cobbling-together of two different circuit fragments so I'm trying to make sure I understand how it's supposed to be connected to the bistable portion.

3. Would circuit "B" have any trouble driving the relay? Would a transistor buffer be helpful here? (I added one to circuit "A" out of caution, but it's an inverting type that replaces a Schmitt inverter, so won't work in the "B" circuit)

4. Is there anything that circuit "A" does that circuit "B" doesn't do? ("B" being a whole lot simpler and obviously preferable) - or any other weaknesses of "B"?

5. Is there any risk of the relay pulse "misfiring" and getting out of sync with the LED status? If so, this would be fixed by the next switch press, correct?

6. Would it be prudent to put a small resistor (e.g. 10R) between +V and this sub-circuit to help suppress any voltage spikes from the relay that could get into the main supply and be audible?

7. Assuming the momentary switch is wired off-board, is anything needed to protect the CMOS inputs from static or other unexpected voltage spikes?

Sorry for all the questions, but this will be hugely helpful. I'm a programmer by day, so my job is to think through how everything could possibly go wrong and guard against those things. So when I experiment with new and unfamiliar things like this, I immediately think defensively and want to understand how to make it as bulletproof as possible!
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: dschwartz on June 28, 2017, 09:23:38 PM
I do a simple trick to get bypass when powering up.
Just connect a capacitor (1n to 10n)  between V+ and the flip flop input.
This way when powering up, the flip flop starts and microseconds later it gets the capacitor positive discharge into the side that should be positive when bypassed ..in circuit A it should go between trigger 2 and 3, and in circuit B it should go to the triggers input.  Works like a charm

I don't really get how does the 220uF cap generates the negative voltage needed to switch the relay reliably..??
Do you mind to explain?
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: Groovenut on June 29, 2017, 01:28:34 AM
I have used the same cap trick dschwartz mentioned to cause the flip flop to power up in a specific state. However, that will do nothing to set the relay state on power loss. One of the issues with the latching relay driver in circuit A is that if there is a main DC filter cap on the circuit, the cap C3 discharges too slowly to reset the relay. So you need a way to reset the relay at power off if you want to revert to bypass on power off.

@dschwartz - cap C3 provides a current pulse that is driven directionally by Q2 and Q3. When the cap charges the inrush current pulses the relay in one direction, when the cap discharges it pulses the relay in the other direction. The voltage of the pulse is less than VCC, about 63% hence the use of a 5 volt relay in a 9 volt system.

Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: anotherjim on June 29, 2017, 02:17:46 AM
Left of circuit A is a standard active-low power-on reset scheme. The diode is to try to speed up discharge of the cap on power-off to catch the situation when the supply volts is lost momentarily (brown out). To make it active-high, reverse the order of the R, C and diode.

To apply the power-on reset to circuit B, I would do as already said, but I would also add the diode.

That diode can only discharge the reset cap as fast as the supply volts decays, and the cap is itself delaying that as it would be charged to the supply volts. The answer is to connect the diode discharge to a point on the power supply input that is isolated from the filtered power supply. If the supply has a series diode in series with the +input, then the discharge diode can go to the input side of the supply diode with a low value pull-down resistor to ground to provide a faster discharge path. The discharge diode won't see the supply filter caps when power goes off as the series diode will back block the stored supply volts.
The supply filter cap ought to be twice the value of the relay pulse cap = 470uF.
That input pull-down resistor will waste supply current if it's value is low enough to give it a fast reset while the supply filter caps still have enough charge to pulse the relay. An improvement might be some kind of transistor instead of the diode, whose control current is small enough to waste less power, but will snap on to rapidly discharge the reset cap when input power is lost.

At the relay, the way I see it, C3 if fed positive will charge up across its plates, passing current through the relay until C3 is fully charged. When Q3 switches on, it grounds the positive plate forcing the negative plate to go negative (it still has charge) with respect to ground and pulsing the relay current in the opposite direction until C3 is discharged.
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: electrosonic on June 29, 2017, 02:36:29 AM
I have made a few variations of that circuit and they work well. The 220uF cap can be smaller (100uF works fine). It is simple enough to redesign it with one less transistor if you are willing to have a little more current draw when engaged.

I was looking at the mute circuit used in the VFE effects circuits (that was recently posted), it could easily be added to this circuit.

Andrew.
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: aion on June 29, 2017, 07:26:30 AM
Quote from: anotherjim on June 29, 2017, 02:17:46 AM
Left of circuit A is a standard active-low power-on reset scheme. The diode is to try to speed up discharge of the cap on power-off to catch the situation when the supply volts is lost momentarily (brown out). To make it active-high, reverse the order of the R, C and diode.

Do you mean D2 and R8 to ground, C5 to +V?

Quote from: anotherjim on June 29, 2017, 02:17:46 AM
To apply the power-on reset to circuit B, I would do as already said, but I would also add the diode.

So cut & paste the exact reset circuit onto B, going into pin 1 of IC1? Or is it hooked up differently for this circuit?

Quote from: anotherjim on June 29, 2017, 02:17:46 AM
The answer is to connect the diode discharge to a point on the power supply input that is isolated from the filtered power supply. If the supply has a series diode in series with the +input, then the discharge diode can go to the input side of the supply diode with a low value pull-down resistor to ground to provide a faster discharge path. The discharge diode won't see the supply filter caps when power goes off as the series diode will back block the stored supply volts.

So you'd recommend maybe a 1N5817 Schottky in series with the input to prevent the main supply filter cap from pushing its charge up-river to this part of the circuit? Those are typically about 0.2V drop

Quote from: anotherjim on June 29, 2017, 02:17:46 AM
The supply filter cap ought to be twice the value of the relay pulse cap = 470uF.

Does this matter if using the series diode mentioned above?

Thanks for your help - this will go a long way!
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: anotherjim on June 29, 2017, 05:31:17 PM
In reverse order...
The supply cap may need to supply power for as long as the relay latch driver needs it after input power is lost. Therefore it needs a bit more capacitor to source supply current for long enough.
It all depends on your requirements. If the relay cap is expected to charged charged when power goes off, then it already has the charge needed to reset the relay in this event -  if that's what you want it to do.

Yes a Schottky diode if your circuit can't tolerate the extra 0.5v drop from a 1N400x type.

QuoteDo you mean D2 and R8 to ground, C5 to +V?
Yes, and keep their polarities in the same direction.

QuoteSo cut & paste the exact reset circuit onto B, going into pin 1 of IC1? Or is it hooked up differently for this circuit?
Yes, the extra resistor R1 means the inverter input only rises to half supply volts after initial seeing 0v (cap connected to 0v) . With the reset cap added, it will alter the rate that R3&C1 charges/discharges when the switch operates, but hopefully not significantly.

All the above said, lets try not to complicate it. I don't know what behaviour you actually want. In many cases, enforcing a default state on power-up is all that's needed -  we don't care what it does when power goes off, we ain't using it then.
Me myself, I'd be happy if it replicated a mechanical latch switch and keeps the state I last selected before power went off. Consider a power supply glitch in a gig situation. Loss of sound would be bad enough without having to go around stomping on things to get back where you were!
Digital gear that don't come back on set just as I last used it is a pet hate of mine ;)

Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: dschwartz on June 29, 2017, 06:58:21 PM
I spent a lot of time tinkering with switching schemes like this. Relays are not as reliable as one may think and no circuit i came up were truly free of problems..mostly the all just worked. But after evaluating many switching options, the old trusty flip flop with 4049s and 4053 worked the best and never failed..also a 3pdt stomp with pins to pcb have worked very well for me...the ones with wire pads sucks.
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: Transmogrifox on June 30, 2017, 08:34:51 PM
Here are some more ways to skin this cat.  Something to mull on anyway.
http://cackleberrypines.net/transmogrifox/Momentary_Switches/

One example, which always starts up in bypass state if power comes on reasonably quickly (like plugging in the barrel jack, or plugging your guitar cable into it).  May or may not if it's in your pedalboard and your DC supply ramps up slowly when you apply power.
(http://cackleberrypines.net/transmogrifox/Momentary_Switches/Momentary_Latch_Latching_Relay.PNG)

Sometimes these can have some switch pop feed into your effects circuitry, so here is one way to address it:
(http://cackleberrypines.net/transmogrifox/Momentary_Switches/Relay_DRVR_Pop_filter.png)
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: matt_garman on March 08, 2023, 09:58:08 AM
Reviving this old thread.  Has anyone built/tested circuit "A" from the original post?  I did, and when power is applied, it immediately goes into the active state.  When power is removed, it does go back to bypass.  But the switch doesn't work.  In other words, once power is applied, it's permanently on, and stays on until power is removed.

Now looking more closely at the schematic, it seems like that first inverter (IC1C) will always see positive potential, i.e. a "1", right?  And therefore, cause the last inverter (IC1B) to output a "0", which will turn on the PNP (Q1).  How does the momentary switching "overcome" the always-0 output of IC1C?

Thanks!
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: anotherjim on March 08, 2023, 10:43:22 AM
I don't know what IC1c is for, to be honest. It should already have a power-on state outputting 0 since C1 will start discharged to 0v. However, if C1 is charged it must discharge when power is switched off by leaking via the protection diodes of the CMOS ins and outs via the +supply which needs time to drop to 0v. A quick off-on of the power could fool it.
A spare inverter could provide 2 delays. An initial power on-delay that gives the flip-flop time to settle as it may followed by a short pulse from a series cap to set the flip-flop in the desired state which should lead to the relay flipping if it isn't already set right. This series cap is perhaps missing from circuit A? It would come immediately after pin6. Also, the cap will always be attached to the low output of IC1c so added in parallel to C1. This might reduce the voltage transferred from C2 when the bypass switch is pressed by too much. Values of R2, C2 and the new cap can be adjusted to compensate.

Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: matt_garman on March 08, 2023, 04:49:48 PM
Thanks for the quick feedback!

Quote from: anotherjim on March 08, 2023, 10:43:22 AM
I don't know what IC1c is for, to be honest. It should already have a power-on state outputting 0 since C1 will start discharged to 0v. However, if C1 is charged it must discharge when power is switched off by leaking via the protection diodes of the CMOS ins and outs via the +supply which needs time to drop to 0v. A quick off-on of the power could fool it.

My understanding, is that the intent of the first inverter (IC1C) and circuitry to the left(*), is to enforce deterministic states at power-on and when power is lost.  And part of the enforcing of a known power-on state is ensuring that the LED and bistable relay are in sync.

Quote from: anotherjim on March 08, 2023, 10:43:22 AMA spare inverter could provide 2 delays. An initial power on-delay that gives the flip-flop time to settle as it may followed by a short pulse from a series cap to set the flip-flop in the desired state which should lead to the relay flipping if it isn't already set right. This series cap is perhaps missing from circuit A? It would come immediately after pin6. Also, the cap will always be attached to the low output of IC1c so added in parallel to C1. This might reduce the voltage transferred from C2 when the bypass switch is pressed by too much. Values of R2, C2 and the new cap can be adjusted to compensate.

I don't quite follow... you're suggesting an extra cap that goes from the output of IC1C (pin6) to ground?

Personally, I'm not terribly concerned with deterministic power-on or power-off states.  Based on this thread (https://www.freestompboxes.org/viewtopic.php?t=31684) (which I suspect was the inspiration for Circuit A above), if I did away with that first inverter and everything to the left of it, it should result in a simple momentary SPST-based relay bypass scheme (though perhaps with non-deterministic power on/off states).  But there was at least one comment in that thread talking about the initial state having the LED and relay out-of-sync.  And the suggestion was to add the extra inverter (IC1C) and it's supporting components.

(*) Edit: I originally wrote "right" when I meant to write "left", now fixed.
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: Rob Strand on March 08, 2023, 07:49:14 PM
QuoteMy understanding, is that the intent of the first inverter (IC1C) and circuitry to the right, is to enforce deterministic states at power-on and when power is lost.  And part of the enforcing of a known power-on state is ensuring that the LED and bistable relay are in sync.
That's definitely the case *but* the circuit appears to have an error.  The output of IC1C completely overrides what is going on at the input of IC1A.

I haven't checked the fine details but the circuit of IC1A and IC1B should work.  You check by comparing this to say one of the DOD pedal circuits.  IIRC the Pearl pedals used a similar circuit.  That should give you the basic toggle on/off function.

If you want to force the state on power up a common scheme is to use a circuit like IC1A, however, after the initial power-up pulse to set the desired state the circuit need to disconnect itself form the main workings of the circuit.

At power-up the cap C5 is at 0V and that forces the output of IC1C high for a short period.  When the cap charges IC1C will go low.   The normal way to shoe-horn this into another circuit would be to put a diode on the output of IC1C (cathode to the output of IC1C) so that only the positive start pulse has an effect.   When the cap charges and the IC1C output goes low the start-up circuit is disconnected by the added diode.  When the output of IC1C is high the LED is off and Q1 is off, so the reset circuit is forcing the circuit off, as desired.

But the problems aren't over.  If you have a latching relay it will stay in the state present before power down, regardless of what the driving circuit does.

The original circuit appears to be this one,
http://moosapotamus.net/images/mom-relay-sch-by-mmolteratx%28800x410%29.png

So the circuit at the top of this thread is this circuit with an incorrectly implemented reset circuit added on.  However, I think even after fixing the reset circuit it's not going to work as expected due to the "memory" of the latching relay.
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: matt_garman on March 08, 2023, 08:15:16 PM
Quote from: Rob Strand on March 08, 2023, 07:49:14 PM
That's definitely the case *but* the circuit appears to have an error.  The output of IC1C completely overrides what is going on at the input of IC1A.

That's exactly what I was thinking!  Good to know I have at least some idea of what's going on.  :)

Quote from: Rob Strand on March 08, 2023, 07:49:14 PMI haven't checked the fine details but the circuit of IC1A and IC1B should work.  You check by comparing this to say one of the DOD pedal circuits.  IIRC the Pearl pedals used a similar circuit.  That should give you the basic toggle on/off function.

Confirmed, I just removed that first inverter (IC1C) and the on-off toggle works as expected.


Quote from: Rob Strand on March 08, 2023, 07:49:14 PMIf you want to force the state on power up a common scheme is to use a circuit like IC1A, however, after the initial power-up pulse to set the desired state the circuit need to disconnect itself form the main workings of the circuit.

At power-up the cap C5 is at 0V and that forces the output of IC1C high for a short period.  When the cap charges IC1C will go low.   The normal way to shoe-horn this into another circuit would be to put a diode on the output of IC1C (cathode to the output of IC1C) so that only the positive start pulse has an effect.   When the cap charges and the IC1C output goes low the start-up circuit is disconnected by the added diode.  When the output of IC1C is high the LED is off and Q1 is off, so the reset circuit is forcing the circuit off, as desired.

But the problems aren't over.  If you have a latching relay it will stay in the state present before power down, regardless of what the driving circuit does.

The original circuit appears to be this one,
http://moosapotamus.net/images/mom-relay-sch-by-mmolteratx%28800x410%29.png

So the circuit at the top of this thread is this circuit with an incorrectly implemented reset circuit added on.  However, I think even after fixing the reset circuit it's not going to work as expected due to the "memory" of the latching relay.

Or use a microcontroller.  :)  I was trying to avoid going that route, as I was hoping to have momentary-based toggle that is simple, low-power, easy to build, cheap, consistent and reliable.  Is that asking for too much?

Anyway, thank you for the clarification!  I'll just use it without that first inverter for now.
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: Rob Strand on March 08, 2023, 08:29:45 PM
I'm pretty sure you are right onto it now!

QuoteOr use a microcontroller.  :)  I was trying to avoid going that route, as I was hoping to have momentary-based toggle that is simple, low-power, easy to build, cheap, consistent and reliable.  Is that asking for too much?

If you just remove the start-up reset circuit and accept the fact it remembers the previous state it will work like most latched relay designs - no different to a push on/push off mechanical design.  It's the start-up condition that complicates things.  If you use a microcontroller and a two-coil latching relay the micro can force the unit to a given state at power-up.  It is possible to use gates to do this as well.

FWIW, you can't actually rely on those latching relays remembering the state.  If you belt the unit hard enough it can change the state of the relay, that can occur during transit or by accident.

Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: PRR on March 09, 2023, 12:39:36 AM
> If you belt the unit hard enough it can change the state of the relay, that can occur during transit or by accident.

The "Useless Box" will detect and correct a mis-switch.
https://www.amazon.com/Calary-Useless-Storage-Assembled-Children/dp/B077C3JZQ6
"You turn it on, and out of the box, a little finger pops out and turns the unit back off."
https://www.amazon.com/vdp/9651f98c3ced40af98bb75a5f9bf431e
Note: "earthquake resistance"
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: Rob Strand on March 09, 2023, 02:24:40 AM
Quote from: PRR on March 09, 2023, 12:39:36 AM
> If you belt the unit hard enough it can change the state of the relay, that can occur during transit or by accident.

The "Useless Box" will detect and correct a mis-switch.
https://www.amazon.com/Calary-Useless-Storage-Assembled-Children/dp/B077C3JZQ6
"You turn it on, and out of the box, a little finger pops out and turns the unit back off."
https://www.amazon.com/vdp/9651f98c3ced40af98bb75a5f9bf431e
Note: "earthquake resistance"
You might make light of it but I've seen some customer problems which were quite difficult to debug from the office and related to latched relays which changed state in transit.

The short summary:
- Production: does production test, burn-in, and final test - all pass
- Unit is shipped
- Custom receives goods and reports strange behaviour out of the box.
- Problem only shows up on a few random units
   ... which turns out to be units which suffered some sort of heavy handling (and noone knows it occurred.)
- Cause is software bug masked by the fact the production software just happened to leave the relays in a state that the software assumed. (The relay function was no longer used.)

The problem would not be have been solved quickly without knowing that latched relays can be knocked into an alternate state.
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: anotherjim on March 09, 2023, 05:15:21 AM
QuoteI don't quite follow... you're suggesting an extra cap that goes from the output of IC1C (pin6) to ground?
I mean a series cap out of pin 6 which would be in parallel with C1 when IC1c pin 6 switches to 0v. In fact, C1 can do the job and doesn't need another cap. Break the connection from pin 6 and move the bottom end of C1 from 0v to pin 6. The moment the RC timing on the input pin 5 goes high then pin 6 drops to 0v and fires the flip-flop to the 0v output state (If not already there). After that, it will obey the switch since pin 6 will remain at 0v.
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: anotherjim on March 09, 2023, 05:58:59 AM
This...

(https://i.postimg.cc/dtY1QhBk/latching-relay-driver-a-C1-mod.png)
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: bluelagoon on March 09, 2023, 08:58:35 PM
Okay, since this thread has come alive again, Here's my 2 cents worth, after countless hours of trial and error testing on the CMOS switching scenario. Here are my results, one circuit for Bypass @ Startup, and one circuit for FX on @ Startup, power on.
Both Circuits have a dual Temporary mute function that sends to GND the signal @ switch trigger, to minimize any switching audible clicks, thwacks, thumps, etc.. These circuits are tested and work well, hope this helps for any who are not yet ready for the MCU Switching Bypass scenario.


(https://i.postimg.cc/tnsZmYdg/FSw-Dual-Mute-Bypass-Startup.jpg) (https://postimg.cc/tnsZmYdg)



(https://i.postimg.cc/phTppp6B/FSw-Dual-Mute-FX-on-Startup.jpg) (https://postimg.cc/phTppp6B)
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: matt_garman on March 10, 2023, 10:55:57 AM
Quote from: bluelagoon on March 09, 2023, 08:58:35 PM
Okay, since this thread has come alive again, Here's my 2 cents worth, after countless hours of trial and error testing on the CMOS switching scenario. Here are my results, one circuit for Bypass @ Startup, and one circuit for FX on @ Startup, power on.
Both Circuits have a dual Temporary mute function that sends to GND the signal @ switch trigger, to minimize any switching audible clicks, thwacks, thumps, etc.. These circuits are tested and work well, hope this helps for any who are not yet ready for the MCU Switching Bypass scenario.

Thanks for posting!  If I'm not mistaken, that's a tweaked and more feature-filled version of Circuit B from the original post, right?

The second inverter (IC1B) and mosfets are responsible for the muting during switching, correct?  I.e., if you removed those from the circuit, you'd be left with a viable switching scheme that may suffer pops/thumps/thwacks during switching.

I'm having trouble understanding how that first inverter (IC1A) doesn't always see a "1" and thus always output a "0"?  The switch is a momentary switch, right?  I can see how the inverter would output a "1" momentarily when the switch is closed, but once the switch re-opens, won't the inverter once again go back to constant "1" input and "0" output?
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: bluelagoon on March 11, 2023, 01:11:06 AM
Hi Matt,
Yes it is a kind of reiteration on the circuit in the first post. Most of my understanding and concept of this type switching came from "Mictester "over on the Freestomboxes forum, there's a great thread there that details a lot on this type switching and various ways to achieve the end result , see the link -
https://www.freestompboxes.org/viewtopic.php?t=31684&sid=cfa1ec3ce2be598ad191301a0ed79cbe

Only there was never a way to reduce the inadvertent switching  clicks, thwacks and the like. So I utilized the concept of the temporary mute type arrangement where one temp mute circuit activates on switch in and the other on switch out, which is same ideally as how its done with an MCU microprocessor and also in various other audio equipment to keep out the unwanted switch clicks. If you want to test the efficiency of the temp mute, just add in a resistor from the Mosfet drain to an LED Cathode, with LED Anode to a positive voltage, this will give an indication on the time span of the temp mute and show it working adequately, it is pretty effective in reducing the switch noise issues.

And yes it is IC1B pin 4 of the 40106 that activates one side of the temp mute circuit either in or out, depending upon whether you are using the Bypass @ startup or the FX on at Startup circuit, they both differ in opposite ways where the mute function works,
The second side of the temp mute circuit comes off the Relay Positive input, where the charge into the 220uF Electrolytic allows a short pulse that activates the mosfet open to allow temporary GND to the Guitar Output Signal.

As for the way the circuit works it has an active "High Reset" circuit in components D4 and C4, which force the first stage schmitt trigger to always start up in High positive output, which is held in place, the second stage at pin 4 starts up in a low state GND, 0V. Then when the momentary switch is pressed the first stage goes low and the second stage goes high, always being held at the voltage accordingly.

Put it on a breadboard and see how it works, its a reasonable alternative to the Microprocessor pathway to True Bypass Relay Switching with a mute function. And there aren't a whole lot more components, especially if you end up shrinking them all down via SMD components, the circuit almost fits on a postage stamp.

Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: matt_garman on March 11, 2023, 11:34:24 AM
Thank you for the explanation, I appreciate it!  I definitely plan to play with this circuit.

I came here via that mictester thread you linked, as I've gone down a bit of a rabbit hole researching relay-based switching schemes.  Regarding those momentary muting mosfets, in that thread you mentioned, around here (https://www.freestompboxes.org/viewtopic.php?p=286152#p286152), concern was brought up about implicitly having diodes in the signal path, and the potential to clip - even the bypassed signal - if the voltage swing is big enough.  Do you have any thoughts on that?

Thanks again!
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: FSFX on March 11, 2023, 11:45:29 AM
With the dual MOSFETs and MOSFET relays the two substrate diodes are connected in series with opposite polarity so clipping would only occur at the breakdown voltage of the substrate diode. In most cases that would be over 60 volts. A lot of the higher voltage MOSFET relays are designed to work with up to 400 volts across them safely.
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: bluelagoon on March 26, 2023, 09:14:38 AM
Hi Matt, As for the concerns using just a single mosfet as the temp mute switch, the remedy to that is to use either 2 mosfets together or an optocoupler.
This eliminates any concern for grounded diodes causing clipping on the signal path. See the following image and web link for further explanation.
Also refer to FSFX response in the post above.
Cheers.

https://www.diystompboxes.com/smfforum/index.php?topic=130300.msg1263736#msg1263736


(https://i.postimg.cc/YLWwL3tH/MOSFET-Mute.png) (https://postimg.cc/YLWwL3tH)
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: bluelagoon on May 10, 2023, 07:47:48 PM
Hey FSFX, I was just wondering what you meant in what you said in that earlier post concerning the diodes and any potential clipping. Were you referring to the 2 mosfets that I had used for temporary muting function as shown in my posted circuit this thread?
You say that for the 2 substrate diodes in series with opposite polarity would only clip at the breakdown voltage of the substrate diodes, being in most cases over 60 volts.
Does that mean since these are being run in lower voltage type circuitry, that then they would never reach a clipping stage due to never being pushed to a 60 volt breakdown voltage?  Thanks, could do with some clarification on your meaning there.
Cheers
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: matt_garman on May 11, 2023, 02:28:00 PM
Based on @bluelagoon's incredibly helpful post (https://www.diystompboxes.com/smfforum/index.php?topic=118021.msg1262970#msg1262970), I created some PCBs of this momentary-switch controlled relay bypass circuit.  I created two versions, a "lite" version that omits the muting circuitry, and another that includes the muting function.

The only change I made to the design was to add another PNP between the logic gate and the relay-driving circuit.  The intent is to reduce any potential loading of the logic gate.

I used my "lite" PCB for a build I did, you can see it in my Snozzberry build report (https://forum.pedalpcb.com/threads/snozzberry-one-control-strawberry-red.16929/).  I've been using it daily for a couple weeks now; it works great!

Here is the schematic of the "lite" circuit:

(https://i.postimg.cc/3rfyPVK1/cmos-relay-bypass-lite-v3-1.png)

The nice thing about this circuit is it's fairly simple, and uses readily available commodity parts.  But it is a lot of parts.  I also worry about the long-term effects of using the capacitor for the current-pulse: the duration and voltage aren't precisely controlled.  If the pulse voltage is higher, or the pulse longer, than the relay design specifies, will that reduce its longevity?

That said, if anyone is interested, I'm happy to share the Gerber files for my PCBs and/or the KiCad files.  I also have plenty of spare PCBs, I'm happy to give those away, PM me if interested.

Also:
Quote from: bluelagoon on May 10, 2023, 07:47:48 PM
Hey FSFX, I was just wondering what you meant in what you said in that earlier post concerning the diodes and any potential clipping. Were you referring to the 2 mosfets that I had used for temporary muting function as shown in my posted circuit this thread?
You say that for the 2 substrate diodes in series with opposite polarity would only clip at the breakdown voltage of the substrate diodes, being in most cases over 60 volts.
Does that mean since these are being run in lower voltage type circuitry, that then they would never reach a clipping stage due to never being pushed to a 60 volt breakdown voltage?  Thanks, could do with some clarification on your meaning there.
Cheers

I think I can answer this by looking at your previous post (https://www.diystompboxes.com/smfforum/index.php?topic=118021.msg1263909#msg1263909), with the optocoupler and dual mosfets.  The way I look at it, with the "trigger" (i.e. mosfet gates) off, the circuit essentially becomes this:

---->|-----|<----

I.e., two series diodes, with reverse polarity.  Generally, current won't flow through such an arrangement, unless the breakdown voltage of the diodes is exceeded.  At least with solid-state pedals, we should never get anywhere near 60v, which makes such a diode arrangement effectively open.  Based on your image, looks like the optocoupler works on exactly the same principle, except the trigger is light-controlled (as opposed to voltage controlled).
Title: Re: Latching relay driver with CMOS - difference between these two circuits?
Post by: bluelagoon on May 11, 2023, 09:04:15 PM
Hey thanks Matt for you explanation on the diodes array, had thought that was what FSFX was alluding to.
And nice work on your redraw adaptation on that switching circuit, looks good, glad its working well for you.

Stumbled upon this recently, Its another CMOS type switcher that replicates the old mechanical type radio buttons, very cleverly designed. You can also replicate the same with Microcontrollers, but this using cmos, is another option without the programming needed'

https://www.instructables.com/Electronically-Interlocking-Radio-Buttons/

https://content.instructables.com/pdfs/EHL/MC3L/K2I415YA/Electronically-Interlocking-Radio-Buttons.pdf

Cheers.