Electronics > Projects, Designs, and Technical Stuff
Control 4 switch with 2 pins
Yaroooo:
Hello,
I've left 2 free pins on my MCU, unfortunately I can't change MCU pin package and I must control 4 switches.
I don't need a MUX to choose witch switch to open, but something like:
00 - Switch 1 Closed
01 - Switch 1 & 2 Closed
10 - Switch 1 & 2 & 3 Closed
11 - Switch 1 & 2 & 3 & 4 Closed
Is there a small package device that allow me this?
Thanks for any support!
Nusa:
--- Quote from: Yaroooo on September 26, 2019, 09:33:13 am ---Hello,
I've left 2 free pins on my MCU, unfortunately I can't change MCU pin package and I must control 4 switches.
I don't need a MUX to choose witch switch to open, but something like:
00 - Switch 1 Closed
01 - Switch 1 & 2 Closed
10 - Switch 1 & 2 & 3 Closed
11 - Switch 1 & 2 & 3 & 4 Closed
Is there a small package device that allow me this?
Thanks for any support!
--- End quote ---
That example simplifies to switch 1 hardwired, so only 3 switches left to deal with.
But if you intended to control 4 switches plus an off, then you have the problem of 5 states for 4 combinations.
I'd suggest using the two lines for data and clock and using a shift register to control your switches, plus the ability to use the switches in any combination you like.
German_EE:
A B
0 0 Switch 1 wired permanently closed
0 1 OR gate connected to A and B with
output to switch 2, switches 1 and 2 now closed
1 0 Switch 1 on, Switch 2 on through OR gate
Switch 3 connected to A. Switches 1, 2 and 3 now closed
1 1 AND gate connected to A and B with
output to switch 4. Switch 1 on, switch
2 on through OR gate, switch 3 on
through connection to A, switch 4 on
through AND gate.
So, you can do this with one OR gate and one AND gate, available in a single 74HC58 IC, isn't Boolean Logic fun!
Edit: Added 74HC58 information
Caliaxy:
--- Quote from: Yaroooo on September 26, 2019, 09:33:13 am ---Hello,
00 - Switch 1 Closed
01 - Switch 1 & 2 Closed
10 - Switch 1 & 2 & 3 Closed
11 - Switch 1 & 2 & 3 & 4 Closed
Is there a small package device that allow me this?
--- End quote ---
If you only need these four combinations (i.e. you never need all four switches off), a creative solution would be to use a BCD decoder (such as CD4543B, https://www.jameco.com/Jameco/Products/ProdDS/13696.pdf).
Use segment outputs a, d, e and f to drive the switches and inputs C and A to control their state, as below (connect input D to GND and input B to Vdd):
C A a d e f
1 0 1 1 1 1
0 0 1 1 1 0
0 1 1 1 0 0
1 1 1 0 0 0
There might be other possible combinations too.
German_EE:
Damn, that's a really neat solution, you win :clap:
Navigation
[0] Message Index
[#] Next page
Go to full version