Skip to main content

Communication — Serial family

Once a buffer is built (see Strings and Text) you need a transport for it. The oldest, simplest, most universal one is serial — a stream of bytes flowing in and out of a single pair of pins. NodeBlue exposes serial transports as a small family of modules; pick the variant that matches your physical wiring.

ModuleUse it when…Physical layer
USBSerialTalking to a host PC over the board's USB cable.USB CDC (no extra wiring).
SerialWiring two boards together (or a board to a level-converted UART module).Hardware UART pins (TX/RX).
SoftwareSerialThe MCU's hardware UARTs are all used up.Any two GPIOs, bit-banged.
RS485Long cable runs, multi-drop bus, industrial gear.RS-485 differential line via a half-duplex transceiver chip.

All four modules share the same shape: a byte buffer in / byte buffer out. Drop one in, configure the port and baud rate, and wire your text or binary buffers to its input — anything you read appears on the output. From a NodeBlue program's point of view all four look identical; the choice is purely about how the bits leave (and enter) the board.

Shared parameters​

Across the family, the parameters you'll tune most often are:

ParameterDescription
PortThe hardware UART (or USB endpoint, or pair of GPIOs for SoftwareSerial).
BaudBytes-per-second clock. Standard values: 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600. Both ends must agree.
ConfigData bits, parity, stop bits. The default 8N1 (8 data bits, no parity, 1 stop bit) is right 99 % of the time.
RX pin / TX pinFor SoftwareSerial and RS485 — the GPIOs used for receive and transmit. RS485 also asks for a DE/RE pin to flip the transceiver between transmit and receive.

USBSerial​

The simplest case. The board enumerates as a serial device on the host (a COM port on Windows, /dev/ttyACM* or /dev/ttyUSB* on Linux/macOS). Anything written to the module appears in the host's serial monitor, and anything the host sends arrives on the output. This is exactly what the IDE's serial console and plotter read.

For a typed-number flow FormatText → USBSerial, the host sees the live values; for the reverse USBSerial → StringToNumber, the host can control the board by typing.

Serial (hardware UART)​

A board-to-board link, or to any UART peripheral (GPS, fingerprint reader, weight sensor, classic Bluetooth module). The Port picker shows whichever hardware UARTs your board exposes. Match the baud rate and the wiring rule of UART — cross-connect TX↔RX — and you're done.

The Examples/04-Communication/NodeBlueInterfaceSerial example shows a board acting as an NBI host over a UART — the same wire-format the USB-HID config link uses, but on plain TTL pins.

SoftwareSerial​

When you've run out of hardware UARTs (small boards often have just one or two, sometimes already used by USB or a board feature), SoftwareSerial bit-bangs another one in software. Pick any RX pin and TX pin and you have a second port. The trade-off is CPU: high baud rates leave less time for everything else, and the line is noisier — don't push it past about 57600 baud on most boards.

RS485​

For long cables, electrically noisy environments, or multi-board buses, RS485 replaces single-ended TTL with a differential pair. The MCU still drives a UART; an external transceiver chip (MAX485, SN75176, etc.) translates between TTL and the A/B differential lines.

Because RS485 is half-duplex — only one node may drive the bus at a time — the transceiver has a direction control pin (DE / RE). The NodeBlue RS485 module takes a DE/RE pin parameter and flips it automatically around every transmit. From your design's perspective it still looks like a plain byte-in / byte-out module.

A note on the NodeBlueInterface over serial​

For boards that don't expose a HID config interface (e.g. an Arduino UNO over USB-CDC), you can still drive them from the IDE — drop a nNodeBlueInterface module wired to a serial transport. Once uploaded, the IDE talks to the board over the same COM port, using the same NBI commands as the HID path. This is what makes the dashboard's live SetParam work over plain USB-CDC.

Now let's leave wires behind and go wireless: Wireless communication.