Plug-n-Play Buffered Electrical Bypass Using CD4053 and Momentary SPST

Started by matt_garman, January 19, 2025, 01:49:05 PM

Previous topic - Next topic

matt_garman

I want to create a buffered electrical bypass scheme activated by a momentary SPST switch (similar conceptually to what is found in most Boss pedals).  I want it to be "plug n play" in that it's generic enough to work with most typical effect PCBs (e.g. PedalPCB, EffectsLayouts, AionFX, etc).  And rather than use discrete components like Boss does, I thought it might be simpler to use ICs.

The basic idea is:
  • TL072 signal buffer
  • CD40106 CMOS inverter for footswitch control and status LED driver
  • CD4053 for electrical analog signal switching

The buffer is standard fare, nothing interesting here.

I've been using this hex inverter switching control scheme for a year or so now with success (see here).  Since controlling a single momentary footswitch requires only two inverters, there are four spares.  I left one unused, and paralleled three to drive the status LED.

The CD4053 switching scheme is copied from RG Keen's article: Bypassing and Switching with the CD4053 CMOS Analog MUX.

I've attached a schematic.  The only thing I'm not really sure about is the connection between the signal buffer and the input to the CD4053.  I omitted the 1M pulldown resistor and DC-blocking cap on the CD4053 side, thinking I already have a DC-blocking cap (C5) after the buffer, and a 10k (R7) pulldown resistor.

Any other obvious errors I've made?

One assumption is that the effect circuit itself has DC-blocking caps on the input and output.

And a side question: it seems like overall this circuit could be simplified with a bipolar power supply, right?  That removes the need for all the VREF biasing, and some of the DC-blocking caps.  Looks like at least the Texas Instruments CD4053 can run at +/- 9V.  Plus that would give the buffer more headroom.  (Of course the tradeoff is generating the -9V rail.)

I appreciate any input!


ElectricDruid

I think it's a really good idea. I'd thought of doing something similar myself, except I was going to use a relay and a processor because that's my bag. The great thing about these kind of boards is that they can be either/or - you could design several compatible little PCBs that either do 4053 switching like you've designed, or do relay switching like I worked on, or do simple 3PDT true bypass. And they can all have the same pinout, so you can choose which you want for a specific job and drop it in.
And that brings me to my first query: pinout. I looked at Aion and some of the other people who'Ve done similar things, and there's (as yet) no standardised pinout for these bypass boards, which is a pity. I've seen both 4-pin and 6-pin connectors going to the board, and the pin order varies. I think we should all agree to pick one and run with it. It'd make life a lot simpler for everyone if we had a standard for this. You've got *9* pins which is different again...
Oh, and perhaps the third switch should be used for Effect On/Off LED switching. Some PCBs have an LED on the board and expect it to be wired to a 3PDT to turn it on and off. Since it's there, you could offer that feature.

Ok, the circuit..

1) Could you move C3 to the other end of R5? Then you could combine R4+R5. Saves one part.
2) What does R7 do? It seems to be in parallel with R10 on the switch IC.
3) Does it have to be through-hole? Using a big chip like the 40106 and then only using a third of it seems like a waste of space. You can get individual invertors in a tiny package, I think. Perhaps you were going to use a SMD 40106, in which case this isn't such a concern.
4) The 470K/470K divider with 47u across it is going to take a *loooong* time to charge up when you turn the power on. Ten minutes.
5) On the other hand, C1 has no resistance at all apart from the internal resistance of a conducting diode, 1N5817, so it doesn't make much of a lowpass filter. It'd be better to have a small R in series with the diode to get the best out of the cap.

I hope this helps!

Tom

matt_garman

Thank you Tom for the helpful reply!

Quote from: ElectricDruid on January 19, 2025, 02:42:01 PMI think it's a really good idea. I'd thought of doing something similar myself, except I was going to use a relay and a processor because that's my bag. The great thing about these kind of boards is that they can be either/or - you could design several compatible little PCBs that either do 4053 switching like you've designed, or do relay switching like I worked on, or do simple 3PDT true bypass. And they can all have the same pinout, so you can choose which you want for a specific job and drop it in.

I've actually done two designs using mechanical relay bypass, one that's microcontroller controlled, and the other is CMOS inverter controlled.  Here's a writeup for the microcontroller-based one (GitHub repo for code).  Here's where I discuss the inverter-based design.  I've done a few iterations/variations on each scheme.

