I would like to implement a PC gaming device with 12 encoders (each with its own press switch) and 20 additional buttons (for a total of 32), but I wonder if it is even possible to do with Arduino.
As for the Arduino, I have found a library for the PC gaming device implementation for the ATmega32U4, so was leaning to that chip:
As I understand, each encoder needs two pins and not even all of them in the 32U4 are interrupt capable.
About the buttons, I was planning on using the Keypad library to generate a matrix and thus reduce the number of input pins needed.
All of the controls will be hand used and only one at a time due to the type of features that they will manage.
Obviously a single 32U4 does not have enough input pins. An option would be to use two Arduino Micro where each would use 12 pins for 6 encoders and the other 8 pins for a 4x4 matrix with 16 buttons. Still this does not fix the problem with the interruptions for the encoders and then I found that pin 13 has an associated LED and resistor that will not allow the use of that pin as input.
I would appreciate some help with this as my approach probably is not very good.
Thanks a lot!
Obviously a single 32U4 does not have enough input pins. An option would be to use two Arduino Micro where each would use 12 pins for 6 encoders and the other 8 pins for a 4x4 matrix with 16 buttons. Still this does not fix the problem with the interruptions for the encoders and then I found that pin 13 has an associated LED and resistor that will not allow the use of that pin as input.
You don't need an interrupt to read a hand operated encoder. Standard polling is more than fast enough for this purpose.
You could even read all devices with one Arduino, just attach one or more I/O expanders (p.e. MCP23517). Some even have interrupt outputs that notfifies the MCU if one of the pins change.
pylon:
You could even read all devices with one Arduino, just attach one or more I/O expanders (p.e. MCP23517). Some even have interrupt outputs that notfifies the MCU if one of the pins change.
Thanks for the reply, Pylon.
I have looked for your recommended chip and yes, it seems what I need. (MCP23S17, right? The 517 I cannot find, only another 017 which is I2C instead of SPI).
Just another doubt here: the Arduino micro 32U4 is clocked at 16MHz while the MCP23S17 clock limit is 10MHz. Is that a problem or it is possible to divide the clock? Maybe it would be easier to use the I2C chip version?
I found the first reference to the pin 13 digital input LED/resistor problem here, and then further looking it seemed a pretty spread problem. Looking at the Micro schematics it seems to have that resistor and LED attached to that pin.
escaner:
I found the first reference to the pin 13 digital input LED/resistor problem here, and then further looking it seemed a pretty spread problem. Looking at the Micro schematics it seems to have that resistor and LED attached to that pin.
He says "well I won't give anymore detail" so a helpful sole isn't he?
The Arduino has an op amp buffer to drive the on board LED and so should not affect anything. Even the few cheap models that have a direct connection to the to the resistor and LED will not affect the use as an input for 99% of the ways you use an input. The resistor is 1K to the LED to ground with the connection going straight to the input pin. So that means any output signal you connect to the input would have to have an output impedance of 1K5, or greater, before you had any trouble. Sure if you haven't a clue what you are doing this could give you a problem but not if you actually understand things, unlike the idiot in that video.
What would be the difference with the standard solo chip?
EDIT: I mean, the chip datasheet does not specify all those extra components for the different packaging, that I see.
The extra parts on the carrier module are there to make using the chip a bit easier. There are pullup (or down) resistors on the address lines, pullup on reset and power supply bypass. The board shown is a MCP23017 chip so the 2 other resistors are for the I2C pullup (my best guess). Those resistors may not be on the 23S17 board.
If you are using a solderless breadboard, get the bare chip. The double row of headers on the module will not work in a breadboard.
If you use the bare chip, be aware that the address lines must be held HIGH or LOW, they cannot be left to float.
I mean, the chip datasheet does not specify all those extra components for the different packaging, that I see.
That is because data sheets are not written for beginners. Everyone in electronics knows you need a ceramic decoupling capacitor on the power lines and that I2C needs pull up resistors.
It is a bit like a book on learning to swim, it never says don't try and breathe underwater or don't take your electric toaster into the pool with you while it is plugged in.