multiplexing and max/msp ? a survey

Hello all.

I am currently working on a simple interface for controlling software through max/msp. Im hoping to have a nice box to work in conjunction with my DIY monome (monome.org). My question is about multiplexing? I'd like to have a box with as many as 24 potentiometers and I have read the document in the playground on multiplexing using the 4051 chip. Looks great but I'm a bit of an electronics/programming newb (which is why arduino was so alluring) I was wondering if anyone had some input as to the difficulty of modifying the great arduino2max patch (Arduino Playground - MaxMSP) to read all the pins once I have the arduino sufficiently setup.

I would assume that would mean adjusting the arduino sketch significantly and I'm just a little nervous about that. Thanks for any help in advance.

Hey

I wrote that patch, for my students in an interactive art class to use. It's derived from the excellent prior work of Thomas Ouellet Fredericks' SimpleMessageSystem.

All it does is:

  • send an "r" to the Arduino
  • The Arudino receives the "r" and executes a loop, reading all the pins and sending it back to Max.
  • max receives the pin data and splits it up and sends it to "send" objects that make it available anywhere in MAX.

So as you can see, it would be really easy to modify it. All you would do is replace the loop reading the pins with something else, and process that in MAX. The possible speed would be reduced 33%, as you are talking about 24 pins, rather than 18.

If you want to try it, just replace the code that reads the pins with code to read the 4051, and modify MAX to do the rest :slight_smile: See the template code below.

What do you have in mind exactly? We might be able to collaborate on it.

BTW, Arduino2MAX is implicitly released copyleft, so make sure any improvements you make give credit and keep it open and free for others to use! this means you can't wrap a "non-commercial" license around it, or at least you are asked not to, and that you are implicitly also asked to release your code and files. That way we can continue to have cool developments like the one you are proposing.

Thanks.

D

 /*  
 *  Arduino2Max
 *  Send pin values from Arduino to MAX/MSP
 *  
 *  Arduino2Max.pde
 *  ------------  
 *  Latest update: September 2007
 *  ------------
 *  Copyleft: use as you like
 *  by djmatic 
 *  Based on a sketch and patch by Thomas Ouellet Fredericks  tof.danslchamp.org
 *  
 */


int x = 0;                              // a place to hold pin values
int ledpin = 13;

void setup()
{
  Serial.begin(115200);               // 115200 is the default Arduino Bluetooth speed
  digitalWrite(13,HIGH);              ///startup blink
  delay(600);
  digitalWrite(13,LOW);
  pinMode(13,INPUT);
}



void loop()
{ 

if (Serial.available() > 0){         // Check serial buffer for characters
        
    if (Serial.read() == 'r') {       // If an 'r' is received then read the pins
    
    // your code goes here. This is where you would prep the data 
    // by reading it with the 4051 etc.  
    sendValue (x);                    // this is the statement to send data to Max
    
  
    Serial.println();                 // Send a carriage returnt to mark end of pin data. 
    delay (5);                        // add a delay to prevent crashing/overloading of the serial port
  
  }

 }
}

void sendValue (int x){              // function to send the pin value followed by a "space". 
 Serial.print(x);
 Serial.print(32, BYTE); 
}

rad thanks for your help? collaboration would be much appreciated. And no worries on the keeping it open tip, anything im doing im eager to share and im not working on a product of any kind, just an interface for personal use.

with reference to the speed issue does that just relate to adjusting more than one of the pots at a time? ill throw up a sketch of what im thinking of in the next couple of days. but to describe it for you what im thinking is a simple matrix of 24 pots (originally i was gonna do 64 but realized it was overkill) and a smaller matrix of buttons which would change the midi channel that all pots would control. I was planning on doing all of that in MAX. The reason for the switches would be so that i could have all the pots control different effects in abelton live midi channel 1 --> effect one 2 --> effect two etc.

The thing i really need help with i think is modifying your excellent software (which works perfectly for me right now), and maybe someone looking over my should with the electronics just a tiny bit.

sounds good... what do you have so far?

D

well right now? nothing. but since you think its feasible im gonna request some samples of this 4051

