I’m currently working on a PIC controlled power supply unit which needed a human interface which included a alphanumeric LCD display and four switches. The problem was that I was limited to the amount of I/O pins which could be used (I only had three pins left when I actualy needed four).
My solution was to encode the switches in to a binary output and use this new data to communicate with the PIC.
After a brief scout around for a ready made solution, I thought to myself Why not make one?. I checked my dwindling stock and found a bunch of aging 1N1418 signal diodes and I set to work.
Parts List
- S1 – S4:
- Push to make switches SPST
- D1 – D6:
- 1N4148 signal diodes
- R1 – R3:
- 100K resistors
- B1:
- 6V battery (can be changed to 5V PSU)
Explanation
S1 to S4 are the input switches connecting the supply voltage to the routing diodes
Q0, Q1 and Q2 are the encoded binary outputs.
R1, R2 and R3 act as weak pull down restors to bring Q0, Q1 and Q2 low until a signal has been connected to them.
D1 to D4 prevent current flowing back to other switches.
D5 and D6 route the input signals from switch 3 to the correct outputs to make binary 3 (0011).
Limitations
Although the circuit works fine when indivisual keys are pressed, if more than one key is pressed at once the circuit will give false readings.


