Relay True Bypass Switching Part 2: Momentary and Soft Touch Switches

This article builds on part 1 of the Relay True Bypass Switching series. If you have not read that article, please do so first.

One of the more outwardly recognizable signs of a pedal with momentary switching is a soft-touch footswitch. Most standard 3PDT guitar pedal footswitches have a distinctly loud "click" when actuated. This largely comes from the switch mechanism required for latching. Latching is required when controlling the on/off state of a guitar pedal with only a switch.

On the other hand, many relay switching designs allow for a simple SPST momentary footswitch. Since momentary switches do not require the latching mechanism, momentary footswitches can be very quiet when actuated, and often have a smoother feel. For example, soft touch footswitches (such as P-H604) are nearly silent, with little physical resistance. Some momentary footswitches still have a click when actuated, but it is no longer tied to a latching mechanism, and it can sound and feel quite different from a latching 3PDT footswitch. Carling Momentary footswitches (P-H552) require quite a bit of force to switch, but have a lower, softer "thud" when switched. The Lehle footswitch (P-H-LEHLE-BTN) has a small amount of physical resistance but a distinct actuation point which is accompanied by a light, satisfying "click" sound.

The relay schemes we will discuss here allow you to experiment with various footswitch types, but it also opens your pedal up to options beyond footswitches since momentary switches come in a wide variety of types. You could use arcade buttons, keyboard switches, momentary toggles, or standard pushbuttons to control the on/off state of your pedal.

Beyond the outward look, feel, and sound of momentary switches, there are other benefits to ditching the standard latching footswitch. Latching footswitches are often rated for around 10,000 cycles, and can be one of the first failure points in a guitar pedal. Momentary switches can last much longer. P-H552 from Carling is rated for 50,000 cycles while P-H-LEHLE-BTN is rated for 1,000,000 cycles.

D Flip-Flops

The switching scheme we will use in this article uses a D flip-flop. A D flip-flop is a logic device with two inputs that determine one output, and a second output that is the complement of the first output. The output complement is high when the standard output is low. The output complement is low when the standard output is high.

How D Flip-Flops Work

Figure 1: D flip-flop symbol

Figure 1: D flip-flop symbol

Table 1: D flip-flop truth table
~CK~ (clock input)~D~ (data input)~Q~ (output)~\text{~}Q~ (output complement)
Non-risingX (does not matter)No changeNo change
Rising edge001
Rising edge110

Table 1 is a D flip-flop truth table, which describes what state the outputs are in based on a given input. In the above table, a ~1~ means "logic high" while ~0~ means "logic low". Rising edge refers to the moment the input changes from ~0~ to ~1~. We will be using a 5 volt device, so logic high will be 5V and logic low will be 0V. Table 2 is the same truth table using the voltages that are used on a 5V device.

Table 2: D flip-flop truth table with voltages
~CK~ (clock input)~D~ (data input)~Q~ (output)~\text{~}Q~ (output complement)
Non-risingX (does not matter)No changeNo change
Rising edge (0V->5V)0V0V5V
Rising edge (0V->5V)5V5V0V

The moment when the clock input changes from 0V to 5V (a rising edge), the output ~Q~ becomes the same as the data input ~D~, and the output complement ~\text{~}Q~ will be the opposite of ~D~. At all other times, the outputs stay in their previous state regardless of what the data input is.

Figure 2: D flip-flop timing diagram

Figure 2: D flip-flop timing diagram

Figure 2 shows an example of how the outputs would change with a given input. Notice that when ~D~ changes, there is no change to the output until ~CK~ changes from low to high. Also notice that if ~D~ changes when ~CK~ is already high, ~Q~ will not change until ~CK~ becomes low and then changes from low to high again.

D flip-flops are just one type of flip-flop. flip-flops are critical building blocks for computers and other digital electronics, and they can be used and combined in many complex applications. You may not need to fully understand how a D flip-flop works to understand this pedal application, as we will be focusing on one fairly simple use.

Using a D flip-flop to Control a Relay

Our D flip-flop will control the relay’s state based on input from a momentary footswitch. We need the output ~Q~ to change every time the momentary footswitch is actuated. We can do this very simply by routing the output complement ~\text{~}Q~ to the data input, and connecting the switch to the clock input. By doing this, the input to ~D~ will always be the opposite of ~Q~, so every time the ~CK~ input changes from low to high (the switch is pressed), the output ~Q~ will switch to the opposite value, just like the way a latching footswitch will switch every time it is pressed.

Figure 3: Simplified D flip-flop application

Figure 3: Simplified D flip-flop application

