I'd like your advice on a controller that I'm building that'll have many buttons (10+).
At the moment I'm using a simple IR sender + receiver. This allows me to have 21 button inputs using only one Arduino signal pin (the one for the receiver signal).
For various reasons, I need to build my own personalized controller, however, I don't want to use IR communication, I need one with wires.
So my question is, is there any cheap ready-to-use wired "device" or board, just like the IR one, that would allow me to have many button inputs using only one pin on the Arduino? I wouldn't wanna build a button box and use almost all the pins on the board. Also, I don't wanna use another Arduino board just for the controller. Simply put, I need exactly what the IR sender + receiver accomplishes but with wired communication.
Speed is not super important. Something around 100ms, which is more or less the IR speed, would be okay.
If you have one way communication you could use serial. A TX pin on the sender to a RX pin on the receiver. You could fit 10 button states into 2 bytes (16 bits). 21 buttons into 3 bytes (24 bits).
@groundFungus
Sorry but I didn't quite understand. Do you mean solder the IR sender pin to the IR receiver pin? In this case instead of sending and receiving the digital pulses through infrared it would do it through the wire? I'm using an Arduino UNO.
@flashko
That seems very interesting! I will look into that, it may solve my problem if I can't find another ready-to-use wired solution. Thank you!
@madmark2150
In this case I can't use a keyboard. It's a controller, a sort of teaching pendant, for my robot arm, so it needs it's own personalized buttons and layout.
I saw that maybe another way to accomplish this would be to use resistors to connect each button to a different resistance value and then connect all of them in parallel to one AnalogRead pin. This way each button press would yield a different value. Do you see any problem/disadvantages in doing it like this?
On a side note, when I say I'd like exactly what the IR controller accomplishes, I don't mean I necessarily wanna use infrared. What I mean is I'd like to push a button and read its code in a very simple way.
The LCD shields with buttons use the varying resistive divider trick, Wind direction sensors also often use that.
How many buttons/keys do you need. I've seen numeric only keypads. A joystick can be also be used for yes/no and another decision pair, and has a built in button.
Around 14 buttons. I'm gonna 3D print the box. Unfortunately in this case I can't use any standard joystick. Each button has a function and the user must be able to press any of them at anytime.
Although I've been able to use the analog input with resistors in parallel, I believe the best solution in this case will be the I/O expander and I'll try it for the final version. Cheers