Since the upgrade of Firmata v2, it has been difficult communicating between Max/MSP and the Arduino board. However, thanks to Christopher Coleman, who updated the Max patch of Marius Schebella, it’s working again. Thank you Chris!

Download the latest Maxuino here.

This is a basic tutorial on how to set up communication between Arduino and Max/MSP

This tutorial is for Mac OS X. If you are on an other platform, you can find instructions on the Arduino site to get your Arduino up and running.

    -Download the latest Arduino software .

    -When it’s done, open the folder and make sure to keep the structure the same.

    -If you are using Arduino Duemilanove or a similar board that runs off USB you’ll have to install the USB drivers. You can find them in the Arduino folder you just downloaded.
    USB Drivers

    -When that is done, launch the Arduino Software. Arduino icon

    -Go to: Tools –> Board –> and choose your board.
    board choice

    -Make sure to pick the right serial port: Tools–> Serial Port –> it should be something like /dev/tty.usbserial-…
    Serial Port

    -If you have an LED, connect the positive (longer leg) to digital pin 13 and the negative (shorter leg) to ground (GND) so you can have easy visual feedback when testing it. If you don’t have one, there is a tiny light that blinks the same way, it is marked ‘L’ directly below ground and pin 13 (in the picture).
    Arduino LED

    Update: make sure you download the latest Firmata. Thanks Hans-Christoph Steiner!

    -Open Standard Firmata: File –> Sketchbook –> Examples –> Library-Firmata –> StandardFirmata.
    Standard Firmata

    -Upload the standard Firmata onto your Arduino by hitting Com + U(Command + U). As it is uploading, keep an eye on your board, you should see the LED blinking a few times sporadically, that’s a good sign.

    -You should now see at the bottom of the sketch’s window ‘done uploading’ and the size in byte.
    Done Uploading

    -If you only want to work with Max/MSP you won’t need to touch the Arduino software again, but if you upload anything else onto your board, it will delete the Firmata and you’ll have upload it again.

    Now on the Max side of things:

    -Firstly, make sure to close the Arduino software.

    -If you haven’t already, go download Maxuino-005.

    -The heart of it all is the arduino.maxpat file, so you have to put it into your Max search path. If you have the older version of Maxuino, delete it so that Max doesn’t find multiple files.

    -Open up Max/MSP and launch arduino_test.maxpat.
    arduino_test

    -Make sure that the right port is selected, it should be the usbserial-… port we chose earlier.
    Serial Port Max

    -Test to see if your Arduino and Max/MSP are talking by switching on the toggle above the metro in ‘digital Pin output’, you should see the LED on the Arduino blinking the same as in Max/MSP.
    Digital Pin Output Test

Now you should be able to send messages to Arduino from Max/MSP and vice-versa. Usually you will want to control Max/MSP from your Arduino board using switches, potentiometers and other goodies. The next tutorial will cover that.

If you’re on a roll, go to the Arduino site to find information on how to connect the circuits up. Don’t upload the Arduino code, instead keep the Standard Firmata and use Max/MSP as the brain.


