Skip to main content
DEJA

🔌 IO Devices

IO devices extend your layout beyond what the DCC-EX 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.

No code to write. DEJA IO includes the firmware that runs on your boards. Plug in your Arduino, ESP32 or Pico W, attach your accessories, configure them in Throttle, and deploy — from your browser (ESP32 WiFi and the Mega) or with one deja deploy. The firmware is built from your own configuration and ships as readable source, so it stays transparent and flexible: changing a pin is a redeploy, not a rewrite.

DEJA IO supports four firmware targets across three transports — USB serial, MQTT over WiFi and WebSocket over WiFi. 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 Firmware Setup guide
🟢 deja-arduino Arduino Mega 2560 (or compatible AVR) USB serial @ 115200 Arduino sketch Arduino & ESP32 Setup
🟠 deja-esp32 ESP32 Dev Module USB serial @ 115200 Arduino sketch (shared with deja-arduino) Arduino & ESP32 Setup
🛜 deja-esp32-wifi ESP32 Dev Module WiFi + MQTT or WebSocket Arduino sketch Arduino & ESP32 Setup
🍓 deja-mqtt Raspberry Pi Pico W WiFi + MQTT or WebSocket 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 (DEJA/{LAYOUT_ID}/{DEVICE_ID}), same single-object command format, same publish/subscribe semantics — and the same WebSocket endpoint when you pick WebSocket instead. 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, MQTT or WebSocket.

📡 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. The DEJA Server provides the MQTT broker — no separate install. This is the default for WiFi devices.
  • WebSocket (ESP32 WiFi, Pico W) — the device dials the DEJA Server at ws://<server>:8082/device with a per-device token from deja deploy. No broker involved; pick it under Transport when adding the device. The server opens its WebSocket port only when the layout has a WebSocket device (or ENABLE_WS is on).

🚀 Setting Up a Device

  1. Register the device — In Throttle, open Devices 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 layout configuration to the device. For WiFi devices the wizard prompts for WiFi credentials plus the MQTT broker or, for WebSocket devices, the DEJA Server's host and port.
  4. Verify — Open Throttle → Devices to see your device connect; tap it for its live serial log, or open Activity to watch sensors and effects change.

📚 Reference

🧰 Rather not wire it yourself? Track & Trestle, the makers of DEJA, builds Digital Dispatchers: your EX-CommandStation and DEJA IO boards pre-wired in one enclosure, configured for DEJA and tested before it ships.