Help modifying switching behaviour of radio-button circuit.

Thread Starter

Schluppy

Joined Jun 7, 2024
29
Hey all, I'm new to the forums and new to electronics. Please be gentle if I say or suggest anything completely boneheaded. :D
What I'd like to do is modify the switching behaviour of the "radio-button" circuit illustrated below such that a 2nd press of the SPST pushbutton disables the LED in its corresponding "block."

If we assume two "blocks"...

  • Block A, containing
    • BUTTON-01; and
    • LED-01
  • Block B, containing
    • BUTTON-02; and
    • LED-02

... the current switching behaviour is as follows:

  • On power-up
    • LED-01: disabled
    • LED-02: disabled
  • BUTTON-01 activated
    • LED-01: enabled
    • LED-02: disabled
  • BUTTON-02 activated
    • LED-01: disabled
    • LED-02: enabled

If either BUTTON is activated, then activated a 2nd time, there is no change in the LED states.

The desired switching behaviour is as follows:

  • On power-up
    • LED-01: disabled
    • LED-02: disabled
  • BUTTON-01 activated
    • LED-01: enabled
    • LED-02: disabled
  • BUTTON-01 activated a 2nd time
    • LED-01: disabled
    • LED-02: disabled
  • BUTTON-02 activated
    • LED-01: disabled
    • LED-02: enabled
  • BUTTON-02 activated a 2nd time
    • LED-01: disabled
    • LED-02: disabled

I am not concerned with the switching behaviour when two or more buttons are activated simultaneously.

I'm also not interested in MCUs or software. I was a software developer in a previous life. There's not much challenge left in that domain. ;)

If you're wondering why half of the 4013 is sitting there unused it's because I want each "block" (excepting power, ground, and whatever logic/data lines are required) to be self-contained or "modular".

If there was such a thing as a single d-type flip flop in a DIP package, I'd be using it. But it appears that they're extinct.

Consequently, and as this self-contained/modular aspect is critical, the unused flip flop is fair game for any ideas that you might have.

As I'm new to this stuff I'm not sure how to approach this.

The software developer in me thinks I need only to track the button activations and send a pulse to the appropriate input. Something like:

Bad Pseudo-code:
$b1_count = 0;

while(true)
{
    if(true === $b1_activated) // BUTTON-01 has been pressed
    {
        switch($b1_count)
        {
            case 0:
            // send a HIGH signal to the SET input of U1A
            $b1_count = 1;
            break;
            case 1:
            // send a HIGH signal to the RESET input of U1A
            $b1_count = 0;
            break;
        }
    }
}
Assuming that's a valid/wise/advisable approach, I'm unsure how to implement such a thing in hardware.

I was thinking a 2-bit ring counter using another 4013 -- where Q of the 1st bit goes to the SET input and Q of the 2nd bit goes to the RESET input -- but I've been unsuccessful in my attempts to breadboard this so far.

Any ideas/suggestions/solutions?

The end-game is to build an A/n audio input switcher (think A/B switcher but not limited to just A & B).

However, to begin learning how these components work, I thought it would be wise to start with just the switching behaviour. I don't want to get too deep too soon and frustrate myself any more than necessary. :D

Thanks much!
 

Attachments

Clear all four Dflops after power-on by Clr pins (you can connect OR gates to Clr pins so Dflop can be cleared from buttons and power-on also).
The 2nd and 4rd flops just remembers if 1st and 3rd was set already. If yes, the 2nd and 4rd doesn’t allow the 1st and 3rd to be set anymore until opposite button has been set previously.
IMG_0895.jpeg
 
Last edited:

Thread Starter

Schluppy

Joined Jun 7, 2024
29
Thanks @Michal Podmanický, I appreciate the reply! :)

If I'm understanding your schematic correctly, and there's a pretty good chance that I'm not so PLEASE correct me if I'm mistaken, this would require each button to have a distinct connection to every other Flip Flops' CLR input. Is that correct?

If so, I imagine that that would quickly become unmanageable with more than two sets, or "blocks."

The advantage to the circuit I've posted, which helps to meet the "self-contained/modular" plus (theoretically) infinitely expandable constraints I've imposed, is the shared "clock line" which permits me to add as many "blocks" as I desire without requiring distinct connections between each button and each Flip Flop.

My breadboard, right now, has Block A from my schematic duplicated 4 times. So, I have A, B, C, and D radio buttons available with only the power, ground, and clock lines shared between them. It works as expected. It just doesn't have the "2nd press to disable" behaviour that I'm after.
 
The connection of button to every other flops is required for only one Led can be On in same time.
Like Led1 is On and Button2 is pressed turn Off the Led1 and turn on Led2.
 

Thread Starter

Schluppy

Joined Jun 7, 2024
29
So, I've been messing around with this for the past few weeks and I've got it working... mostly.

I swapped out the SPST momentary button for a DPDT momentary button and used the 1st flip-flop in the 4013 to debounce the 1st pole of the button.

The 2nd pole of the button breaks the connection between the common RESET line and the R input of the 2nd flip-flop in the 4013 (which is configured as a toggle) when the button is depressed.

On my breadboard right now I have one block of this modified circuit (see below) and three blocks of the original circuit from my opening post. They all share the common RESET line.

This modified circuit works 80% of the time. I activated the button 100 times. 20 of those activations misbehaved. Either the LED didn't illuminate at all or the LED illuminated only while the button was depressed, returning to an off state when the button was released.

The actual "radio button" behaviour of each block, and between each block, works perfectly. But 20% of the time this modified circuit gets into an indeterminate state somehow.

My instinct says it's a crappy/faulty button -- I've more buttons coming to test that theory -- but my inexperience suggests that there's something fundamentally wrong with the circuit and/or my understanding of this stuff.

Ideas? Advice?

Here's a link to the Mouser page for the button in question.

And the modified circuit:

20240726.153632.png
 
Top