101 Responses to “How to Set Up Arduino with Max/MSP { sound + tutorial }”  

  1. 1 Dik

    Great tutorial. Exactly what I needed.
    Thanks so much for sharing this.
    Looking forward to your next one.

  2. 2 Andrew

    Hi Dik, I’m glad it helped. Have fun with it!

  3. 3 jimmy

    Where do I look if I’m still using Max/MSP 4.6?

  4. 4 Andrew

    It might actually work, have you tried opening the patch? Otherwise I have no idea where you can find for 4.6.

  5. 5 jimmy

    Max 5 patches don’t open in 4 at all. I’ll just try to find someone to open it and give me screenshots so I can remake it. Thanks though.

  6. 6 Adrian

    Hello Andrew,
    Great explanation, thanx a lot!
    It was very clear and on the basic level that I had been looking for; how to get the information between Arduino and Max with the least amount of fuss.
    Looking forward to your next tutorial…..in the meantime I’m gonna start hooking things up to the Arduino!
    :) Adrian

  7. 7 Andrew Spitz

    Hi Adrian, thanks for the comment. Good to hear that it got you hooked up and ready. I hope to get the next tutorial out sooner than later…

  8. 8 Mani

    Awesome Tutorial Andrew.
    By any chance do you know anything about Motor Shields on Arduino ?
    I’m trying to control a few multi directional DC motors via : ardiuino with a motor shield attachment: (this is the link to the shield’s website)
    http://www.ladyada.net/make/mshield/use.html

    I will be waiting for your future tutorials.
    mani

  9. 9 Andrew Spitz

    Thanks Mani.
    I’m sorry but I don’t know about the motor shields themselves, but controlling them from Max/MSP shouldn’t be too hard. Is that what you want to do? If it’s just to get it working then I’m of no use to you. Sorry :-)

  10. 10 sarah nicolls

    thanks for this – it really sped up our learning process and is very kind of you! :)

  11. 11 Andrew Spitz

    Hi Sarah, I’m happy that it helped you out. Thanks for the comment.

  12. 12 Todd

    thank you so much, this tutorial is nice and concise!

  13. 13 Greg

    I purchased Max MSP today and was a bit disappointed to see that the serial communication tutorial did not work with my arduino. Well, this patch did. Awesome, thanks!

  14. 14 Andrew Spitz

    Hi Greg, I’m glad it worked for you! Thanks for the comment.

  15. 15 Toby

    helpful tutorial, the LED flashes for me, but I can’t read the analog inputs. Any ideas how to do this, I need to use a variable resistor to control a max patch, but am confused by every other tutorial out there (new to max and arduino). Anyone got any ideas?

  16. 16 Andrew Spitz

    Hi Toby, I really should do another tutorial (time, arg!).

    On the arduino side: connect one side of your variable resistor to arduino’s 5v input, the other far side of your resistor to ground and the middle one to any analogue input. Check here for a picture and details (don’t upload the code) http://arduino.cc/en/Tutorial/AnalogInput.

    On Max/MSP’s side: open arduino_test patch and in “analogue Pins on/off” switch on the toggle that is the same number as the analogue input you used on the arduino. Then you should see in “analogue Pins Input” the appropriate number box reacting. A very useful object for making sure that the inputs are in the right range is [scale]. Very useful indeed!

    I don’t have time to check it but that should do it. Good luck!

  17. 17 anna

    I think I need more. It is very usefull. My led is working. And now?

  18. 18 Andrew Spitz

    I will try put together another tutorial. Until then you can check out http://arduino.cc/en/Tutorial/ to see how to connect things up. You can also read the previous comment to get a basic idea.

  19. 19 Toby

    Awesome, have got it working, does anybody know how I could extend this to use all 16 inputs on an arduino mega. Also, anna, what is it that you want to do, if it is using the analog inputs I may be able to help you, my knowledge is very limited but i’d be happy to pass on what I do know. Cheers!

  20. 20 Andrew Spitz

    Hey Toby. Great you got it working!

    I don’t have a mega, but could you not just add more input inside [p enable-analog-ins] & [p display-analog-ins] subpatches of arduino_test.maxpat. That might work. So just double click inside the subpatches and continue what is already done till 16… Let me know how you go on.

  21. 21 Toby

    Will do, thanks very much for your help Andrew. It’s working pretty nicely, with a bit of playing around with resistors and different scalings it’s nice and responsive to normal sort of light levels too. Have just emailed you about your sound designers telephone game, I have some cool thoughts for it I think, it’s a great idea.

  22. 22 Chad Eby

    Has anyone back-translated this to Max/MSP 4.x? Would be super helpful…

  23. 23 Jonathan

    Thanks for the tutorial Toby! I’m trying to replicate in the arduino_test patch the tutorial for AnalogInput. How do I get the digitalWrite and delay(sensorvalue) part going? I’m reading the potentiometer input OK.

  24. 24 Andrew Spitz

    It’s a pleasure. (I’m Andrew by the way ;-)) I don’t have anything on me at the moment so I can’t really check, but did you switch on the appropriate toggles in the Digital Pin mode section of the patch (ie. turn them into inputs)?

  25. 25 Tim Devine

    Hey i just tried this with Arduino_17 and it did not work, tried Arduino_13 and it seems to work, if anyone else has the same problem. A great help Andrew, Thanks!

  26. 26 Andrew Spitz

    Hi Tim, I haven’t tried with the new update, sorry I can’t help that front. Have you tried the Arduino or Max forums?

  27. 27 Tobias

    Hello, I have similar problems like Toby had: I tried to connect a potentiometer (5kOhm) but I can’t read the analog inputs in the arduino_test.maxpat. Trying other codes (not Firmata) like the simple “Analog Input” from the arduino site everything’s working well with the potentiometer connected…
    Any idea what could be wrong?

    Thanks for help!!!

  28. 28 Andrew Spitz

    Hi Tobias, so you’re able to control the Arduino board from Max but not Max from the Arduino board? Just to check, are you on Arduino 17?

  29. 29 Tobias

    Hello Andrew, that’s exactly the problem: I’m able to control the Arduino board from Max but not Max from the Arduino board. I’m on Arduino 17.

  30. 30 Andrew Spitz

    I’m not sure exactly what’s going on with 17, and I won’t be able to check for some time. But people are having issues with 17. Did you try on an older version to see if it’s the problem is from the update or maybe from your connections?

  31. 31 Tobias

    I tried older versions (12,13,14,16) but I always got a java error message. I’m on Mac OS 10.5.7. Looking on the net I found some Infos, but they couldn’t solve the problem.
    (Checking the “Open in 32 Bit Mode” checkbox in the App-Info-Window gives me another java error…)
    Oh my god!

  32. 32 Andrew Spitz

    Sorry, I have know idea. Seems like there is a conflict of some sort. Did you try get rid of the older ones? You should try post the error message you get on the Arduino forums, I’m sure the people on there will be able to help you.

  33. 33 Tobias

    Hallo Andrew, thank you very much for your help! After deleting the Arduino 17 preferences the communication with MAX/MSP is working using Arduino 16.

    Best wishes!
    Tobias

  34. 34 Andrew Spitz

    Good to hear Tobias! Good luck with your projects.

  35. 35 Antonino

    hi Andrew,
    the Arduino 0017 is not working also for me… I tried to use the previous versions (13-15-16) but the app doesn’t start: “cannot launch java application”. I’m under 10.5.8, I tried to delete the arduino preferences, but nothing… on another computer (older OS) I suceeded in uploading firmata standard firmware from Arduino 0016, but when I launch on my computer the arduino_test max patch I get a warning message in the max window:
    INCOMPATIBLE FIRMWARE VERSION, Message 0.
    Arduino_Firmata_Version, Message 02.
    even if the sensor and the patch itself seem to work fine.
    I’m stucked… any suggestion?
    Thank you so much
    Antonino

  36. 36 Andrew Spitz

    Hi Antonio, sorry for the late reply… my computer is broken and have hardly no online access. I can’t help for the time being, sorry. Hope you sort it out.

  37. 37 Jelle

    Hi Andrew (and others)

    Thanks for this Tutorial its been really useful!
    However it does not work with my mac (yet).
    No LEDs are flashing

    Im working with snow leopard and arduino 17 (older versions dont work on snow)
    In arduino there are two different usb ports: tty.usbserial and cu.usbserial mine works on tty.

    When I press the serial port the max output window gives the following error:
    Specified port not available. (http://img16.imageshack.us/img16/4150/screenshot20090924at120d.png)
    When I click on the error it opens arduino.maxpat and flashes “serial 0 115200”

    Do you have any idea what is wrong with my settings?

    Kind regards,
    Jelle

  38. 38 Andrew Spitz

    Hi Jelle, everything has gone bonkers since the Arduino updates. I don’t have a computer (and Max/MSP) at the moment so can’t check out anything. Have you checked out the Arduino or Max forums?

    Just to check, when you say “when I press the serial port” are you pressing only on the message box or are you first selecting using the Umenu? Or maybe try rebuild manually the serial object with a different port number, maybe 1 or 2 instead (serial 1 115200) instead of (serial 0 115200)?

  39. 39 Hans-Christoph Steiner

    The StandardFirmata in 0017 turned out to be kind of buggy, unfortunately. We have things mostly fixed in SVN, but would love to have more testing and bug reports! So here’s a new release. I fixed all bugs that I knew about, including the one where analog pins sometimes acted like they had a log curve on them.

    http://at.or.at/hans/pd/objects.html#pduino

    Just download the Firmata.zip and then install the StandardFirmata included in that. I tested this on a Diecimila, I hear there are troubles with the Arduino Pro and others, but I only have the older ones, so testing and bug reports on those are very helpful.

    .hc

  40. 40 Andrew Spitz

    Cheers for that Hans-Christoph! It’s very nice of you to update it and let us know. Seems like I will finally get a computer this week or early next week so will be able to check it out. I will send you the bug reports your way as they happen.

  41. 41 jorge lozano

    ThANKS for the tutorial it worked fine. Howeever I have a question, I HAVE CONNECTED A BUTTON/SENSOR AND IT WORKS ON ARDUINO. HOW DO I CONNECT MAX AND ARDUINO TO TRIGGER A VIDEO WHEN I TOCUH THE SENSOR???

    saludos

    jorge

  42. 42 Eiður Árnason

    Great tutorial. just wanted to give my grats

    I am new to both arduino and max msp but I am wondering if the idea is that I use the test patch and build my max msp synth around that or if the other patches would be more suitable.

    All the best. Eiður

  43. 43 Andrew Spitz

    Thanks Eiður. Yeah, the test patch is perfect. Just open it, save it as a new file and then delete the sections that you’re not gonna use. Have fun!

  44. 44 Andrew Spitz

    Hey Jorge, glad it’s working. Now to trigger a video in Max you can just connect a button to the Arduino (which you said you did), check out this tutorial just in case http://arduino.cc/en/Tutorial/Button just don’t copy the code at the bottom, Max/MSP should read the button input fine. You can see if it works in “Digital Pins Input” from the test patch you should receive a bang when pressing the button on your Arduino board, and connect that bang to the switch for your video. The actual patching to trigger a video can be found here http://www.cycling74.com/docs/max5/tutorials/jit-tut/jitterchapter01.html
    Make sense?

  45. 45 Jack

    Hi,

    Where do I find the Max search path, i’m using snow leopard.

    Thanks,
    Jack

  46. 46 Andrew Spitz

    Hey Jack. To put stuff in your search path go to Applications –> Max5 –> and inside is your search path where you can drop the new files/folders that need to be in. You can use the current folders there to help organise or create new ones… it doesn’t matter.

    Another way is the create your own search path. After launching Max/MSP, go to Options –> File Preferences –> Click the add button (+) –> and then pick the folder you want to be added to your search path.

    Hope this helps.

  47. 47 Alexander

    Hi there,

    I’m trying to work on an arduino board for a project in my first year of uni- basically using a LDR to control a sine wave in MAXMSP 5.1. I’ve connected the LDR to the 5V output on the board and then into analog input 0, and put the appropiate code onto the Arduino. This has worked on a Mac, but unfortunately in on a PC running windows vista, and although the USB drivers will let me send data and detect the arduino, Max isnt having any of it- it will see the port that the arduino is running in (COM9) but when i select it in Arduino2Max it just wont work :(
    im really new to this whole thing, which isnt ideal 😛

  48. 48 Andrew Spitz

    Hi Alexander, sorry you’re having issues. I’m not on Windows so I can’t really help you. Maybe you should check the Cycling ’74 forums or the Arduino forums.

    Andrew Benson has come up with another Max patch and Arduino code that you could maybe check out: http://pixlpa.com/blog/arduino-sensorbox-firmware

    Or else, maybe try see if one of these work: http://arduino.cc/en/Tutorial/PhysicalPixel or the other Communication tutorials that include Max.

    Hope this helps and that you kind find a solution to your problem!

  49. 49 Andrea Dio

    Hi….
    I’m trying to send to maxmsp the EZ0 “ultrasonic range finder” values
    with no success!!
    I think I’m getting something wrong… (first of all i’ve to say that i’m new to both of them Arduino and Max)
    I uploaded the firmata stuff…. but than how do I upload the EZ0 code?
    Can anyone help me?
    Tks a lot

  50. 50 Andrew Spitz

    Hi Andrea,
    The idea behind the Firmata is that it’s the only code you need to upload it onto your Arduino, and it communicates with Max/MSP where you do your programming. if you add other code to your Arduino board, you’ll wipe the Firmata and will not be able to communicate with Max/MSP.

    In Max, using the Maxuino patch, you can receive the values from the EZ0 or any other analogue actuator by switching on the toggle of the analogue pin you’re using for your range finder in the section called “analog Pins On/Off”, and the values should be displayed below in the section called “analog Pins Input”.

    Hope you get it working. Please let me know if you don’t.

  1. 1 Our Future World. WK ELEVEN. « Interactivating Sydney- Johanna Lark
  2. 2 Arduino Board mit MaxMSP verbinden « SonicSystem
  3. 3 IAT 320 project proposal « Howard Zhang's Blog
  4. 4 Arduino serial communication protocol design | Question and Answer
  5. 5 Max for Live and Hardware

Leave a Reply