128 channel mux for many buttons to axoloti?


#1

Hello, I have recently began building an interface for my axolotl with 120 buttons for midi control. I realized after I bought enough 16 ch mux's to cover all my buttons - https://www.sparkfun.com/products/9056 - there are not enough pins on the axoloti to take care of business.

I'm a total electronics noob, so any ideas to point me in the right direction of getting my 120 buttons to talk to the axoloti would be much appreaciated.

Thanks! :smile:


#2

That is a lot of buttons, what application do you have in mind?

So that breakout uses the CD74HC4067 multiplexer.
That multiplexer "connects" one out of 16 inputs to the output, depending on the status of the S0/S1/S2/S3 and ~E inputs.
You need 8 multiplexers to serve 128 inputs.
All the multiplexers can share the same selection (via the S0/S1/S2/S3 inputs), and can be enabled all the time (connect all ~E inputs to ground). Each multiplexer output need to go into a separate input.
So you need 4 digital outputs from Axoloti to select the channel, and 8 (digital) inputs to read the switch states.


Still, you need a custom object to scan out the switches, and I hope your application (step sequencing?) also "marries" with the object, because if you need to expose all 128 switches as outlets to wire up in a patch that will become a spaghetti monster...


#3

Hello Johannes,

Thanks so much for the response. :slight_smile: I'm building a midi accordion of sorts.
I only need to send info from each button to the axoloti, with no feedback necessary. Though I need each of the buttons to be exclusively recognized by axoloti.

Your explanation definitely helped me grasp how I will ultimately make all the connections.
Am I correct however in assuming that the 20 inputs of the axolotl are not enough to manage 120 separate switches routed through the 8 16 channel mux’s since each of these have 4 outputs ?

-would i instead need something like this http://spikenzielabs.com/SpikenzieLabs/Button64Shield.html to communicate over less digital pins on the board ?
I've also considered maybe connecting the mux's to my arduino mega, using to port the data then over to axolotl. not sure if this would work, however

I'm hoping that you may feel confident the mux's i have already can work somehow for connecting all 120 buttons to the axoloti in its current state. But if not, no worries.


#4

I am using an arduino mega to manage all my values before sending to axoloti.
Not sure about your other questions.

Will give more detail later (when not typing on my phone /have access to more detail. )


#5

ah, fantastic. thats good to hear .
Yes, when you get a chance I'd love to hear more, and know your preferred method for connecting the mega to connect to axoloti. thank you :slight_smile:


#6

Most of it is in this thread.


#7

Thank you. This seems more promising. I'm gong to try things out and post back on here whether or not I have success


#8

I've also been looking at this guide towards maybe daisy chaining the mux's into the analog ins. going to try a bit of that as well.
https://www.arduino.cc/en/Tutorial/ShiftIn


#9

After all this time I am finally getting back to this project! I have all the buttons registering with Arduino successfully (with some help) and I'm curious if you have connected your arduino to the axoloti w/out the USB cable. I'm I'm hoping to avoid the usb cable because of the way everything fits in the enclosure, but if its not possible I can make do :smile:

...oh its been so long i forgot about your reply w/ the link explaining your method. I will read that and get back. I'm still a total novice, so bear with me.


#11

I'm curious if you have connected your arduino to the axoloti w/out the USB cable

Using the FortySevenEffects Arduino MIDI library, you can send MIDI directly to the Axoloti from Arduino. I would look into getting a level shifter, or just using a Teensy instead. This is because the Arduino operates on 5v logic, while the Axoloti operates on 3.3v logic, so going straight from Arduino to Axoloti could damage it.

I'm using a Teensy to send MIDI to the Axoloti and have had no problems sending MIDI via UART from the serial tx of the Teensy to the serial rx of the Axoloti with just one wire (and a ground). Haven't tried receiving MIDI from the Axo yet, but posts on this forum seem to say it's also fine without an optocoupler or anything.

I'm happy to answer any questions.


#12

I unfortunately think I'll need to use the Mega because I need at least 35 digital ins and 8 analog ins. I could be wrong though.. does the teensy or a level shifter fit the bill?

I'm definitely hoping to do it just w/ the Mega's TX, RX, and 5V/ GND connected to axoloti. If I have to get something small in between, I'm sure I can make it work (as long as there are no power issues)


#13

Okay, zooming out for a moment. I've read back through your posts here. Just so you know, your project can be handled without introducing a Teensy, Arduino, or any other additional microcontroller. A Mega will be overkill if your goal is simply to have more pins to use. This is what multiplexers are for. You can still use a microcontroller if you want, but if the buttons and pots are all you need, adding the microcontroller would be like hiring a waiter at an ice cream shop. The middleman would only really slow down your process.

If you still have your 4067 multiplexers, you should have everything you need. For 35 buttons, you'll need 3 multiplexers. You're in luck, because the object tiar/HW/3_4067_mv is designed to work with 3 multiplexers.

You will still have enough additional pins on the Axoloti itself to hook up the potentiometers. Even better, use the third multiplexer for your pots, and use any of the unused digital-ins on the Axoloti itself for the three extra buttons. note: 4067s can be used for either digital or analog applications, but you cannot use one multiplexer for both digital and analog. No buttons and pots connected to the same single multiplexer. Two dedicated mux's for buttons and one dedicated mux for pots should be fine.

Coming back around to the original point, you shouldn't have to use a microcontroller at all, provided that your patch isn't overflowing the 8mb of memory in the Axoloti. Controllers are relatively light on the system. If you prioritize finishing this project over learning how to code, send MIDI messages, use level shifters, and everything associated with those, consider simply using tiar's object and following Johannes' diagram above.

