Setting up an Arduino or compatible microcontroller as a Firmata device

In order to be used with MWorks’ Firmata interface, an Arduino board or Arduino-compatible device must first be configured to support the Firmata protocol. To do this, follow these steps:

  1. Install and launch the Arduino IDE.

  2. (Optional, but recommended) For full compatibility with all features of MWorks’ Firmata interface, install the latest version of the Firmata library with MWorks extensions: Download and decompress the source code, change the name of the source folder to “Firmata”, and move it to $HOME/Documents/Arduino/libraries.

  3. Connect the board to your computer via its USB cable.

  4. Go to Tools → Board, and select the board you’re using. If you don’t see your board listed, you may need to install a core for it.

  5. Under Tools → Port, select the port that has your board’s name next to it in parentheses.

  6. The next step depends on how you’ll be connecting to your board from the machine running MWorks. If you’ll be…

    a. connecting from a Mac via a USB cable (i.e. a serial-via-USB connection), open File → Examples → Firmata → StandardFirmata.

    b. connectiing from a Mac or iPad via Bluetooth Low Energy (BLE), open File → Examples → Firmata → StandardFirmataBLE. Click on the tab for file bleConfig.h, and make any necessary changes to FIRMATA_BLE_LOCAL_NAME and other options.

  7. Click the “Upload” button (rightward-pointing arrow). This will compile and upload the StandardFirmata or StandardFirmataBLE code to your board.

  8. Disconnect the board from your computer, and quit the Arduino IDE.

At this point, your board should be ready to use as a Firmata device. To test it, reconnect it to your computer via its USB cable, and try running the Firmata blink demo experiment. This experiment toggles the state of digital pin 13 (typically connected to a built-in LED) every 500ms. If you’re connecting via BLE, be sure to set the value of the macro bluetooth_local_name to the string you used as FIRMATA_BLE_LOCAL_NAME in bleConfig.h.

If you run into problems at any point, have a look at the Instructables Firmata tutorial, which goes in to more detail on the various steps, or get in touch.