Making Max/Ableton talk Firmata/Arduino

Maxuino v.009

Posted: April 6th, 2010 | Author: | Filed under: Tutorials, Updates | 50 Comments »

Download maxuino-009.

The package uses Max’s built-in serial object to implement OpenSoundConrol (http://opensoundcontrol.org) style communication to/from the arduino-compatable hardware.

This update includes Maxuino for Ableton Live:  a device that lets you communicate with your Arduino-compatible hardware from within Ableton Live.

This package has been tested with Max 5.1.3, Arduino 018, and the following hardware:

* Adruino Diecimila/Duemilanove/Mega
* Teensy 1.0/2.0 & Teensy++ 1.0/2.0

To use it, you must:

1. Install Arduino 018 IDE or later (For more on Arduino, go to http://arduino.cc)
2. Install Max 5.1.3 or later (For more info on Max, go to http://cycling74.com/products/maxmspjitter/)
3. Replace the “Firmata” library included with Arduino 018 with this folder:
http://maxuino.org/wp-content/uploads/2010/02/firmata.tar.gz

To do this in OSC, open the application package and replace this folder with the the Firmata folder from the above link:
/Applications/Arduino.app/Contents/Resources/Java/libraries/Firmata
[this should be fixed in Arduino 019]

4. Load the “StandardFirmata” sketch onto your arduino (under File>Examples>Firmata>StandardFirmata)
5. Install “OSC-route” Max external from CNMAT (see http://cnmat.berkeley.edu/downloads)
6. Connect your arduino hardware, and open the patch “maxuino_test.maxpat”

The package includes the following:

main patches:
-maxuino.maxpat: the center piece
-maxuino-gui.maxpat: OSC input and GUI abstraction for all inputs and outputs
-maxuino.help.maxpat: the center piece test patch

examples:
-maxuino-example-GUI.maxpat: examples for using the maxuino-GUI patch
-maxuino-example-applications.maxpat:  examples for working with inputs and outputs

ableton m4l device:
-maxuino.amxd: midi-instrument type device for talking to your microcontroller from within ableton (takes midi note for on/off and midi-control for pwm’s)

support:
maxuino-Apin-gui.maxpat: a GUI bpatcher for analog pins
maxuino-Dpin-gui.maxpat: a GUI bpatcher for digital pins
maxuino-hardware.txt: a max collection that specifies the pin configurations of different arduino hardware implementations
maxuino.js: a javascript that communicates with Max’s serial object
…and a couple of other things.

You can get more information about this firmware and download the latest version here: http://firmata.org

Credits:
Hans-Christoph Steiner <hans@at.or.at>, Georg Holzmann, Gerda Strobl, Marius Schebella <marius.schebella@gmail.com>, Christopher Coleman <chris.d.coleman@gmail.com> , Ali Momeni <batchku@gmail.com>

patcher history
v.008 major redisign of GUI, major improvement of communication with serial object (a .js does it all now, and packs bytes for efficiency)

v.009 improved GUI, pattrstorage compatibility for pin states, ableton M4L device

v.008 move to js for communication with the serial object, added GUI

v.007 bug fix and some cleanup including an interface change, also added servo support

v.006 adjusted for Firmata v2.1

v.005 adjusted for Firmata v2

v.003 reworked port selection, now by device name (for windows…)

v.002 added numbers for port selection

v.01 first release


50 Comments on “Maxuino v.009”

  1. 1 Maxuino v.009 e Ableton Live « matteo pennese::diary said at 9:59 am on April 7th, 2010:

    [...] Maxuino è stato aggiornato alla versione 009. [...]

  2. 2 generic propecia said at 9:48 pm on April 8th, 2010:

    Interesting and informative. But will you write about this one more?

  3. 3 Steve said at 2:04 pm on April 9th, 2010:

    I am getting errors newoj maxuino-gui: No such object
    js:cant find file maxuino.js

    and

    js: no function msg_int

    im on osx 10.6.2 with the lastest max and arduino updates

    Any help appreciated

  4. 4 Steve said at 2:24 pm on April 9th, 2010:

    Sorted, problems with my search path.. Great patch thanks alot :)

  5. 5 Mripp said at 9:03 pm on April 23rd, 2010:

    Thanks for all your work on this. Does this work with the Wiring board?

  6. 6 maxuino said at 8:09 pm on April 24th, 2010:

    No, sorry but this is just a solution for Ardunio based boards.

  7. 7 Martin said at 9:08 pm on April 24th, 2010:

    I am getting errors newoj maxuino-gui: No such object
    js:cant find file maxuino.js

    and

    js: no function msg_int

    im on osx 10.6.2 with the lastest max and arduino updates

    Any help appreciated

  8. 8 maxuino said at 9:37 pm on April 24th, 2010:

    you have to set your Max file preferences to look into the maxuino folder recursively, or move maxuino to one of the folders where that is already happening.

  9. 9 sblasco said at 4:21 am on April 28th, 2010:

    Just a heads up: the command format “/*/analogIns $1″ doesn’t work into the first inlet the maxuino-gui patcher (as shown in one of the example files). To turn analog pins on/off, I’m sending “/analog/*/analogIns $1″ to the second inlet on maxuino-gui (where * is the pin number and $1 is one or zero).

  10. 10 GMac said at 11:54 am on April 29th, 2010:

    Hi there,

    just wondering if there is a way to use maxuino to interface with a Memsic 2125 accelerometer as an analog input (for x and y acceleration as well as tilt). The arduino code for the memsic provides a way to interpret the incoming pulse on a digital pin connected to one of the axes.

    Is there a way to read the pulse in maxuino?

    Any help is appreciated

  11. 11 david said at 9:06 pm on May 8th, 2010:

    Hello, I am new to all of this but have been researching before buying. I’m considering an Arduino board with an ethernet shield. Is it possible to use ethernet instead of USB/serial for this patch?
    I’ve also been considering the Make controller 2.0 because the ethernet is built in and you can pass OSC commands easily, but I’m a bit scared of that board because of lacking documentation and poor forum activity. Any guidance welcome! Thanks.

  12. 12 Ian said at 5:34 pm on May 18th, 2010:

    I would like to drive a sparkfun rgb matrix backpack. It takes commands in rows and columns as lists. Will this be possible to communicate via OSC?

  13. 13 Ian said at 3:45 am on May 19th, 2010:

    Since getting the matrix board to go on and making a few edits in the code I get a sense that I will have to make some changes.

    The thing that concerns me now is that I can’t seem to get the LED at pin 13 to go on, now that I have installed everything, firmware, etc.

    Any advice?

  14. 14 Jai said at 3:14 pm on May 20th, 2010:

    Being new to Live and M4L I can’t work out how to use the M4L device to do anything musical.

    The device is seeing my board and sensors OK as the A_in and the PWm sliders move up & down with sensor actuation.

    I want, for example, a sensor to play a particular note or modify a parameter of a built in Live analog synth. Any help? Thanks

  15. 15 Gabriel said at 10:05 am on May 26th, 2010:

    Hello,

    I am having problem with an installation that is reading an ultrasonic analog sensor.
    After around 30 mins, the maxuino 7 patch continues working but the analog input stops reading values.
    I checked with a friend that is doing similar stuff and it happens the same to him.

    Did it happened to someone else? Do you think is something that in the version 8 or 9 was fixed?

    Thanks very much.

    Best.
    Gabriel

  16. 16 Jon said at 12:33 am on June 7th, 2010:

    I am trying to light up leds connected to the digital output ports on my arduino. I can get them to light by manually pressing the toggle switches within the M4Live maxuino, but I can’t get midi to control it! (Other than remote midi) Is it possible to control the outputs from a sequencer? (This was my original intent)/What are the mappings of the outputs to the midi notes?

  17. 17 VERY IMPORTANT said at 11:23 am on July 4th, 2010:

    …you must set your Max file preferences to look into the maxuino folder, or move maxuino to one of the folders where this is already happening.

    go into max > options > file preferences > then click the + sign at the bottom to add a new path, and then choose your maxuino folder . (in my case the maxuino -009 folder)

    i spent hours trying to make this maxuino work , but then i simply did this , all thanks to another comment here on the board. : )

    so i thought id better bump this fix !

    peace : )

  18. 18 koredom said at 7:15 pm on July 24th, 2010:

    Hello!
    Thank you very much for your great work!
    I’m new to the Arduino and i need some help using maxuino for my own works.
    When i’m opening the maxuino_test patch i get the values of my sensors i’ve connected to the arduino. But how can i use those now? How can i include the maxuino Stuff into my own patches?
    Thank you!

  19. 19 Bart - help needed said at 3:55 pm on July 31st, 2010:

    I have done all the defined steps very slowly and correct, with the Arduino i can control the servo but not with the “Maxuino v.009″ example patches?

    I think the problem is in the PWM signal value send to the Arduino.

    This Hitec HS-985MG servo needs:
    3v PWM signal peak to peak from 900uS to 2100uS with 1500uS as neutral.

    Thanks for help.

    p.s. There is not a “maxuino_test.maxpat” in “Maxuino v.009″?

  20. 20 arduinoBT said at 12:36 am on August 27th, 2010:

    how can I use maxuino with arduinoBT.

    how can I change the maxuino-hardware.txt: a max collection for that specifies the pin configurations of different arduino hardware implementations. any clue or tutorial will be fantastic.

    thank you very much

  21. 21 Latency check said at 11:00 am on September 12th, 2010:

    hello,

    I ran a latency test today using arduino & max msp , I used a maxuino patch to communicate between the two.

    what i wanted to find out was : How long does it take to send a signal from the PC computer out to arduino and back in to the computer ? along the following path : max/msp > serial/usb > arduino digital out >arduino digital in> usb/serial>max msp.

    i used a timer module inside max msp to take the readings.

    results:

    Each time i send a test signal/bang out of max I get a range of latencies for its return back in.

    it is not a constant figure i have readings between 3 ms > 19ms each time i send a single bang.

    just thought id post this. maybe there is a way to tighten this up ?

    peace : )

  22. 22 Nicolai said at 2:58 pm on September 12th, 2010:

    Looks great!

    But….

    When I try to load up the imported Firmata in Arduino there comes this:

    core.a(main.cpp.o): In function `main’:
    /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:7: undefined reference to `setup’
    /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:10: undefined reference to `loop’

    Any idea what I´m doing wrong?

  23. 23 Interfacing MaxMSP and Arduino « praxworld.com said at 12:10 am on October 5th, 2010:

    [...] From Clipboard to open it in Max. Note that none of this will work unless you have properly set up Maxuino on your [...]

  24. 24 George said at 9:03 am on October 8th, 2010:

    Since the release of the new Arduino Uno, my university only sells that version. Maxuino 009 doesn’t seem to work with the Uno yet!

  25. 25 maxuino said at 5:49 am on October 9th, 2010:

    An Uno is ordered and on the way. Testing and any needed corrections will soon follow.

  26. 26 Lu_Ke said at 2:52 am on October 26th, 2010:

    Hi.

    Could anyone tell me if it is possible to combine a personally developed max/msp patch with the maxunio patch? Therefore creating a patch that an ardunio board can send messages to to trigger sound.

    Thanks.

  27. 27 maxuino said at 2:00 pm on November 2nd, 2010:

    Your question is rather vague, but the answer is definitely Yes. We’ve worked hard to make maxuino totally modular so that you can drop it into your patch and start sending it messages.
    but perhaps your question is more specific?

    -ali

  28. 28 Brian said at 1:07 am on November 7th, 2010:

    Hello all,
    I am trying to get my preexisting Max patch from my MacBook Pro (Uni) onto a last gen Powerbook PC. All works other than the maxuino.gui which still works on my Intel machine.

    Is it the PowerPC or something I haven’t transferred over?

    I am working with a force senor, Duemilanova, to MAX.

    Thanks

    Brian

  29. 29 angelo reale said at 3:46 am on January 11th, 2011:

    halou! :)

    i’m trying to control ableton parameters (such as a low pass filter) with a potenciometer.

    everything works fine, i mean, maxuino is all shiny! the PWM analog input responses to the changes in potenciometer which is half-way done.

    the thing is, how do i sync a parameter on ableton to response in order to these changes?

    AndyJ’ve been flooding the net with such a question and as far as i know with no success.

    any idea?

  30. 30 peiro said at 5:08 pm on February 24th, 2011:

    Hi I am starting to use Arduino and Max; I already got my setup working, but I just can’t figure out how to send signals to my Duemilanove board.

    Say I just want to light up a LEDs connected to the digital pin 11, 12 and 13. I get the rx LED to recieve data, but my digitalpin LEDs won’t react when I bang or toggle the pins out.

    -If someone could post a printscreen of an example patch it would be great.

    Thanks in advance.
    Peiro

  31. 31 i.n.g.o. said at 11:23 am on April 11th, 2011:

    to add sysex-support to the maxuino.js add the following function:

    // make a firmata-sysex call
    function sysex() {

    var a = arrayfromargs(arguments);

    a.unshift(240); //prepend sysex-start
    a.push(247); //append sysex-end

    outlet(0, a);
    }

    pass a sysex command and the data to the function like:
    (where 123 would be the sysex-command, and 42 the data)

    {
    “boxes” : [ {
    "box" : {
    "maxclass" : "message",
    "text" : "sysex 123 42",
    "outlettype" : [ "" ],
    “patching_rect” : [ 67.0, 122.0, 81.0, 18.0 ],
    “id” : “obj-31″,
    “fontname” : “Arial”,
    “numinlets” : 2,
    “fontsize” : 12.0,
    “numoutlets” : 1
    }

    }
    ]
    }

    cheers
    i.n.g.o.

  32. 32 queglay said at 3:20 pm on June 28th, 2011:

    the osc route sit file doesn’t have any instructions on how to install it.

    since the file OSC-route doesn’t have any extension its not clear where it should go because it isn’t .mxo

    can anyone clarify that for me? thanks.

  33. 33 Danijel Daka Milosevic said at 3:54 pm on June 28th, 2011:

    Lord knows I’ve tried to make this work for several hours, but I couldn’t get any communication with the board. Then I’ve downloaded the maxuino 007, which worked out of the box. Am I missing something important between the two versions? All I need is analog read / digital write….

  34. 34 Tryggve said at 10:57 am on July 21st, 2011:

    “6. Connect your arduino hardware, and open the patch “maxuino_test.maxpat””

    Just that the patch doesn’t exist ;-j

    A question, is it necessary to replace the firmata? It’s a bit unclear, it can be read that it has been fixed in v. 019.

    Anyway, a great big thank you!

  35. 35 maxuino said at 1:55 am on July 26th, 2011:

    you can use the standard firmata that comes with the Arduino IDE now. and thanks for the bad documentation catch…we need to see to those details with every change…

  36. 36 Tryggve said at 9:49 am on August 17th, 2011:

    Thanks for the reply! Another few questions, I use PC and it’s very unstable here, you usually have to quit the patch unplug the card (mega) and the plug it and restart the patch to get it working. Is this what you’ve experienced as well (my laptop is way out buggy for some reason), or do you develop it only on mac?

    Another question, can you point me in any direction in how to communicate with stuff (like the epir motion sensor) through max? Is everything in the digital out done with sending 0.-1. or is there other ways of communicating as well?

    Thanks for the work you put down, it’s hugely appreciated!

  37. 37 Akollectiv said at 8:23 pm on October 25th, 2011:

    Hi we just wanted to share our latest project. http://vimeo.com/31087781

    We used the latest Maxuino v.009. Connecting 6 arduino’s, controlling 7 motors, 5 ultrosonar sensors and hacking 5 vga monitores. Worked like a sharm. Thanks for making it so easy!!

    Akollectiv

  38. 38 patrick harrop said at 6:01 pm on February 2nd, 2012:

    Hi

    I am having a lot of trouble with Maxuino v.9 and Ableton.

    For some reason there seems to be major communication errors with this set up

    Here are the particulars:

    Arduino MEGA AT mega 1280

    Maxuino build: V.9

    Ableton 8.27 (demo license)

    Max for live Version 2.2

    I am currently running a simple set up with 2 pwm channels and 4 logic channels that are running sparkfun Motor drivers (TB6612)

    the communication seems to be either backed up or even dropped entirely from the arduino board when communicating with ableton. While ableton shows automated toggles in action, arduino seems to be either frozen at a particular point in the timeline or severely delayed.

    From the troubleshooting I’ve been doing I see several potential problems that hopefully someone could help with:

    1) the select hardware selector only seems to work with the arduino duemilanove, when the mega is selected the output selector on each pin goes blank. I know that duemilanove and mega are different chips, but how to i configure maxuino to be specific to the mega?

    2) I have been reading about the baud rate and the uno. Are there any baud rate issues that would be causing this conflict?

    Thanks in advance. Any help would be greatly appreciated!

  39. 39 maxuino said at 6:46 pm on February 2nd, 2012:

    Patrick,
    I am going to ask Ali about the Live question as he is much more experienced with it. I can tell you that the Hardware selector issue is a bit strange, you can see that we are using the maxuino-hardware.txt file to tell maxuino which pins work for which board and which modes work for which pins. If they are all going grey, then something is happening and it is not reading the txt file properly. The baud rate issue was a temporary issue with the Arduino IDE, and has long since been fixed. what sort of information flow are you sending that is getting backed up? are you for example trying to send step commands to a stepper at 120bpm?
    Chris

  40. 40 patrick harrop said at 10:27 pm on February 2nd, 2012:

    Chris Thanks for getting back to me!

    even simpler than that: there are 6 signals being sent out so far:

    2 pins are standard PWM to a motor driver.
    4 pins are simple logic on off switches that control direction.

    with the pwm, i am simply making about 12 steps in speeding up and slowing down over about 1 minute. (no ramping, just steps)

    sometimes its stable and it will run for 5 to 10 cycles. Sometimes the logic channel will not be sending anything. Sometimes it will get stuck in one place and the pwm will stay exactly where it was as if the board went unconscious.

    So its a very simple system that should not get back logged at all.

  41. 41 Martin Kloppers said at 8:46 pm on February 19th, 2012:

    Hello,

    Does Maxuino communicate ISR’s to Max MSP?

    I am using an LM1815 chip (zero-crossing detector) to provide a square-wave pulse into my arduino. It is intended to connect with the arduino’s ISR input pins (like digital pin 3).

    I am currently running into a normal digital pin, pin 8, and I am getting a stream of zeros and ones at rate that can range between a pulse every 2.3 ms to a pulse every .23 ms. I am trying to measure the time between pulses to give me an overall rate (RPM) that I can display and use in Max MSP.

    Any help much appreciated. And thank you for a great product!
    -Martin

  42. 42 maxuino said at 9:01 pm on February 19th, 2012:

    Martin,
    maxuino only has the capabilities of Firmata at this point. Although they did recently add I2C capability that we have not yet implemented in Maxuino. I suspect with the range of speed you are wanting to analyze it cannot be shoved thru the serial port and instead you want to just look at the average speed at over a given span of time? Sorry I have not messed with ISR at all. If you are feeling brave you can look at my stepperFirmata and see how the simple modification let me use the sysex commands to add stepper capability. Of course if you are only using this sensor and not an array of others you are better off writing your own arduino < -> Max protocal and skip the firmata and maxuino.

  43. 43 Martin Kloppers said at 3:35 am on February 20th, 2012:

    Might it help me to increase the baud rate in the serial object in the maxuino patch? I left it where it was set, argument 57600. There is also the serial object in the “select serial port” section, in the patcher “p devices” which has no argument, and so is default at 4800… any help there?

    Thank you very much for the reply.

  44. 44 Getting my system to talk to the computer | Theoriginalrichsmith's Blog said at 12:45 pm on April 3rd, 2012:

    [...] http://www.maxuino.org/archives/58 [...]

  45. 45 Juan said at 12:41 pm on April 25th, 2012:

    Hi,

    Have an urgent problem that I could really do with some advice on…

    I’m most of the way through a project that depended on being able to use all 48 of my Mega Arduino pins with servos, but it seems that there is 15 pin limitation for this use. Anyone know a way around this/a quick fix?

    Many thanks in advance,

    Juan

  46. 46 Norbert said at 4:54 am on May 23rd, 2012:

    I’m dealing with some similar troubles already voiced here.

    I am running Mac 10.6.8 with Max 5.1.8 and connected to an Arduino Uno. I am trying to get Maxuino to receive digital input from a PIR sensor. I tested the board and sensor in the Arduino software so I know all of that is working. But…

    Maxuino seems to be missing a file. When I open maxuino.maxpat or maxuino.help.maxpat the Max window gives me the error:
    newObj maxuino-firmata: No such object

    I believe that my search path is OK, and the “Search Subfolders” box is ticked. However, I can’t find an object with the name “maxuino-firmata” so the correct path makes little difference! This seems like a really simple thing to fix but I can’t find any help in the C’74 forums or elsewhere. Hopefully I’m just missing something. Any suggestions?

  47. 47 maxuino said at 4:59 am on May 23rd, 2012:

    Norbert,
    in Maxuino v9 we were toying with a coded Maxuino object that is called in the Maxuino patch. It is not hooked up to anything so that should not be the issue. Please try the most recent stepper versions, they are a bit more refined and do not need the stepper firmata, it is just optional.

  48. 48 patrick harrop said at 9:57 pm on June 11th, 2012:

    Chris, Ali. Thanks very much for such a great tool. I hope this query gets to you. I am having some trouble developing a patch using Maxuino for 2 arduino mega boards. Each is being adressed through a separate USP port. However it is very difficult to adress each of the boards individually using maxuino. If i put in two bpatchers of the maxuino-gui interface the selection of the usb device will affect BOTH arduinos. I have tried to create clones of maxuino patches with different names so I am adressing separate patches rather than instances (as well creating clones of all the dependancies). But this does not seem to be working either. Do you have any suggestions as to how I can control more than one arduino mega using 2 instances of the maxuino patch?

  49. 49 Tony C said at 10:40 pm on July 5th, 2012:

    Does Maxuino work with Max6?
    Will there be an update for Max 6?
    Does Maxuino work with Arduino IDE 1.0 ?

    thanks

  50. 50 Joey M said at 9:39 am on July 11th, 2012:

    as far as i can tell, the two following questions were not answered:

    angelo reale at 3:46 am on January 11th, 2011

    and

    Jai at 3:14 pm on May 20th, 2010

    both users asked the same thing. they are attempting to get something to happen within live based on signal coming from the arduino. i am attempting the same thing. i can get leds to light up by sending midi notes but i want to control events in ableton with photocells and other sensors. i can see the m4l patch recieving the data but i don’t know how to map that midi cc data.

    i have looked through this site, readmes, internet etc with no luck.

    is this possible? i see where you mention it being in the roadmap for future releases but that post appeared to be from several years ago.


Leave a Reply