Quote from: ElectricDruid on January 19, 2025, 02:42:01 PMAnd that brings me to my first query: pinout. I looked at Aion and some of the other people who'Ve done similar things, and there's (as yet) no standardised pinout for these bypass boards, which is a pity. I've seen both 4-pin and 6-pin connectors going to the board, and the pin order varies. I think we should all agree to pick one and run with it. It'd make life a lot simpler for everyone if we had a standard for this. You've got *9* pins which is different again...

I agree, there is no standard.  AionFX is particularly tricky, because sometimes he puts actual circuit components on the bypass breakout board (presumably when he runs out of space on the effect board).  So it's really hard to make anything generic for those PCBs.  I'm looking at this design as a prototype right now, so offboard wiring layout can be refined in a subsequent version.  For now, you just have to use wires and pay attention.  :)

Also, my other plan for this circuit is a reusable block that can be directly added to a custom effect PCB.

Quote from: ElectricDruid on January 19, 2025, 02:42:01 PMOh, and perhaps the third switch should be used for Effect On/Off LED switching. Some PCBs have an LED on the board and expect it to be wired to a 3PDT to turn it on and off. Since it's there, you could offer that feature.

Also agreed.  However, when I was researching threads here discussing the CD4053 bypass scheme, one concern with using that unused switch for the LED was can the 4053 source/sink enough current for the LED (probably yes).  But another concern was, could the proximity of the LED's DC flowing through the switch add noise to the audio signal?  So for prototype purposes, we're forced to wire the LED to this breakout; in the future, I'll likely just add a MOSFET for LED switching.

Quote from: ElectricDruid on January 19, 2025, 02:42:01 PM1) Could you move C3 to the other end of R5? Then you could combine R4+R5. Saves one part.

Done!  I believe that's essentially an RF filter; is 200R + 47pF ideal here?

Quote from: ElectricDruid on January 19, 2025, 02:42:01 PM2) What does R7 do? It seems to be in parallel with R10 on the switch IC.

I'm not completely sure myself.  I shamelessly copied that buffer design.  R7 is not in parallel with R10, as R7 connects to GND, and R10 connects to VREF.  In RG's description of the 4053 switching scheme, he (essentially) uses a 1M to GND for what is R7 in my schematic.  I believe the purpose is to be a pulldown resistor to prevent popping when switching (i.e. provide a way for the DC-blocking caps to discharge).

But, indeed, this is the main area of this circuit I wasn't sure about.

Quote from: ElectricDruid on January 19, 2025, 02:42:01 PM3) Does it have to be through-hole? Using a big chip like the 40106 and then only using a third of it seems like a waste of space. You can get individual invertors in a tiny package, I think. Perhaps you were going to use a SMD 40106, in which case this isn't such a concern.

For the prototype, it will be through-hole.  But yes, once this design has been validated and is reasonably mature, the next step would be to have it pre-made in SMD.  (I did exactly this with my inverter+relay design, had several manufactured for me by JLCPCB.)

Quote from: ElectricDruid on January 19, 2025, 02:42:01 PM4) The 470K/470K divider with 47u across it is going to take a *loooong* time to charge up when you turn the power on. Ten minutes.
5) On the other hand, C1 has no resistance at all apart from the internal resistance of a conducting diode, 1N5817, so it doesn't make much of a lowpass filter. It'd be better to have a small R in series with the diode to get the best out of the cap.

I dropped the divider down to 47k/47k, and added a series 100R.

That was very helpful, thank you so much!

Updated schematic attached.



ElectricDruid

Ok, I'm liking it much more!  ;D

I still think there's a problem with R7 and R10 though. R10 exists to bias the input of the 4053, so that's good. But R7 is dragging that bias voltage off somewhere else and stopping R10 from doing its job properly. R7 is presumably there to drain charge on C5 (like R13 does for C10), which makes sense if that buffer is a stand-alone thing, with BUFFERED_IN going to a jack - but that's not the case here. R10 can do the job that R7 was intended for, so get rid of R7.

200R and 47pF is about 17MHz, so it's absolutely *only* an RF filter. I'd probably make the cap larger and push the cutoff down an octave or two. Honestly though, I don't know what the "recommended" value would be for an RF filter like that. I was taught that you limit bandwidth to only the stuff of interest pretty much whenever you can, since anything else that gets in or out is noise. Whether that's the best policy here, I dunno. RF is outside my area of knowledge.

