Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Luc Volders
#94020 Ok guys this is just a tip on how I am building my button inputs on Arduino's and ESP's.

If you look at most keyboards they are build like a matrix:

keypad_pin_diagram.png


This takes 7 IO pins for 12 keys.

I am using binary coding. This means that I can use 3 buttons on 2 I/O pins, 7 buttons on 3 I/O pins, 15 buttons on 4 I/O pins etc.
Here is an example of a breadboard layout with 7 buttons using just 3 pins on an ESP8266 (Wemos D1 mini).

buttons01.jpg


Besides the few IO pins, another advantage is the easy programming. I added examples in C++ (Arduino language) and ESP-Basic. Could also easily be ported to MicroPython and other controllers like ATTiny85, ESP32, PIC etc etc etc.

Full tutorial, schematics, examples and source code here:
http://lucstechblog.blogspot.com/2019/0 ... -pins.html

Luc
You do not have the required permissions to view the files attached to this post.
User avatar
By Inq720
#94022 Although for things like in cars... buttons beat touch screens hands-down!

But for everything else...
... you could do a Web UI and have remote control using smart phones, tablets or computers and have hundreds of buttons on zero pins.
... and don't have to worry about problems like bounce.
... can multi state and show press state... momentary or on/off, three way, or sliders for variable instead of pots.
User avatar
By Inq720
#94055 My point is... in the months and years to come when a relative beginner searches and finds, "More buttons on fewer pins" it'll be because they have a project that can't fit on their chosen MPU... say a WeMos. I am suggesting to that beginner that there is an alternative that they might consider. It is not a better method for every project, but it might just be a better method for their project.

I would consider myself an advanced cook-book hardware person... IOW, I can follow a good recipe with the best of them. :P If on my own... calculating the appropriate pull-up/down resistor is a challenge and picking capacitors to filter noise is above my pay-grade. Fortunately for me, there are many good recipes on the Internet.

I would sincerely be interested on how your grid switch can be applied to something more advanced like a radar. I have a project I want to start that could use multiple radars. If I could run it on a NodeMCU, I'd be grateful to you.

VBR,
Inq