๐ IO Devices
IO devices extend your layout beyond what the DCC-EX CommandStation handles directly. They control effects like lighting, servo-driven turnouts, sensors, and animated elements โ anything that isn't powered through the DCC track bus.
DEJA IO supports four firmware targets across two transports โ USB serial and MQTT over WiFi โ plus a generic WebSocket API for custom integrations. Pick the device type that fits your hardware and how you want it connected. See the IO Guide for the full platform overview.
๐ฏ Supported Device Types
| Device type | Hardware | Transport | Sketch / Runtime | Setup guide |
|---|---|---|---|---|
๐ข deja-arduino | Arduino Mega 2560 (or compatible AVR) | USB serial @ 115200 | io/src/deja-arduino/ (Arduino sketch) | Arduino & ESP32 Setup |
๐ deja-esp32 | ESP32 Dev Module | USB serial @ 115200 | io/src/deja-arduino/ (shared sketch) | Arduino & ESP32 Setup |
๐ deja-esp32-wifi | ESP32 Dev Module | WiFi + MQTT | io/src/deja-esp32-wifi/ (Arduino sketch) | Arduino & ESP32 Setup |
๐ deja-mqtt | Raspberry Pi Pico W | WiFi + MQTT | io/src/deja-pico-w/ (CircuitPython) | Pico W Setup |
๐ค
deja-arduinoanddeja-esp32share the same sketch โ the only difference is the FQBN (Mega vs ESP32) and the upload speed. Same JSON-over-serial protocol, same handlers, same config file.๐
deja-esp32-wifianddeja-mqttshare the same MQTT topology โ same topic scheme ({TOPIC_ID}/{LAYOUT_ID}/{DEVICE_ID}), same single-object command format, same publish/subscribe semantics. Pick the one that matches your hardware.
๐ ๏ธ What These Devices Can Do
All four firmware targets share the same capabilities:
- ๐๏ธ PWM servos via an Adafruit PCA9685 16-channel servo driver โ for turnout motors and animated elements
- ๐ก Digital outputs โ for LEDs, relays, and on/off devices
- ๐ฆ Signal heads โ for model railroad signal aspects
- ๐ก Sensors โ for detecting train presence (block detection, occupancy)
- ๐ง Servo-driven turnouts via
TurnoutPulser
The handlers are identical regardless of transport โ the same pin / servo / turnout / effects / ialed actions work whether the message arrives over serial or MQTT.
๐ก Picking a Transport
- USB serial (
deja-arduino,deja-esp32) โ simplest setup, no networking, lowest latency. Ideal when the board lives next to the DEJA Server. - WiFi + MQTT (
deja-esp32-wifi,deja-mqtt) โ wireless, ideal for boards mounted inside scenery, under benchwork, or anywhere a USB cable is impractical. Requires an MQTT broker (Mosquitto recommended) on the same network as the server.
๐ Setting Up a Device
- Register the device โ In the Cloud app, go to your layout's Devices section and add a new device with a unique device ID and the matching device type.
- Flash the firmware โ See Arduino & ESP32 Setup (for
deja-arduino,deja-esp32,deja-esp32-wifi) or Pico W Setup (fordeja-mqtt). - Deploy configuration โ Run the deploy script to push your Cloud configuration to the device. The wizard prompts for WiFi/MQTT credentials when needed.
- Verify โ Open the Monitor app to see your device appear and respond to commands.
๐ Reference
- ๐ง Arduino & ESP32 Setup โ flash Mega, ESP32 USB, or ESP32 WiFi firmware
- ๐ Pico W Setup โ flash CircuitPython firmware to a Raspberry Pi Pico W
- ๐ Deploy to Devices โ push configs from Cloud to hardware
- ๐ Command Reference โ JSON command format for all device actions
- ๐ก Protocol Details โ Serial, MQTT, and WebSocket connection specs
- โ๏ธ Configuration Reference โ All config file formats per device type
- ๐ง Building Custom Devices โ Build your own MQTT or WebSocket devices
- ๐ WebSocket Integration โ Connect scripts and apps to the DEJA Server