I'm planning to build a kid-friendly "universal remote" so the kids can turn on and off a myriad of IR-controlled devices with one or two easy presses...
The remote is going to have maybe 20 big chunky buttons which, when pressed, with send the multiple IR signals to all the necessary devices to, say, turn on kids channel, set up the Wii, etc, etc...
Most of the buttons will be laid out in a grid pattern, but some might be used for up/down/left/right, enter, etc....
I'll use an Arduino Pro Mini or Uno as the uC.
Are there any clever ways to wire up these buttons? A grid-type circuit? Analog inputs with different resistors between each button? An IC that'll make the job easy?
Answer
You basically listed them all.
A Matrix of x rows and y columns. You need x+y pins.
Digital GPIO Expander IC, preferably with interrupt. I2C, SPI, even Serial are available. Interrupt pins allow you to read on interrupt instead of polling. You need to have hardware I2C/SPI/UART, or add software code. This approach is mainly used if you need a lot more GPIO than you have available on the main microcontroller. At that point, you are basically still using options 1, 3, and 4, or the direct one button per pin.
Resistor Ladder. You need an ADC, and constant polling. Better to break up into a few similar groups on multiple ADC channels, but you can make a large 20 button one if you really need to.
Charlieplexing. Like a multiplexed matrix (#1), but with \$N \times (N – 1)\$ where \$N\$ is the number of pins used. Requires as many diodes as buttons, so you are changing pin count for diodes. You could use LEDs though.
For the most part, #1 is the most common method. Every keyboard or touch tone phone you have ever used, 1000 to 1, would have used it. Hell, even cell phones use it (specifically, the Nokia 5110 I know uses it.) For 20 buttons, a 4x5 matrix will only take 9 pins, more than enough.
No comments:
Post a Comment