Setting up an Adafruit Feather M0 Bluefruit LE as a Firmata device

The Adafruit Feather M0 Bluefruit LE is a good choice for use with MWorks’ Firmata interface, particularly if you need to connect via Bluetooth Low Energy (BLE). The following steps detail how to prepare your board for this role. (If you’re using a different board, see the general Firmata setup guide.)

  1. Update the BLE firmware. This is very important, as new boards purchased in 2019 are still shipping with BLE firmware from 2015, which is not adequate for MWorks’ needs.

  2. Install and set up the Arduino IDE.

  3. Install support for the Feather M0 in the Arduino IDE.

  4. Install the Adafruit nRF51 BLE library. (Note: You can also install this via the Arduino IDE’s Library Manager. Just be sure to install version 1.9.6 or later.)

  5. 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 (i.e. the same folder as Adafruit_BluefruitLE_nRF51).

  6. Quit and restart the Arduino IDE.

  7. Connect the Feather M0 board to your computer via a USB cable.

  8. Go to Tools → Board, and, in the “Adafruit SAMD” section, select “Adafruit Feather M0”.

  9. Under Tools → Port, select the port that has “Adafruit Feather M0” next to it in parentheses.

  10. 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. Proceed to step 12.

    b. connectiing from a Mac or iPad via BLE, open File → Examples → Firmata → StandardFirmataBLE.

  11. (BLE only) Click on the tab for file bleConfig.h. Change the value of FIRMATA_BLE_LOCAL_NAME from FIRMATA to something unique for your board. Next, find the line

    //#define BLUEFRUIT_LE_SPI
    

    and change it to

    #define BLUEFRUIT_LE_SPI
    

    (i.e., uncomment the line). Save your changes. (The IDE will probably prompt you to save your modified copy of the example to a new location in $HOME/Documents/Arduino.)

  12. Click the “Upload” button (rightward-pointing arrow). This will compile and upload the StandardFirmata or StandardFirmataBLE code to your board. (After uploading, you may see a message saying “Disk Not Ejected Properly”. You can safely ignore this.)

  13. 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 (which is 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, please get in touch.