This is an old revision of the document!


Controlling serial devices using Firmata

Firmata is a protocol for communicating with microcontrollers to, e.g., set digital outputs and read analog inputs from another computer. In the Blocks driver repo on GitHub, there is a driver that can be used to control a Firmata-enabled microcontroller from Blocks. This article describes how to install Firmata software on a microcontroller using the Arduino IDE and how to use the Firmata Blocks driver. It is assumed that the reader is familiar with the Arduino IDE.

:!: Note: The Firmata driver for Blocks only supports a subset of Firmata 2.6.0. More specifically, the driver supports controlling digital inputs and outputs, analog inputs and servos over a serial connection using the StandardFirmata 2.5.9 Arduino sketch. The driver has been tested to work with the Arduino Uno and Arduino Nano Every microcontrollers.

Adding StandardFirmata to a microcontroller using Arduino IDE

  • In the Arduino IDE Library Manager, search for and install Firmata version 2.5.9.
  • In the Arduino IDE, open the file libraries/Firmata/examples/StandardFirmata/StandardFirmata.ino. The "libraries" folder is usually located in My Documents/Arduino/ on Windows and in home/Arduino/ on Linux.
  • Upload the file to the microcontroller.

Using the driver

  • Make sure the driver files has been installer on the server.
  • Connect the Firmata enabled device to a PIXILAB Player Spot.
  • Add the serial device in the Blocks editor on the Manage page. Use the "Firmata" driver.
  • Configure the device according to the instructions in the top comment in Firmata.ts driver sourcefile.