Pages

Friday, April 8, 2022

Visible indication for the: more buttons on fewer pins

For an index to all my stories click this text.

In a previous story I showed how to attach many buttons on just a few IO pins. I did this by using diodes to binary decode the buttons. Sounds complicated but it really isn't and it is a great way to have more buttons, switches, door contacts, pir sensors etc without sacrificing too many IO pins. You can re-read that story here: http://lucstechblog.blogspot.com/2019/07/more-buttons-on-fewer-pins.html
 
The setup was just an example for the tutorial. And in real life pushing one of the buttons would evoke some action. However, how about immediate feedback. Then I had this idea.

Let us look at some basic electronics.



On the left you see the symbol for a diode and on the right side the symbol for a led. That shows that a led is basically a diode that transmits light. Duh..... Hence the name Led: Light Emitting Diode.

So what if I would exchange some of the diodes in my project by a leds. That would show which button was pressed, no matter what actions would follow you would get an instant feedback,



Here you can see that the strip at the right side of the diode points to where the - side is. This is the side to which the buttons are connected. When replacing a diode by a led test with a battery which side of the led is the + and which is the - side. Then replace the diode by a led using the same polarity.

At the buttons where just 1 diode is attached replace that diode by a led. At the buttons where multiple diodes are attached hust replace 1 of the diodes by a led.

That's all.

What leds to use.

Not all led's can be used as for some the forward voltage is to high. The dimmed red and green ones worked for me as did the clear red ones. Just experiment and see what works best in your setup.



Here you can see my setup with 7 buttons attached to just 3 IO pins of a Wemos D1. In this setup I replaced 3 diodes (as a test) with clear red leds.



And here you can see what happened when I pushed the first button. From the string of Neopixels only the first one lightened up just as it should but the led attached to the button also lightened up.

There you go. An immediate feedback when you press a button.

Till next time
have fun

Luc Volders