External Device Serial Port

Opens a serial port to communicate with a hardware device over a serial line: an Arduino or another microcontroller board, a USB-serial adapter, a Bluetooth serial device, etc.

The module sends text strings, byte arrays and MIDI/Firmata messages. It outputs the received bytes as an array: all of them, by blocks of a fixed size, or up to a delimiter byte.

Works on Windows, macOS and Linux.

This module replaces the former Serial Port user module. A patch saved with the user module opens with this module, with its values, settings and connections.

how to find the port name

  • Windows: the device manager, under Ports (COM & LPT), shows names like COM3, COM4, etc.
  • macOS: names like /dev/cu.usbmodem1411 or /dev/cu.usbserial-A600xxxx. The /dev/tty.* names also work.
  • Linux: /dev/ttyUSB0 for a USB adapter, /dev/ttyACM0 for an Arduino or another USB device of the CDC class, /dev/ttyS0 for a port of the motherboard (not shown in ports, type the name in port).

The ports list shows the ports found on the computer.

On Linux, the user must belong to the dialout group to open a serial port: sudo usermod -a -G dialout $USER, then log out and log in again.

Settings

port

Name of the serial port. Changing it while the module is on opens the new port.

ports

Serial ports found on the computer. Selecting a port sets port. The list is not saved with the patch: port is.

rescan ports

Searches the serial ports again, for example after plugging a device.

baudrate

Transmission speed in bits per second, from 300 to 921600. It must match the speed of the device (for example Serial.begin(57600) in the Arduino code). A change is applied at once when the port is open.

rx buffer size

Size of the blocks sent to rx data, from 0 to 128 bytes:

  • When greater than 0: rx data receives blocks of this size.
  • When 0: rx data receives the bytes up to the rx byte delimiter, or every byte received when there is no delimiter.

rx byte delimiter

Byte value, from 1 to 255, that ends a message when rx buffer size is 0: for example 10 for a line feed (LF), 13 for a carriage return (CR). The delimiter is not part of rx data. 0 or -1: no delimiter.

on

Opens the port when on, closes it when off. A patch saved with the module on opens the port when it is loaded.

connected

On while the port is open.

tx data (string)

Text sent to the device each time it changes, as 8-bit characters (system code page on Windows, UTF-8 on macOS and Linux), without any line ending.

tx data (array)

Bytes sent to the device each time the array changes, one byte per value.

Array values must be in the range 0-255.

tx data (midi/firmata)

MIDI messages sent to the device, each one as 3 bytes: the message, data 1 and data 2. The channel is not added to the message byte. This is the format of the Firmata protocol.

clear rx buffer

Drops the bytes received and not yet sent to rx data.

rx data

Bytes received, as an array of values from 0 to 255.

rx buffer overflow

On when received bytes were lost because rx data did not read them fast enough, for example with a delimiter that never comes: rx data outputs at most one block or message per processing cycle.

protocol

For experts: the serial format. It must match the setting of the device.

parity

none, odd or even.

char size

Number of data bits, from 5 to 8.

stop bits

one, one point five or two. One point five is not available on macOS and Linux, where one stop bit is used.

trace

level

What the module writes in the trace panel. The errors are always written.

  • none: nothing.
  • info: the connections and the setting changes.
  • debug: info, plus the number of bytes sent and received.
  • verbose: debug, plus the bytes sent and received.
Common Settings

info

show manual

Button. Opens the manual page of the selected object (or of its parent module for a control) in the web browser. If no page exists for this object, an error is traced in the trace panel.

For more details about information/help creation, see create-help-file.

description

Free multi-line text attached to the module, saved with the patch. When it is not empty, it is shown as the hint of the module (mouse over the module header in the patch) in place of the default module hint, even when the module hints are disabled.

ID's

visible only in god mode, see setup-panel-tab-expert.

unique ID

Read-only, not saved. Current private numeric ID of the object, used internally to identify it (for example as the target of a bind ID).

preset ID

Read-only, not saved. Private ID used to store and recall the values of this control in presets.

recreate ID

Button. Generates a new unique ID, original ID and preset ID for the object. Use it if you experience difficulties in Polyphonic mode or if two objects share the same ID. Preset values and binds referring to the old IDs are lost.

Object Remote Address

absolute

Read-only, not saved. Absolute address of the object in the Usine objects tree, built from the workspace root. This is the address to use to reach the object from scripts, the objects panel or remote messages. Only shown for objects that are registered in the objects list. See objects-address.

local

Read-only, not saved. Address of the object relative to the current patch, valid inside that patch only. See objects-address.

user addr

Free user-defined address for the object (empty by default). When set, the object is also registered in the objects tree under this name, so it can be reached independently of its position in the workspace (the value is also reported in the mouse-over and mouse-down chunks). Changing it rebuilds the objects list. Only available on objects that support a user address. See objects-address.

See also

version 7.0.250921

Edit All Pages