The application in Figure 3 is very simplified, as we will need some additional surrounding circuitry to make the switch input and relay control output work the way we want, but Figure 3 illustrates roughly how the flip-flop will be connected and used.

Figure 4: 74LS175 quad D flip-flop symbol

Figure 4: 74LS175 quad D flip-flop symbol

For our switching circuit, we will be using a 74LS175 DIP integrated circuit (P-Q74LS175). 74LS175 contains four D flip-flops, though they all share one clock input. ~D0~, ~Q0~, ~\text{~}Q0~, and ~Cp~ will function as ~D~, ~Q~, ~\text{~}Q~, and ~CK~, respectively. ~\text{~}Mr~ is a master reset, which resets all flip-flops when its input is low (0V).

Figure 5: D flip-flop latching circuit

Figure 5: D flip-flop latching circuit

Figure 5 shows how we will use the 74LS175 in our switching circuit to get a latching output (~Q0~) from a momentary switch input. We will not be using the master reset. The master reset is active when low, so ~\text{~}Mr~ will be connected to 5V (high). ~VCC~ and ~GND~, the power pins, are connected to +5V and GND, respectively.

~SW1~ is a normally open momentary footswitch, such as the soft switch P-H604. Let’s consider pin 2 of our footswitch to be the output of the switch. We want pin 2 to be high (5V) when the switch is pressed, and low when it is not pressed. Pin 2 of the switch is connected to 0V through a 1k pulldown resistor ~R2~. This pulldown resistor keeps pin 2 low while the switch is open (unpressed). When the switch is closed (pressed), pin 2 is connected directly to 5V (high), and there is a 5V voltage drop across ~R2~. Without the pulldown resistor, ~SW1~ pin 2 would still be 0V when open, but +5V would be shorted directly to GND when the switch is pressed, which would at the very least prevent our circuit from functioning.

Switch Bouncing

Momentary switches, by nature, suffer from something called switch bouncing. Bouncing refers to the switch contacts actually mechanically bouncing off of each other when they come into contact. It happens very rapidly, but such bouncing would cause switch pin 2 to rapidly toggle between high (5V) and low (0V) when it is initially pressed or released. Because the flip-flop’s output toggles each time the input changes from low to high, we need to eliminate the switch bouncing so that the clock pin only sees the signal switch from low to high once each time the switch is pressed.

To fix the switch bouncing, or to "debounce" the switch, instead of connecting pin 2 of the footswitch directly to the ~Cp~ pin of the flip-flop, we connect pin 2 to ~Cp~ through a low pass filter consisting of ~C1~ and ~R1~. This lowpass filter will smooth the signal just enough to eliminate the jittering caused by the switch bouncing, but will not cause the switch to feel sluggish or unresponsive. The values of ~1kΩ~ and ~10μF~ have been carefully selected to make the switching feel natural while eliminating any bouncing issues, but if you’d like to experiment or change the response, you can modify the value of ~C1~. Higher values will cause the response to be smoother but slower. Lower values will be faster but more jittery, and more likely to have bouncing issues.

The rest of the flip-flop pins are connected as we previously discussed. ~D0~ is connected to ~\text{~}Q0~ just like ~D~ was connected to ~\text{~}Q~ in Figure 3. ~Q0~ is our latching output which will toggle from high to low or from low to high every time the footswitch is pressed, and we will use it to control the relay’s state.

Sourcing Enough Current

Figure 6: Non-working relay connection for 74LS175 flip-flop

Figure 6: Non-working relay connection for 74LS175 flip-flop

Ideally, we would be able to control our non-latching relay with ~Q0~ by connecting relay pin 1 to ~Q0~ and relay pin 10 to ground, as seen in Figure 6. This looks okay on paper - when ~Q0~ is low (0V), the relay should be in its default state, and when ~Q0~ is high (5V), the relay should be in its switched state. The problem is that 74LS175 (and many other flip-flop ICs) cannot source enough current to switch the relay. The 74LS175 can draw a maximum of 18mA total, and the coil of the TQ2-5V relay (P-RP-TQ2-5V) we will be using requires roughly 28.1mA to latch.

To circumvent this issue, we’re going to draw the necessary 28.1mA directly from the +5V power source instead.

Figure 7: Working relay connection for 74LS175 flip-flop

Figure 7: Working relay connection for 74LS175 flip-flop

