1
\$\begingroup\$

I am an absolute beginner in electronics. So far I have created a circuit with 2 LEDs and 2 SPST pushbuttons, each controlling a different LED. Very simple, you should get the idea without me drawing a circuit.

I've been trying to figure out how to add a third pushbutton, which would control both two LEDs at the same time, without altering the functionality of the two existing two pushbuttons.

Is it even possible to achieve this with 3 SPST pushbuttons, without adding any other components? If not, I am interested in learning what would be the simplest design to achieve this. Thank you.

\$\endgroup\$
4
  • \$\begingroup\$ It depends. What are your requirements? What should the third button exactly do? A truth table would help. \$\endgroup\$ – marco-a Jan 7 '16 at 23:24
  • \$\begingroup\$ The simplest solution is entirely different from the minimal GPIO count solution. Simplest is to just allocate one GPIO per switch and one GPIO for each LEDs. Minimal number of GPIOs is more complicated requiring more complex software and often entails extra components outside the MCU boundary. \$\endgroup\$ – Michael Karas Jan 7 '16 at 23:56
  • 1
    \$\begingroup\$ @MichaelKaras I don't see any CPU in this question, just switches and lights. \$\endgroup\$ – Icy Jan 8 '16 at 8:39
  • \$\begingroup\$ would be easy if your third button was DPDT, or add a DPDT relay driven by your third SPST switch, but as d3l says a truth table of what you want to achieve here would help. \$\endgroup\$ – Icy Jan 8 '16 at 8:41
2
\$\begingroup\$

No. Without adding extra components (Diodes) you can not use SPST buttons.

schematic

simulate this circuit – Schematic created using CircuitLab

If you use a DPST or DPDT switch instead, quite easy to find, you can avoid the diodes. You would ignore the extra pins on the DPDT switch.

schematic

simulate this circuit

\$\endgroup\$
1
\$\begingroup\$

Sure, it's possible. LEDs are nonlinear and we can take advantage of that:

schematic

simulate this circuit – Schematic created using CircuitLab

When SW1 or SW2 are pressed, the respective LED will light, however the opposite one sees less than half the voltage and will not pass any significant current (so will emit no light). Pressing SW3 causes both LEDs to illuminate.

It wastes a bit of current because of R4 (~3x the current for one LED rather than double to light two LEDs) but that's a small price to pay for a solution.

\$\endgroup\$
2
  • \$\begingroup\$ Of course that requires two extra resistors, and depending on the resistance and voltage values will still cause an led to light (very little current is needed sometimes), might as well use the diode setup instead. \$\endgroup\$ – Passerby Jan 8 '16 at 1:42
  • \$\begingroup\$ @Passerby This circuit might be better if the supply voltage is close the the LED Vf. It's easier to use a gate chip or transistors or whatever. \$\endgroup\$ – Spehro Pefhany Jan 8 '16 at 1:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.