Finally, if you're stubborn like me, and want to go through the agony of learning how to write firmware for an embedded system (programming an Arduino/Teensy/something else) just for this project, I'm still willing to help. If this is the case and you're just starting out, lower your expectations of having this project done 'soon'.


#14

Well that would be amazing if I could bypass the mega altogether. I really appreciate your willingness to help!

I did try to make sense of johannes method back then, but without much continued feedback, I couldn't quite figure it out and resorted to the mega as my way of wiring it ( but i kept everything in female headers, so I can unplug and plug into the headers I put on the axoloti). It seemed from his response too, that I would have to make a custom object.. which I'm not sure where to begin making that happen.

I have 120 buttons already soldered to 8 of the 4067 mux's.
Would 3 of the tiar/HW/3_4067_mv objects really be able to handle all the inputs?

I'm certainly open to either method, but I have to admit that writing code is not my strong suit. I'd be happy to share the arduino code I've had assistance with if you'd like. It currently works perfectly w/ the muxes, and I have it dual bootable as a class compliant usb midi device ( Just cant figure out how to get the HIGH and LOW states of each button to be coded as successful midi messages.) I've got a midi usb libraries installed but not having much luck when I try. all the midi data comes out as a huge slur of pitch bends and other weirdness, but the serial monitor messages are representational of accurate note data.

Thanks again! look forward to you reply


#15

Ah, I get what you're saying now. Originally I thought you had reduced the number of buttons to 35, and added some potentiometers. I see that the number of pins that you need is in reference to the number of multiplexers you plan to use with each their digital and analog connections.

There's potentially good news, and possibly even more good news on top of that. First take a look at Johannes' diagram again. You'll see that there are three multiplexers there and that, as he mentioned, the digital pins are all wired to the same output on the board. This is exactly how it should be wired to use Tiar's object. If you look at it in the patcher, z0 - z2 are the analog ins, and s0 - s3 are the four digital pins. All three of your multiplexers can use the same four pins.

So the good news is that looking over the Axoloti pinout linked below, it looks like if you have 8 multiplexers, you have exactly enough pins to use it in this way:

  • 3 of Tiar's objects in the patcher, which makes
  • 12 overall "digital out" pins between 8 multiplexers (because each object in the patcher uses four)
  • 8 analog ins, like you said, but they'll be treated as digital ins (no action required from you on the analog/digital differentiation, just good to distinguish the two). Still use the analog ins just in case, they're digital ins too anyway.

The 'possibly even more good news' part is that you may (may) be able to save pins by linking all the digital outs to the same 4 pins, and tell all 3 instances of Tiar's object to use the same s0-s3 pins, saving you 8 pins. I'm no expert at all, so you might need to try it out first. Google says it's doable, but if you have any concerns, do a little research as well. I'm no expert.

The last issue to address is that the program thinks you have 9 multiplexers when you have 8 (3 for each of Tiar's object), and all your pins are used up if you haven't daisychained them like mentioned above. You might be able to just make the same pin read twice in one of the three objects, shouldn't break anything. If it breaks anything we'll take it out in code.


#16

Thank you for breaking this down further. Going back and reading my reply it looks like i really didn’t grasp his response and diagram. This whole area of wiring ics and programming them has always been something that I start learning but a part of my brain just makes a road block somehow. Of course the more time I spend and the more attempts I take , it begins making more sense and I’m so grateful to you and everyone who patiently helps me learn along the way.

That being said it looks like I have some time to spend trying to make that object work for me.
I also plan to explore the Arduino method as a backup plan, since I’m further along with it and it frees up axoloti gpio for all the future pots, screens, and UX stuff. Which I suppose I could do in the reverse fashion when I get muxs working directly with axoloti :slight_smile:

I’ll report back here after I test the tiar object . ( hope it’s not years again )


#17

okay. I've got a very rudimentary sketch of what I'm trying to accomplish. I hope I've set up the tiar/HW/Ctrl3_4067_mv somewhat properly...I'm sure its far from accurate. But given what you see in the screen shot / attached patch do you have any pointers for how to actually get signal to show up from the object. the bottom right shows I'm getting raw data just fine, but I'm just still going through a lot of demo files to figure what im doing in the rest. :slight_smile:

mux to midi.axp (62.6 KB)


#18

I’d use eight 16 channel muxes, one eight channel mux.
This would require 7 digital outs, and 1 digital in, for up to 128 switches.


#19

I actually am using 8 16 ch muxes currently. thank you :slight_smile:


#20

Do you mean you would use 7 digital outs and 1 digital in the axoloti side from the 8 muxes? Do you mind explaining a bit more? Also what objects would you use?

Thank you


#21

Tele_player has confirmed what I was guessing. The reason that it would take 7 digital pins between all of those muxes is because all of the 16-channel muxes would be on the same address pins (the four pins that go out to all the muxes), while the 8 channel mux has three of its own digital pins. The reason that the mux-16s (as I'll call them to save time) can be on the same 'bus' (probably wrong terminology, but we'll go with it) while the mux-8 needs its own, is because of how the mux gates work to read pins. See table 2 here for how these gates are read.

Make a .axp file with just that custom mux object with all the yellow boolean outputs in it and drop it in this thread, you can do that with axp files on this forum. I want to take a look, because if you can make that object so that each button outputs a specific integer value and only has one green wire instead of 48 yellow ones, it will save you a gigantic headache and a lot of resources.