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.)
-
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.
-
Install support for the Feather M0 in the Arduino IDE.
-
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.)
-
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 asAdafruit_BluefruitLE_nRF51
). -
Quit and restart the Arduino IDE.
-
Connect the Feather M0 board to your computer via a USB cable.
-
Go to Tools → Board, and, in the “Adafruit SAMD” section, select “Adafruit Feather M0”.
-
Under Tools → Port, select the port that has “Adafruit Feather M0” next to it in parentheses.
-
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.
-
(BLE only) Click on the tab for file
bleConfig.h
. Change the value ofFIRMATA_BLE_LOCAL_NAME
fromFIRMATA
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
.) -
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.)
-
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.