Hello,
I hope you all doing good! I got my Arduino UNO R3 and started to work on MIDI Controller. Since, I'm DJ and producer I really like to have my own MIDI Controller. Recently, I've found that Arduino has not so many Analog inputs to read value of Pots. Also, It doesn't have enough digital input or output for leds and buttons. So, I searched for an answer and found that I can get HC595 for multiplexing the digital outputs and 4051 for multiplexing the analog inputs.
I designed a circuit for about 32 pots and 32 buttons. However, when I measure the 1 loop time it shows me about 50 ms even if I don't have my buttons connected.
So what have I done so far ? I daisy chained 2 HC595s and first HC959s first 3 bits sending messages to first 4051's S0 S1 and S2 and second HC595's first 3 bits sending messages to second 4051. My first 4051 is my main MUX. I've connected my second MUX the first 4051. I multiplexed Arduino's analog inputs with a 4051. I wanted to use only A0 of arduino and I controlled first mux with HC595s first 3 bits because I want to connect more pots or buttons to my Arduino. Also, I have 4067s so I can directly connect them to my Arduino this way i can eliminate 1 mux but this time I will only have 6 * 16 input for pots or buttons for analog read.
Here is my question: I said I measured 1 loop cycle takes about 50 ms. Is it normal? On code side, I'm shifting out bits to my first HC595 so it can control first MUX, and I'm shifting out second 8-bit value to my HC595.Then I'm reading the value of selected pot and if the value is not the same with ex value of this pot Arduino sends midi data. However, It takes about 50ms and it looks too much to me. I tested it with for loop for only 32 inputs. Is there a problem with my algorithm or is it the circuit issue? Also, When I read the value of pot it is not accurate. When I fully turned my pot it shows 1012-1013 etc. but the pot's max value is 1023. I'm using 10K pots. Also, even if I don't touch the pot it's changing its value like 1012-1013-1011-1012. Maybe it is breadboard issue ?
I done this circuit to reach excessive amount of pots and buttons. Searched manys sites but they only use 16 or fewer inputs. It's not done yet. I'm just checking and controlling the system if Arduino can handle it or not. That's why I connected 4051 to 4051. I attached the circuit's picture. I didn't created a schema. Currently, I'm working with just 2 pots but I have array which length is 32 so can code check 32 values from this array and write to it if it is necessary.
Thanks for your upcoming replys and have a nice day !
(Picture was too large for attachment so I uploaded it to dropbox.Here is the link: https://dl.dropboxusercontent.com/u/10760869/595s4051s.png . Also, I attached jpg version of it.
)