and buy myself some pots i'm thinking of using a salvaged telephone keypad for the remaining digital ins.

as far as software goes I haven't even begun!

sure,

let me know when you get something going...

The 4051 is really cheap: about 75 cents form Digikey, if you don't want to wait the three weeks for samples.

D

for me digikey is a labyrinth? do you have a link to specific item? this is my best guess:

http://www.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=834051-ND

for me digikey is a labyrinth? do you have a link to specific item? this is my best guess:

http://www.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=834051-ND

ok,

that had not occured to me.
In that case try Jameco, or your local electronics store, as Digikey has a $35 minimum order.
Jameco's catalog is really good for beginners, as they have pictures and explanations of all their components. )Just don't order form them UPS Ground to Canada, as it will add $60 to the order in brokerage fees :slight_smile: )

D

Digikey Part numbers
497-1361-5-ND HCF4051BEY
568-1689-5-ND HEF4051BPN
MC14051BCPGOS-ND MC14051BCPG

thanks? i have ordered stuff from digikey before but only with specific part numbers. thanks for the numbers for jameco? you help has been awesome.

Yep,

Electronics is so wide a field that you need to have spent at least six hours screwing around with every little aspect of it, like CMOS analog switches, before you know what's going on and what the pitfalls are. It is nice to be able to pass along the knowledege at this point.

You should call Jameco and get them to send you catalog, the pictures are terrific for newbies :slight_smile:

D

how does this guy look?

https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=817521

soooo cheap!

hey

it's close but it is a variant. the 74XX line has different styles and voltage ranges. the regualr CMOS chips are even cheaper: 27 cents.

https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=916932

D

rad thanks. i think im also gonna grab some of these for my project: https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10001&langId=-1&catalogId=10001&pa=29082&productId=29082

Hi, I am trying to sort that on my own but I think it's time for me to ask.

I need a mutiplexer so I can multiply my analog input, but I am new to electronic ( not to programming ).
I was wondering what was the difference between the 3 items from digkey ( I will use the UK shop ).

Digikey Part numbers
497-1361-5-ND HCF4051BEY
568-1689-5-ND HEF4051BPN
MC14051BCPGOS-ND MC14051BCPG

I was also wondering if those items works the same way as the one in the playground tutorial. As I am new to electronic it would make my life easier if I could just follow the tutorial :stuck_out_tongue:

if people are interested, here is a link to our project: http://www.sonicbody.co.uk

Thank you for your help

i was thinking once i get this up and going ill do a photographic tutorial of the process and post it somewhere of use.

Tutorials with pictures are the best way of doing them, and it doesn't take that much time to add picts to a tutorial.

ps: any idea about my question on the difference between the 3 products and/or which one is the one from the tutorial?

Not sure but I think I found it at maplin ( uk ), the 4051:
http://www.maplin.co.uk/module.aspx?ModuleNo=31820&doy=17m9#overview

So I could try to buy two directly from my local Maplin and try the thing before I order more online. :slight_smile:
Please could anyone could confirm that I am looking in the right direction :-/

If it works I am also going to try to use it with the "arduino as a capacitive sensor" ( http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1171076259 ). This technique is really great, the guy who done that is really good.
I imagine I would need two 4051, one for demultiplex and one for multiplex as the technique need two pin ( 1 input 1 output ) for each sensor.

Anyway if it works I will put the code and picts as a tutorials for people like me who doesn't know much about electronic.

i dont know enough about electronics to help you. i would just go with the one on jameco that was discussed earlier on this forum.

btw: i got a call from jameco this morning all my stuff should ship on the 19th.

Thanks for replying. Jameco looks good but it's the US and I live in the UK.
They will receive two 4051 next monday at my local maplin. If they are the right ones ( hope so ) that will mean that UK people will know that they can find them there.
good luck for with yours :slight_smile:

they should be ok.

Maplin is not great for that kind of stuff these days - they seem to be more interested in consumer electronics than components. Their online info about their components is minimal too.

I tend to use

in that order, as they carry good range of stuff and have datasheets links for nearly every product they sell