Making Max/Ableton talk Firmata/Arduino

Maxuino v.008

Posted: February 18th, 2010 | Author: | Filed under: Tutorials, Updates | 16 Comments »

Download: http://www.maxuino.org/wp-content/uploads/2010/02/maxuino-008.zip

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

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

  • Adruino Diecimila and Duemilanove
  • Arduino Mega
  • Teensy 2.0
  • Teensy++ 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 (also included in the above download).  To do this, 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:

  • maxuino_test.maxpat: the center piece test patch
  • maxuino-Apin-gui.maxpat: a GUI bpatcher for analog pins
  • maxuino-Dpin-gui.maxpat: a GUI bpatcher for digital pins
  • maxuino-gui.maxpat: a GUI abstraction for all inputs and outputs
  • 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
  • maxuino.maxpat: an abstraction that contains the above javascript
  • firmata.tar.gz: see step 3 above

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.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


16 Comments on “Maxuino v.008”

  1. 1 nic said at 5:10 am on March 4th, 2010:

    For some reason the digital inputs 0, 1, and 13 will not activate.
    Also, I know that the arduino’s analog pins are also digital pins 14-19. Is there a way to set them as digital ins in the interface patch for Max/MSP? I’m trying to use all the pins on my arduino as digital inputs.

  2. 2 Lisa Marie said at 4:53 pm on March 4th, 2010:

    Hi-

    I am working with the Arduino Duemilanove. I have figured out how to send input sensor data to Max/MSP 5 from Arduino through Maxuino-007.

    Now I would like to learn how to send message back out from Max/MSP to the Arduino pins. I have not found any tutorials on-line as to how to do this. The Maxuino-008 update seems to be better at two way communication but it doesn’t seem to work with Duemilanove.

    Any suggestions of where to find help would be greatly appreciated!

  3. 3 maxuino said at 6:48 pm on March 4th, 2010:

    nic,
    digital pins 0 and 1 are tied up talking to max via the usb port and so firmata keeps them from being used. I am not sure what the issue is with pin 13 however.
    Firmata also does not allow for changing the analog pins to digital pins, but it should be noted that you could just use max to detect when they go over a certain value to register as “on.” You might just have to pick up a mega….
    Sorry.
    Chris

  4. 4 maxuino said at 6:52 pm on March 4th, 2010:

    Maxuino v.008 should in fact be working with Duemilanove, even with the ATMEGA 328 chip. I know it is not an explicit selection but there were no real changes to pins and so it should function just the same. Give it a try, and let us know if you have troubles, or if you already have, let us know what is happening. Please be sure you are using the version of Firmata we have packaged with the release as it is the latest beta.

  5. 5 Lisa Marie said at 5:09 am on March 5th, 2010:

    Thanks for the response. I’ve followed the steps to use Maxuino 008 and I am getting an error message in the Firmata code when uploading to the Arduino.

    The error says: ‘TOTAL_PINS’ was not declared in this scope (line 34)

    error: ‘TOTAL_PINS’ was not declared in this scope In function ‘void checkDigitalInputs()’:
    In function ‘void setPinModeCallback(byte, int)’:
    In function ‘void analogWriteCallback(byte, int)’:
    In function ‘void digitalWriteCallback(byte, int)’:
    In function ‘void sysexCallback(byte, byte, byte*)’:
    In function ‘void setup()’:
    In function ‘void loop()’:

    Any suggestions on how to get this working would be much appreciated.

  6. 6 TimL said at 8:31 am on March 29th, 2010:

    Thanks for the straight forward explanation of working with max/msp to arduino. Set up was simple and communication is working both ways.
    I would like to be able to use the OSC part of the patch to control the arduino, most likely from an iPhone or Wiimote. How do I set up up communication between an iPhone with an OSC client (i.e. mrmr) and the OSC part of the maxuino test patch?
    I’d appreciate any guidance you could offer.
    Thanks.

  7. 7 maxuino said at 11:14 pm on March 29th, 2010:

    Hello,
    If you want to control maxuino from an iphone, you need to put down a udpreceive in a maxpatch, set it to the right port for receiving OSC messages from your controller, and then make a translation/mapping max patch that reformats the incoming OSC messages from your controller to ones that maxuino understands (i.e. things like /4/digOut 1, or /11/pwm .5).

    let us know if you have any other questions.

  8. 8 TimL said at 2:43 am on March 30th, 2010:

    Thanks. The udpreceive object is receiving the OSC Message in max. Prints out as “/mrmr/pushbutton/4/iphone-name 1. ” and other similar messages. I take this to mean that mrmr has it’s own set of messages that can be read by the OSC route object, which maxuino doesn’t understand. Perhaps mrmr can output the right messages for maxuino? As you suggested, translating/mapping the OSC messages may be an option, could you let me more about this?
    Thanks.

  9. 9 maxuino said at 8:04 am on April 5th, 2010:

    try this:


    ----------begin_max5_patcher----------
    2082.3oc0atzjhaCD.9LyuBEpbHoByLVxRF6T4R1jqakspI4TxVaIr0.Nqwh
    xVd1cyV4+dzCavFjAAXXHW.jeH28mZ0pc2hud2nwy3elUNF7if+DLZzWuazH
    8gTGXTc6QiWR+bbFsTeYii4KWxxEimXNmf8Yg93hphb.O+Q9yOCRRmm9aUBY
    Svpzb.B2b0oI5qkO6uuGE0bvm44hb5Rl9T+bQJMq4L4UKSyyXB8SFt4f7JQy
    Q8Z0Iko+itSfnGZN7JpHdQZ97OTvhEF0D4OUdZ.hntJ.jDpa48fG38p64eu6
    N0GSNSb7EdEHllCnYkbff9QFPAlRVwKrBZFHmmvJAoJhw.y413i2IxmUErRo
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KoaAsLzX6z4VyjcSiamrJ2WEUPcpGvt
    Yv0d1a2YHxYgB4hPM85JSDGjIzUUjvNMzcUEIeGDI70cbKHvYKbn6RkzYUXS
    bm06LAbnIsscZAq+SPPzou1jm0yReTYEskf5PohNrxPPA58SafdGHShz4Ddq
    V95KIvjGdcqyTQbxwSPvwMrTKej5+YSRrudTRcnyk8tXd2quRXOhrmYyL6aj
    bypfa0xyP8fo5uTsNSMIzEEI33TDBFaTDi9DDtt04hcWb8FdbBaCKq4b8Vvu
    aKOc95aTKUqy0Wjmy17GwrW0+eu0V4Xy+1nsNxYudL4RH3ChTAGZWHmoT4Bo
    7upbBcgkHYi+8t+iyuwxT
    -----------end_max5_patcher-----------

  10. 10 TimL said at 6:11 am on April 6th, 2010:

    I came up with a very similar work around patch to what you’ve shared so good to know I was on the right path. I’ve also found that using the iOSC app will allow you to customize what OSC messages to send, so I’ve got 2 working options now and have been able to learn a whole lot more about OSC, max and Arduino.
    Thanks a million.

  11. 11 Amy said at 5:18 pm on April 23rd, 2010:

    Thanks for the response. I’ve followed the steps to use Maxuino 008 and I am getting an error message in the Firmata code when uploading to the Arduino.

    The error says: ‘TOTAL_PINS’ was not declared in this scope (line 34)

    error: ‘TOTAL_PINS’ was not declared in this scope In function ‘void checkDigitalInputs()’:
    In function ‘void setPinModeCallback(byte, int)’:
    In function ‘void analogWriteCallback(byte, int)’:
    In function ‘void digitalWriteCallback(byte, int)’:
    In function ‘void sysexCallback(byte, byte, byte*)’:
    In function ‘void setup()’:
    In function ‘void loop()’:

    Any suggestions on how to get this working would be much appreciated.

  12. 12 Rick said at 8:02 pm on April 24th, 2010:

    […] also been looking at various Max/Msp patches, which use the serial input from the Arduino. (Maxuino for instance), and have used the pachube feeds to change the frequency of a synth, so if someone […]

  13. 13 maxuino said at 8:12 pm on April 24th, 2010:

    Typically that means you do not have our version of Firmata in the right place, but I have also had that come up and had to re-download Arduino IDE to get it working again.

  14. 14 Anthony said at 10:15 pm on April 24th, 2010:

    try this:


    ----------begin_max5_patcher----------
    2082.3oc0atzjhaCD.9LyuBEpbHoByLVxRF6T4R1jqakspI4TxVaIr0.Nqwh
    xVd1cyV4+dzCavFjAAXXHW.jeH28mZ0pc2hud2nwy3elUNF7if+DLZzWuazH
    8gTGXTc6QiWR+bbFsTeYii4KWxxEimXNmf8Yg93hphb.O+Q9yOCRRmm9aUBY
    Svpzb.B2b0oI5qkO6uuGE0bvm44hb5Rl9T+bQJMq4L4UKSyyXB8SFt4f7JQy
    Q8Z0Iko+itSfnGZN7JpHdQZ97OTvhEF0D4OUdZ.hntJ.jDpa48fG38p64eu6
    N0GSNSb7EdEHllCnYkbff9QFPAlRVwKrBZFHmmvJAoJhw.y413i2IxmUErRo
    DQEo77VpsOgn02o9pu7p+.79Ahpc6djo0fSUMHMrSgyOkJV.9sm9k6KjxNyB
    DguZFYSwZbXr0fSgmENVxJKoyY6fiGQ3Galq8sPa5+ziT+QV0e3Qq+PeyzJh
    1bHzXaD1xdyz6hurhYtgwiOIxH3ymmYcjmbDiuv8MPFnjc7Z64lgw9ziToY6
    .qJngQUZFSf9Wbcou4u+QICHuvpzb98yqRAz7jl1.o9yDKXE17EhsZF+6ErY
    UwKXBvaeB7FdVxd4zyEymUCBs0X6ONM2fJ0JlmwKNX2ZazvK3Aee+nPrz5JL
    ROX3iNK2D4rOIo0NPWtfvJlDzq3EBKvc5AY6IX90lXQ6yQQfmFVXL7AxDPfu
    wc4v6nnO1.RXujFKCAZWvD5LXVjljvx2hJCNpH9ZmPX47WIpvQNgp1cGqnFP
    0DR9rSyXx.RJkgJzRjFMtsYp5wPzOL+PyxXg3MOTI2mmwi+HKo0DlQiSXOeL
    8AWZft458ZGgRmvTLWYZd6Xb194RqxDev9L1tm+YZLq2a15ZkiFOuHMgmqDh
    N2o5vMONo9ZVtizVt0WQNckkaVv4YynEujVlNKi0YbPZSSySWRELQpQdPdqu
    uzkqJzdna0WrbprOVTFWvyx5zUly7hkyXlA7ozDwBcesgVcd4fV1Mcls0436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QbBVUW.85D0o2dn8YPKlC+QfIQp8UV7nWWXfv3cfA4rfQeA30
    T+WKyv7FxIXvi2f.GoYPPz5oYD3NgObY2f.M6NEpM9DD75Bnos3iwFwI2PWZ
    WP8fxpD4RIwLYjOfPOOOK.kLH6Vuie2pYxxrYK6EEc38E0fZgwKiM6eQviqp
    JWHeIdAO+Q7ioqVvyY2qwvtnBOHnBcparOn4EIPPG1EYspmyfSrkEKssgw7e
    koCVGFUD4RBmd2TnJlzqoj88IJ50ZahF1ZkMj2Eaahthlyxro2nSXQ7Yya42
    z6A7TORXnxkIAG4gT+.ICmFFbvXuCPs1Afl8loYi.B8ZyfYz3ONWZummbpge
    2m5Cwulpuu2F82Ox7thd5INg9No95KoaAsLzX6z4VyjcSiamrJ2WEUPcpGvt
    Yv0d1a2YHxYgB4hPM85JSDGjIzUUjvNMzcUEIeGDI70cbKHvYKbn6RkzYUXS
    bm06LAbnIsscZAq+SPPzou1jm0yReTYEskf5PohNrxPPA58SafdGHShz4Ddq
    V95KIvjGdcqyTQbxwSPvwMrTKej5+YSRrudTRcnyk8tXd2quRXOhrmYyL6aj
    bypfa0xyP8fo5uTsNSMIzEEI33TDBFaTDi9DDtt04hcWb8FdbBaCKq4b8Vvu
    aKOc95aTKUqy0Wjmy17GwrW0+eu0V4Xy+1nsNxYudL4RH3ChTAGZWHmoT4Bo
    7upbBcgkHYi+8t+iyuwxT
    -----------end_max5_patcher-----------

  15. 15 Rick said at 12:26 am on April 25th, 2010:

    Hello,
    If you want to control maxuino from an iphone, you need to put down a udpreceive in a maxpatch, set it to the right port for receiving OSC messages from your controller, and then make a translation/mapping max patch that reformats the incoming OSC messages from your controller to ones that maxuino understands (i.e. things like /4/digOut 1, or /11/pwm .5).

    let us know if you have any other questions.

  16. 16 koredom said at 6:42 pm on July 24th, 2010:

    Hello dear Maxuino Team
    I’m pretty new to the Arduino / Max and stuff. But i got most of it working. I.e.: I recieve the signal on the Maxuino_test (I see the slider moving)
    Now to my question: How to start fresh with a new Max Patch to read the Pins and send to the pins signal? How can i include those sliders and take the output numbers to work with them? Any Tutorial on the net? Any Start-Patch around?

    Thank you very much for you great work. Much appreciated.

    Jakob


Leave a Reply