Figure 7 provides a solution that allows us to draw current directly from the +5V source. To analyze the connection in figure 7, we will initially ignore ~D1~ and return to it later. Pin 1 of the relay is connected directly to 5V. If pin 10 was connected to ~GND~, the relay would be permanently in its switched state. Instead, we’ve inserted an NPN transistor P-QBC550 between pin 10 and GND. Pin 10 is connected to the transistor’s collector (pin 1) and the transistor’s emitter (pin 3) is connected to ~GND~. The transistor’s base (pin 2) is connected to ~Q0~, the output from the flip-flop, through a 10k resistor ~R1~. In this circuit, the transistor can be thought of as a type of switch. When no current is flowing into its base (pin 2), no current will be able to flow from its collector to its emitter. When current is flowing into its base, current can flow freely from its collector to its emitter, completing the connection from +5V through the relay coil, through the transistor, to ~GND~.

When ~Q0~ is low, no current flows into the transistor’s base so no current can flow through the relay. This means that the relay is in its unswitched state. However when ~Q0~ is high, current is flowing into the transistor’s base and current can flow from +5V through the relay coil, through the transistor from the collector to its emitter, to ~GND~. This current flowing through the relay coil will cause the relay to be in its switched state, and thus the relay will be toggled when ~Q0~ is toggled, which also means that our relay will switch every time the momentary footswitch is pressed. In Figure 7, ~R1~ exists simply to limit the current that flows from ~Q0~ into the transistor’s base, keeping the current drawn from the 74LS175 much lower than its maximum source current.

Now we will address the 1N4005 diode ~D1~. This diode is operating as a "flyback" or "freewheeling" diode. This type of diode is used in parallel with the coil of a relay to provide a current path for current remaining in the inductive relay when current stops flowing through the relay. This prevents voltage spikes that might otherwise form when the relay is switched off. It may not appear critical, but it prevents noise and damage that could be done to the surrounding components by these voltage spikes.

Complete Circuit for Momentary Footswitch

Figure 8: Complete relay circuit

Figure 8: Complete relay circuit

Figure 8 shows the complete circuit. There are a few additions not previously seen. Pins 2-4 and 7-9 of the relay have been wired up like a standard DPDT switch, as explained in part 1 of this tech corner article. At the top, the linear regulator ~U2~ is providing +5V for our circuit from a +9V input. P-QMC7805 and P-QMC78L05 would both work as a regulator. Capacitors ~C2~ and ~C3~ provide stability for the regulator. Note that a +12V input would also work instead of +9V, if using a pedal that runs on 12V power.

In figure 8, we are also using a second D flip-flop from the 74LS175 to control the pedal’s LED indicator. The second flip-flop uses pins ~D1~, ~Q1~, and ~\text{~}Q1~ (and ~Cp~ shared with the first flip-flop). We want it to have the same output as the first flip-flop, so that the LED is on when ~Q0~ is on (and thus the relay and effect are switched on). To create the same output at ~Q1~, we route the output of ~\text{~}Q0~ not only to ~D0~ but to ~D1~ also. Now every time ~Cp~ sees a low to high transition, ~Q1~ and ~Q0~ both use the same connection to determine their outputs and will match each other, so the LED is on when the effect is on.

Figure 8 allows for any normally open momentary switch to be used to control the true bypass of an effect and the LED. You can use soft switches, Lehle footswitches, Carling’s high quality momentary switches (P-H552 for normally open), momentary toggles, arcade buttons, and pretty much anything else you can think of. Note that the circuit in figure 8 could easily be adapted to a stereo effect. To do so, you would simply need to route ~\text{~}Q0~ into ~D2~ and use ~Q2~ to toggle a relay that switches the effect of a second channel on or off, just like ~Q0~ toggles the relay for the first channel.

Note that the relay used in this circuit is a non-latching TQ2-5V, not a latching TQ2-L-5V. The circuit in figure 8 will not work with a TQ2-L-5V. We also have not yet touched on any "smart" switching functionality that was mentioned in part 1.

In Part 3 of our Relay True Bypass Switching articles we will develop a microcontroller-based relay switching scheme which uses a latching TQ2-L-5V relay. Latching relays can provide substantial current savings over their non-latching counterparts, which we will take advantage of in part 3. We will also develop the core microcontroller software which we will later expand on with smart switching features.

Note that the information presented in this article is for reference purposes only. Amplified Parts makes no claims, promises, or guarantees about the accuracy, completeness, or adequacy of the contents of this article, and expressly disclaims liability for errors or omissions on the part of the author. No warranty of any kind, implied, expressed, or statutory, including but not limited to the warranties of non-infringement of third party rights, title, merchantability, or fitness for a particular purpose, is given with respect to the contents of this article or its links to other resources.