Oh, and I agree about your point about current handling being an issue for using the 4053 to switch the LED. A MOSFET or a simple BJT to ground to switch the LED makes more sense from that point of view *and* keeps the LED switching current out of the chip where the audio is being dealt with. So yeah, a better solution all around.

HTH

matt_garman

Quote from: ElectricDruid on January 19, 2025, 05:14:24 PMI still think there's a problem with R7 and R10 though. R10 exists to bias the input of the 4053, so that's good. But R7 is dragging that bias voltage off somewhere else and stopping R10 from doing its job properly. R7 is presumably there to drain charge on C5 (like R13 does for C10), which makes sense if that buffer is a stand-alone thing, with BUFFERED_IN going to a jack - but that's not the case here. R10 can do the job that R7 was intended for, so get rid of R7.

Makes sense, done!

Quote from: ElectricDruid on January 19, 2025, 05:14:24 PM200R and 47pF is about 17MHz, so it's absolutely *only* an RF filter. I'd probably make the cap larger and push the cutoff down an octave or two. Honestly though, I don't know what the "recommended" value would be for an RF filter like that. I was taught that you limit bandwidth to only the stuff of interest pretty much whenever you can, since anything else that gets in or out is noise. Whether that's the best policy here, I dunno. RF is outside my area of knowledge.

