Most of it is in this thread.
128 channel mux for many buttons to axoloti?
Thank you. This seems more promising. I'm gong to try things out and post back on here whether or not I have success
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
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
...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.
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.
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)
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'.
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
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.
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
I’ll report back here after I test the tiar object . ( hope it’s not years again )
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.
mux to midi.axp (62.6 KB)
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.
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
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.
tiar object maybe.axp (17.3 KB)
okay, I'm not sure if I did this exactly how you are asking. just let me know and I can change it. the green one is int32, and i dont know if it needs to be bipolar, positive, or normal.
I suppose I'm confused why the 8 channel mux would be necessary for the 120 switches if it’s already covered by the 8 16 ch muxes .
The 8 ch mux allows all 8 of the 16 ch muxes to be read using a single input. This uses 4 pins, instead of 8.
But, if you have enough free I/O on the MCU, just use 8 input pins, and don’t use the 8 ch mux.
All of this is just for scanning the buttons, one at a time, to see on/off status. Handling polyphony is going to take additional work in software.
Ahhh I see now. Thank you for explaining.
Okay, it looks like I have some more decisions to make.
Based on what you know about what’s available in terms of fairly easy to use axoloti objects and how much customization/programming beyond a novice level would be required, do you think it would be more fruitful to spend time making this method work or learn to successfully encode midi from the Arduinos serial ascii messages, which currently emulate note on /note offs?
Sorry for the run on sentence. I must admit, I am worried that if I try this method with the 8 ch mux, I will get stuck again for a while without many resources and people to help someone at my level successfully mux 8 muxs. I’m feeling more optimistic in myself this time around though and I won’t try to let insecurity prevent steady movement forward.
I can't comment on that, as I'm not familiar with all the objects available on Axoloti, nor am I familiar with what Arduino library you are referring to.
no worries thank you for all your advice thus far!
I've successfully transmitted MIDI messages now from arduino over USB and either going to send to axoloti over PA3(RX) from arduino's TX or possibly try to solder a spliced usb cable to the back of the USB port. I'm not sure if this second one would work or not or if its advised.