Skip to main content

serial-out

Send data to serial port devices such as Arduino, displays, and industrial controllers.

Overview

The serial-out node writes data to a serial (UART) port. It sends commands and data to devices like Arduino boards, LCD displays, motor controllers, and industrial equipment over RS-232, RS-485, or USB-to-serial adapters. Supports string, byte array, and auto-converted data formats with optional newline appending.

UART
Serial output
USB
Serial adapter
RS-232
Legacy devices
RS-485
Industrial bus

Properties

Property Type Default Description
port string "" Serial port path (e.g., /dev/ttyUSB0, /dev/ttyACM0, COM3)
baudRate number 9600 Baud rate: 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
dataBits number 8 Number of data bits per frame: 5, 6, 7, or 8
stopBits number 1 Number of stop bits: 1 or 2
parity string "none" Parity checking: none, even, or odd
addNewline boolean false Append a newline character (\n) after each message

Data Format

The node reads msg.payload.data and handles multiple input types automatically.

String

Sent as UTF-8 bytes directly to the serial port. Ideal for text commands and AT commands.

Byte Array

Sent as raw bytes. Use for binary protocols, Modbus frames, and hex data.

Other Types

Auto-converted to string using fmt.Sprintf. Numbers, booleans, etc. become their string representation.

Example: Send Commands to Arduino

Send LED control commands to an Arduino board over USB serial.

// serial-out node configuration
{
  "port": "/dev/ttyACM0",
  "baudRate": 9600,
  "dataBits": 8,
  "stopBits": 1,
  "parity": "none",
  "addNewline": true
}

// Input msg from inject or function node:
{
  "payload": {
    "data": "LED_ON:13"
  }
}

// Sent to Arduino: "LED_ON:13\n"
// Arduino sketch reads with Serial.readStringUntil('\n')

// Example flow:
// [inject "LED_ON:13"] → [serial-out /dev/ttyACM0]
// [dashboard slider] → [function] → [serial-out]

Example: Serial LCD Display

Send text to a serial-connected LCD display for real-time status updates.

// serial-out node configuration
{
  "port": "/dev/ttyUSB0",
  "baudRate": 9600,
  "addNewline": false
}

// Function node formats display text:
// msg.payload = {
//   data: "Temp: " + msg.payload.temperature + "C"
// };
// return msg;

// For multi-line LCD:
// Line 1: "\xFE\x80" + "Temp: 23.5C"
// Line 2: "\xFE\xC0" + "Hum:  65.2%"

// Flow: [sensor] → [function format] → [serial-out LCD]

Example: Modbus RTU Command

Send a Modbus RTU read request to an industrial sensor over RS-485.

// serial-out node configuration
{
  "port": "/dev/ttyUSB1",
  "baudRate": 19200,
  "dataBits": 8,
  "stopBits": 1,
  "parity": "even",
  "addNewline": false
}

// Function node builds Modbus RTU frame:
// const addr = 0x01;       // Device address
// const func = 0x03;       // Read holding registers
// const reg = 0x0000;      // Starting register
// const count = 0x0002;    // Number of registers
// msg.payload = {
//   data: Buffer.from([addr, func,
//     (reg >> 8), (reg & 0xFF),
//     (count >> 8), (count & 0xFF)])
// };
// // CRC would be appended by protocol handler

// Flow: [inject trigger] → [function build frame] → [serial-out RS-485]
//       [serial-in RS-485] → [function parse response] → [dashboard]

Common Use Cases

Arduino / ESP32 Control

Send commands to control LEDs, motors, relays, and actuators

LCD / OLED Displays

Output status information to serial-connected displays

Industrial Control

Send Modbus RTU commands to PLCs and controllers over RS-485

AT Commands

Send AT commands to cellular modems, WiFi modules, and Bluetooth devices

Related Nodes