Hardware Demos

Arduino Serial Bridge to Browser

Any Arduino — even a classic Uno with no WiFi — can feed live sensor data to the browser via a USB serial bridge.

Local workflowLocal setup requiredRequires hardwareSensor Scalar

What this demo proves

A non-networked Arduino (Uno, Mega, Nano, Leonardo) participates in DataNet flows when a local bridge script reads its USB serial output and publishes canonical telemetry. Three bridge paths are provided: Node.js, Python, and browser-native Web Serial API.

Platforms

Arduino (Uno/Mega/Nano)Node.jsPythonBrowser Web Serial APIp5.js

Payload types

IntegerFloatJSON

Channel names

demo.serial.arduinoBridge channel for Arduino serial data forwarded through a local runtime.

Example payload

{
  "sensor": "temperature",
  "value": 22.4,
  "unit": "C"
}

Compatibility notes

Browser JavaScriptNative
Node.jsNative
PythonNative
p5.jsNative
ProcessingNative
ArduinoJSON wrapped
ESP32 / ESP8266Native
Serial bridgeAdapter required
TouchDesignerNot yet supported

Run online

  • The browser bridge (bridge-browser/index.html) is the closest to online-runnable: open it in Chrome or Edge, click 'Connect Arduino', select the USB port, and data flows directly from the board to DataNet — no extra software needed.
  • Node.js and Python bridges require a local terminal.

Run locally

  • 1. Upload SerialSensor.ino to any Arduino (Uno, Mega, Nano, Leonardo, etc.).
  • 2a. Node.js bridge: cd demos/arduino-serial-bridge/bridge-node && npm install && DATANET_API_KEY=ak_... node bridge.mjs
  • 2b. Python bridge: pip install pyserial && DATANET_API_KEY=ak_... python demos/arduino-serial-bridge/bridge-python/bridge.py
  • 2c. Browser bridge: open bridge-browser/index.html in Chrome/Edge, enter API key, click 'Connect Arduino'.
  • 3. Subscribe from the browser playground or p5 sketch on channel demo.serial.arduino.

Expected output

  • Arduino emits JSON lines at 115200 baud: {"sensor":"temperature","value":22.4,"unit":"C","n":1}
  • Bridge script auto-detects the serial port, publishes each reading to DataNet.
  • Temperature and humidity values appear live in any subscribed browser surface.
  • Set ROUTE_BY_SENSOR=1 to split into demo.serial.arduino.temperature and demo.serial.arduino.humidity sub-channels.

Troubleshooting

  • If no port is detected automatically, set SERIAL_PORT=/dev/ttyUSB0 (Linux), /dev/tty.usbmodem* (macOS), or COM3 (Windows).
  • Web Serial API requires Chrome or Edge 89+ — it is not available in Firefox or Safari.
  • If values never appear in the browser, confirm the channel name matches on both publisher and subscriber.

Source files