I dropped the resistor to 150R (mostly because it's an E6 value), and then upped the cap to 1nF.  Per your calculator, even going up to 3n3 (with 150R) is still up in the 100s of kHz, so well out of the audio band.  I went with 150R + 1nF, as that's right at 1.1 MHz.

Thanks again!


Andon

Looks pretty good to me. The voltage divider on the power supply can be 10K/10K/10uF, which works well for me. Also, with R5, depending on the circuit that you are powering you may or may not have issues with a lack of available current on start-up - this was an issue I faced with a design that used four PT2399s, and I had to actually drop the input resistor completely to get it to work (which removes the low pass filtering on the power supply, but this is something to consider if you ever have an issue with current availability).
  • SUPPORTER

PRR

> upped the cap to 1nF

That's potentially the electric guitar pickup input? 1nF, 1,000pF, is like 30 feet 10m of cable. The type of heavy load we normally want to isolate with a buffer.

It's just a guitar input, don't re-invent, plagiarize.
  • SUPPORTER

matt_garman

I believe the above schematics have the LED driver wired backwards (LED should be on when the control signal is high).  Also put that RF filter cap back down to 47pF.




R.G.

You might consider using a CD4049 instead of the CD40106. Schmitt trigger inputs are great, but the 4049 works well in practice, and offers much higher current out. One section of a 4049 is OK for reasonable LED currents. That leaves a couple of spare sections for other LED driving.

The one- and two-gate SMD packages all seem to be limited to 6V or less for their power supply. I've been frustrated by this in the past. You can make a lower voltage supply for just the switching IC, but it's a little more complicated. If you did, it would make for a one 6-lead flipflop and SOT-23 transistors for switching LEDs.

The input from section c, pin 4 I think, needs to be tied to something, not left open. No CMOS input should ever be left open, as they will happily switch with the voltage across the air and PCB.
Maybe better, replace the floating switch on the flipflop with the spare section of the 4053 and arrange the incoming momentary switch to work section C. The advantage of this is that the momentary switch that toggles the state can now be a switch to ground, not floating. Switches to ground are nearly always better if you can arrange it.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Andon

The 4049 that R.G. suggested is a great idea (though I still use the 40106 myself ha), just remember that it has a different pinout if you choose to go that route (inputs and outputs are reversed for each section).
  • SUPPORTER

matt_garman

Is the main advantage of CD4049 over CD40106 just the current sourcing/sinking ability?  Using the CMOS logic chip to drive the LED was only a prototype simplification.  Attached is how the LED will actually be driven.  So four of the six inverters are actually unused.  A transistor will be used to switch the LED on or off.

In this schematic, I wired the input of the "C" switch of the CD4053 to ground, but left the outputs floating.

I don't quite follow the suggestion to use CD4053 section "C" for the momentary switch.



Thanks again everyone!

Andon

If you're not using the other two inverters for anything else you could always just use them as buffers for each latch/switch (just connect the second inverters to the thirds and use that as your switch driver inputs).
  • SUPPORTER

R.G.

Quote from: matt_garman on January 20, 2025, 04:51:43 PMIs the main advantage of CD4049 over CD40106 just the current sourcing/sinking ability?
Yes. It could save you using a separate MOSFET by using the unused sections for LED drivers.
QuoteI don't quite follow the suggestion to use CD4053 section "C" for the momentary switch.
The problem with the two-inverter latching flipflop in this application is that the momentary switch to make it flip has to float. One side can't be tied to ground or Vdd. I consider that offboard switches are better done with contacts to ground. This is compatible with lots of things, and in this application you could get a remote footswitch input, for instance.
Section C of the CD4053 is unused, and its switch contacts contain a common and two throws. The input is a logic level, referenced to ground. You could hook up the C input to a pullup resistor and a momentary switch to ground for the activating footswitch, and use the common and one throw of the C section of the 4053 instead of your SW1.
This would let the input to the whole circuit be a momentary contact to ground, instead of SW1, which is not referenced to ground.
Here's another set of parts that would work.
74LVC2G14 in SOT23-6 package gives two Schmitt input inverters for the flipflop. Vdd max is 5.5V, so a 5V zener or an SOT-25 regulator gives 5V to power the chip.

CD4053 needs minimum 7V high logic signal. Use SOT-23-6 dual MOSFET, one drain pulled up to 9V for driving the 4053's switch inputs, and the other to switch an LED. The 5V double inverter is happy on its lower Vdd.

R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

PRR

> save you using a separate MOSFET by using the unused sections for LED drivers.

The plan posted has 10k LED resistors and a 9V supply? There's no way it needs even 1mA, which all the usual CMOS gates will deliver even at 9V supply. Extra parts, no benefit?
  • SUPPORTER

matt_garman

Quote from: R.G. on January 20, 2025, 10:18:29 PMThe problem with the two-inverter latching flipflop in this application is that the momentary switch to make it flip has to float. One side can't be tied to ground or Vdd. I consider that offboard switches are better done with contacts to ground. This is compatible with lots of things, and in this application you could get a remote footswitch input, for instance.

I thought that might be the concern, as you've pointed this out to me before.


Quote from: R.G. on January 20, 2025, 10:18:29 PMSection C of the CD4053 is unused, and its switch contacts contain a common and two throws. The input is a logic level, referenced to ground. You could hook up the C input to a pullup resistor and a momentary switch to ground for the activating footswitch, and use the common and one throw of the C section of the 4053 instead of your SW1.
This would let the input to the whole circuit be a momentary contact to ground, instead of SW1, which is not referenced to ground.

Thanks!  I understood the intent, just couldn't quite put the pieces together.  I believe the attached schematic now does what you're suggesting.

S3/pin 9 is the logic/control line for switch C.

If I have this right, with S3 pulled high, input C (pin 4) should be connected to output C0 (pin 5).  When the SPST momentary footswitch is pressed, S3 is shorted to ground, which will cause input C to connect to output C1 (pin 3), for as long as the switch is pushed down.

I still have the logic control with the CD40106, as I'm hesitant to give up the Schmitt inputs.  And if I'm reading the datasheets correctly, the CD40106 can source/sink only slightly less current than the CD4049.  So two CD40106 inverters in parallel ought to be plenty to drive a LED, right?



R.G.

Quote from: matt_garman on January 20, 2025, 11:33:23 PMThanks!  I understood the intent, just couldn't quite put the pieces together.  I believe the attached schematic now does what you're suggesting.

S3/pin 9 is the logic/control line for switch C.

If I have this right, with S3 pulled high, input C (pin 4) should be connected to output C0 (pin 5).  When the SPST momentary footswitch is pressed, S3 is shorted to ground, which will cause input C to connect to output C1 (pin 3), for as long as the switch is pushed down.
I think that pin 4 connects to pin 3 with S1 pulled high, and that when S1 connects, pin 4 is connected to pin 5. I believe you need to change pin 5 for pin 3. I find the CD405x series datasheets confusing.
QuoteI still have the logic control with the CD40106, as I'm hesitant to give up the Schmitt inputs.  And if I'm reading the datasheets correctly, the CD40106 can source/sink only slightly less current than the [...]CD4049.  So two CD40106 inverters in parallel ought to be plenty to drive a LED, right?
Yeah, probably so. I just have this bias for making more current available. It'll probably work fine

Quote from: PRR on January 20, 2025, 11:14:49 PMThe plan posted has 10k LED resistors and a 9V supply? There's no way it needs even 1mA, which all the usual CMOS gates will deliver even at 9V supply. Extra parts, no benefit?
Yeah, probably it's fine. I just like to have more current available for LEDs if it's easy.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

matt_garman

#16
Quote from: R.G. on January 21, 2025, 11:08:23 AMI think that pin 4 connects to pin 3 with S1 pulled high, and that when S1 connects, pin 4 is connected to pin 5. I believe you need to change pin 5 for pin 3. I find the CD405x series datasheets confusing.

Good catch, thank you!

I'll update the schematic later.

Regarding driving the LED with the inverter: I'm going to side-step this entirely, and just use a transistor to drive the LED.  Mainly because it makes the circuit compatible with many readily available PCBs (e.g. PedalPCB, Aion, etc).

Going back to the discussion above regarding the connection between the signal buffer and the CD4053: are C5 and R10 actually necessary here?  C5 is the DC-blocking cap on the opamp's output, and R10 is the bias resistor for signal input A of the CD4053; I have this line labeled BUFFERED_IN.

Since the opamp is wired as a buffer, I believe Vin = Vout, so the output should already be biased to VREF - in which case we can take the opamp's output straight to the CD4053 input (keeping the feedback loop of course)?

antonis

Quote from: matt_garman on January 21, 2025, 12:51:25 PMSince the opamp is wired as a buffer, I believe Vin = Vout, so the output should already be biased to VREF - in which case we can take the opamp's output straight to the CD4053 input (keeping the feedback loop of course)?

Yes, without C5..
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

R.G.

Quote from: matt_garman on January 21, 2025, 12:51:25 PMGoing back to the discussion above regarding the connection between the signal buffer and the CD4053: are C5 and R10 actually necessary here?  C5 is the DC-blocking cap on the opamp's output, and R10 is the bias resistor for signal input A of the CD4053; I have this line labeled BUFFERED_IN.

Since the opamp is wired as a buffer, I believe Vin = Vout, so the output should already be biased to VREF - in which case we can take the opamp's output straight to the CD4053 input (keeping the feedback loop of course)?
A lot depends on your objectives. If you can only afford to do one iteration of a PCB for this, leave in the PCB footprints for C5 and R10, but bridge the C5 position with a minimum-width track. Then populate the board, leaving off C5 and R10 and see if its still click-free and has no audible or ultrasonic funnies. It it all works out, all its cost you is the PCB space for a C5 and R10 you don't populate. If it has funny artifacts, you can cut the trace and solder in a C5 and R10 until you get a new spin of the PCB done. That is - its all secondary considerations.

It's probably fine.
However, the click-free-ness of the biased 4053 depends on the balance of the DC levels in its P-channel and N-channel parts cancelling one another's feedthrough. I have this nagging conservativeness about counting on every version/maker's ICs having the right mix of non-specified cancellation inside. I'm a worrier.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

matt_garman

Quote from: R.G. on January 21, 2025, 05:28:27 PMIf you can only afford to do one iteration of a PCB for this, leave in the PCB footprints for C5 and R10, but bridge the C5 position with a minimum-width track. Then populate the board, leaving off C5 and R10 and see if its still click-free and has no audible or ultrasonic funnies. It it all works out, all its cost you is the PCB space for a C5 and R10 you don't populate. If it has funny artifacts, you can cut the trace and solder in a C5 and R10 until you get a new spin of the PCB done.

That's perfect - will leave space for them, so I can easily test with vs without.  This is a prototype board, since the long-term goal is to have these pre-made using SMD.  The initial board design with through-hole components is 59x34mm, even using 1/8 watt sized resistors!


Quote from: R.G. on January 21, 2025, 05:28:27 PMHowever, the click-free-ness of the biased 4053 depends on the balance of the DC levels in its P-channel and N-channel parts cancelling one another's feedthrough. I have this nagging conservativeness about counting on every version/maker's ICs having the right mix of non-specified cancellation inside. I'm a worrier.

And now I'll be worried/neurotic about it!  :)

Updated schematic attached, as well as initial PCB layout.  Following the theme of RG's advice above, I went ahead and added DC blocking caps to the effect send/return lines (can replace with a wire if not needed).  Those ICs and 1uF film caps take up a lot of space.  SMD should shrink that considerably, particularly if I use ceramic caps.  Ceramic or electrolytic for the DC-blocking caps in the signal path (as SMD film caps seem to be very expensive)?