WOLFRAM SYSTEMMODELER

UsingCustomBoard

Using a Firmata-compatible board

Diagram

Wolfram Language

In[1]:=
Click for copyable input
SystemModel["ModelPlug.Examples.UsingCustomBoard"]
Out[1]:=

Information

Hardware Components Used

  • 1 Teensy 3.1 board

Description

This example shows how to use a board with a custom version of Firmata. The Teensy board works perfectly with the StandardFirmata, but in this example it is modified in order get a faster data transfer speed.

The main difference of the CustomFirmata component is that it allows you to set the baud rate to the sampling interval that you want to use. In this case the oce of the StandardFirmata is modified to use a baud rate of 115200. You can perform this modification in the source code. Search for the line:

Firmata.Begin(57600);

and change it to

Firmata.Begin(115200);

This initializes the serial port at the given speed. The next change that you can make is reducing the minimum sampling interval. You can find this tweak by searching in the code for the text:

#define MINIMUM_SAMPLING_INTERVAL 10

and changing it to

#define MINIMUM_SAMPLING_INTERVAL 1

This changes the sampling interval limit from 10 ms to 1ms. This change is possible as the Teensy board can run up to 96 MHz. Whenever changing the sampling interval you also need to ensure that the sampling interval in Simulation Center matches it, as shown in the figure below.

Components (3)

booleanPulse

Type: BooleanPulse

digitalOutput

Type: DigitalOutput

customFirmata

Type: CustomFirmata