Skip to main content

๐Ÿ”Œ 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 typeHardwareTransportSketch / RuntimeSetup guide
๐ŸŸข deja-arduinoArduino Mega 2560 (or compatible AVR)USB serial @ 115200io/src/deja-arduino/ (Arduino sketch)Arduino & ESP32 Setup
๐ŸŸ  deja-esp32ESP32 Dev ModuleUSB serial @ 115200io/src/deja-arduino/ (shared sketch)Arduino & ESP32 Setup
๐Ÿ›œ deja-esp32-wifiESP32 Dev ModuleWiFi + MQTTio/src/deja-esp32-wifi/ (Arduino sketch)Arduino & ESP32 Setup
๐Ÿ“ deja-mqttRaspberry Pi Pico WWiFi + MQTTio/src/deja-pico-w/ (CircuitPython)Pico W Setup

๐Ÿค deja-arduino and deja-esp32 share 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-wifi and deja-mqtt share 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

  1. 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.
  2. Flash the firmware โ€” See Arduino & ESP32 Setup (for deja-arduino, deja-esp32, deja-esp32-wifi) or Pico W Setup (for deja-mqtt).
  3. Deploy configuration โ€” Run the deploy script to push your Cloud configuration to the device. The wizard prompts for WiFi/MQTT credentials when needed.
  4. Verify โ€” Open the Monitor app to see your device appear and respond to commands.

๐Ÿ“š Reference