Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

2 button toggle circuit

Status
Not open for further replies.

Sam1

New Member
Hi,
I'm building a guitar effects pedal that has two footswitches handling a separate circuit each but am struggling to understand how to make the switches toggle each other the way I want. Only one circuit must be on at a time or both must be off. I cannot have both on together.

• Switch 1 needs to activate circuit A and break circuit B
• Switch 2 needs to activate circuit B and break circuit A

I think I've managed the above with momentary switches and a couple of latching relays but it means that there is one circuit always on - it just toggles between them. I can't work out how to break both circuits by pressing the currently active switch, ie:

• If circuit A is active - press switch 1 to break circuit A and keep circuit B broken
• If circuit B is active - press switch 2 to break circuit B and keep circuit A broken

I need some help! I'm a bit of a newby to this and want to keep it as simple as possible. The switches are handling 9V to power the circuits, if that helps. It must be done with just two switches. I can't have a third kill-all switch.

I'm losing my mind over this last piece of the puzzle in my pedal!
 
Viewed as logic, I think you need two toggle circuits, which change state (on / off / on / off) each time the appropriate button is pressed.
Plus, a cross connection so if one turns on, the other is switched off, if it was on.

Pressing the already-on side again would switch both sides off.

You could do that with a CD4013 dual D type flip flop for the two on-off staged, plus something like a CD4093 schmitt trigger gate to use for switch input debounce and the cross-reset gating.



You could also do it with dual-coil latching relays, by starting with an alternate action circuit on-off circuit at each side, then using a feed through an extra relay contact to pulse the off coil of the other half as the relay turns on.

eg. This circuit gives alternate action from a single contact.

It would need a slight rearrangement and a bit of extra logic adding to allow one to be forced off each time the other turns on.
eg. Use a two-pole button at the other side of the coils so the left side is permanently grounded, then add an extra diode to feed the "off" coil of the opposite relay from the "on" side of each.
 
Hello

Is this what you need?

eT

1573750031578.png
 
I wish it were that simple, thanks!
In your diagram if A is on I'd have to first switch A off before pressing B to divert power.

I need to A to close when I activate B and vice versa (just one botton push), as well as A to close when I press its switch while it's active (which yours does)
 
Below is the LTspice simulation of a circuit that does what you want, using one IC, two MOSFETs, and six passive parts..
It uses CD4013 flip-flops (2 per package) as suggested by rjenkinsgb.
Cross coupling each input to the opposite FF clear input provides both the alternation action desired, plus allowing both to be switched off by a second-push of the same or both push-button(s).

Note that the push-buttons are momentary switches.
V1 and V4 simulate the PB operation.

The resistor and capacitor connected to the D inputs, provide the required debounce function for the mechanical push-buttons.
They prevent the FF from toggling again until after the debounce (RC) time.

I used P-MOSFETS to switch power to the circuits.
They can be just about any that can provide the required circuit current.

1573802781475.png
 
Last edited:
Note that the push-buttons are momentary switches.
V1 and V4 simulate the PB operation.
That's almost exactly what I was thinking of, is slightly simpler in fact - I was thinking of a gated reset rather than direct clear.

For infor for SAM1, it just needs a debounce between a mechanical switch and the input as shown in Crutshaw's schematic.

This is a typical example, you can use the 74HC14 or CD40106 schmitt inverter.

A switch to ground as shown will generate the positive pulse out, as needed by the 4013 circuit.
 
For infor for SAM1, it just needs a debounce between a mechanical switch and the input as shown in Crutshaw's schematic.
No, it already has a debounce circuit, as I explained.
The resistor and capacitor at the D input provides an RC delay to the change in the D input that prevents the flip-flip from changing states more than once during the debounce time.

And debounce isn't needed for the Clear inputs.
 
Last edited:
No, it already has a debounce circuit, as I explained.
The resistor and capacitor at the D input provides an RC delay to the change in the D input that prevents the flip-flip from changing states more than once during the debounce time.
Oops.. I missed that - very ingenious!

I was still thinking of the configuration I worked out, sorry.
 
I wish it were that simple, thanks!
In your diagram if A is on I'd have to first switch A off before pressing B to divert power.

I need to A to close when I activate B and vice versa (just one botton push), as well as A to close when I press its switch while it's active (which yours does)

Hi

Are your footswitches toggle? or are they momentary?
And what type of contacts (N.O, N.C., SPDT, etc.) do they have?

eT
 
Below is the LTspice simulation of a circuit that does what you want.
It uses CD4013 flip-flops (2 per package) as suggested by rjenkinsgb.
Cross coupling each input to the opposite FF clear input provides both the alternation action desired, plus allowing both to be off by a second push of the same push=button.

Note that the push-buttons are momentary switches.
V1 and V4 simulate the PB operation.

The resistor and capacitor connected to the D inputs, provide the required debounce function for the mechanical push-buttons.
They prevent the FF from toggling again until after the debounce (RC) time.

I used P-MOSFETS to switch power to the circuits.
They can be just about any that can provide the required circuit current.

**broken link removed**

Hi

This comment is really meant for Sam1. But if you "step" on both buttons at the same time it will clear both FF (a bad thing).
BTW-In another previous circuit, a latch relay was used so that the last state is always remembered. This is important during a performance (battery dies, etc.)

eT
 
Last edited:
eTech - any footswitch that works. The purchase will depend on a working circuit.

crutschow and rjenkinsgb - a lot for me to get my head around, but I will, thanks.

The pedal is only going to be mains powered. You say stepping on both will clear both FF. What does that mean exactly? It won't be a bad thing if it breaks both circuits if that's what you mean
 
eTech - any footswitch that works. The purchase will depend on a working circuit.

crutschow and rjenkinsgb - a lot for me to get my head around, but I will, thanks.

The pedal is only going to be mains powered. You say stepping on both will clear both FF. What does that mean exactly? It won't be a bad thing if it breaks both circuits if that's what you mean

ok...so is the pedal for effects? Or?
You mentioned it was a guitar pedal. I don’t know about you but I wouldn’t want the effect to cut off cause I accidently stepped on both switches... but it’s up to you.

clearing the flip flops means they will both be reset so both circuits will be cut off.

eT
 
He specifically requests the "both off" capability, which is why there could be some cross-purpose confusion?

I can't work out how to break both circuits by pressing the currently active switch, ie:

• If circuit A is active - press switch 1 to break circuit A and keep circuit B broken
• If circuit B is active - press switch 2 to break circuit B and keep circuit A broken
 
I believe my posted circuit meets all his requirements.
 
It's a pedal for effects. Effectively a patchbay tgat serves a particular niche purpose that nothing else seems to achieve. The pedant in me realises I should have called it a guitar effects' pedal with the apostrophe inserted.

Thanks again. I'm going to order parts to breadboard it and will report back in due xourse
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top