Skip to main content

πŸš€ Deploy to Devices

The DEJA deploy wizard reads your device's configuration from the Cloud app, generates the right config files for the device type, and (optionally) flashes the firmware. The same wizard handles all four IO device types β€” deja-arduino, deja-esp32, deja-esp32-wifi, and deja-mqtt.

🎬 Running the Deploy Wizard

deja deploy

The interactive wizard walks you through:

  1. πŸ—ΊοΈ Layout selection β€” pick the layout from your DEJA Cloud account
  2. πŸ“Ÿ Device selection β€” pick a registered device (auto-filtered to flashable types)
  3. πŸ” WiFi/MQTT credentials β€” only for deja-esp32-wifi and deja-mqtt: enter SSID, password, broker IP, optional username/password
  4. πŸ“¦ Config generation β€” pulls in the device's configuration along with any effects, turnouts, sensors, and signals assigned to it in the Cloud app, and writes platform-specific config files
  5. ⬆️ Build & flash β€” compiles the firmware (or copies CircuitPython files) and uploads to the connected board

πŸ› οΈ arduino-cli and the esp32:esp32 core are auto-installed if not found on your system. Required Arduino libraries (Adafruit PWM Servo Driver Library, ArduinoJson, TurnoutPulser, and β€” for deja-esp32-wifi β€” PubSubClient) are also auto-installed.

πŸ“¦ What Gets Deployed

🟒 deja-arduino (Arduino Mega over USB)

Generates config.h with:

  • DEVICE_ID from your Cloud device entry
  • Feature flags based on what's configured (effects β†’ ENABLE_OUTPUTS, turnouts β†’ ENABLE_TURNOUTS, etc.)
  • OUTPINS, SIGNALPINS, SENSORPINS arrays from your device's pin mapping
  • TurnoutPulser definitions from your configured turnouts

Then compiles + uploads via arduino-cli against the Mega FQBN.

🟠 deja-esp32 (ESP32 over USB)

Same config.h shape as deja-arduino (the sketch is shared) β€” only the build target changes. Compiles + uploads via arduino-cli against the ESP32 FQBN at 460800 baud upload speed.

πŸ›œ deja-esp32-wifi (ESP32 over WiFi/MQTT)

Generates config.h with everything deja-arduino ships plus the WiFi/MQTT credentials baked in at build time:

  • WIFI_SSID, WIFI_PASSWORD β€” entered during the wizard
  • MQTT_BROKER, MQTT_PORT, MQTT_USERNAME, MQTT_PASSWORD β€” entered during the wizard
  • LAYOUT_ID, DEVICE_ID, TOPIC_ID β€” sourced from your Cloud config

Then compiles + uploads against the ESP32 FQBN. After flashing, the device connects to WiFi, subscribes to {TOPIC_ID}/{LAYOUT_ID}/{DEVICE_ID}, and starts processing commands.

πŸ“ deja-mqtt (Raspberry Pi Pico W)

Generates:

  • settings.toml with WiFi credentials, MQTT broker address, layout ID, and device ID
  • config.json with the pin mapping from your device configuration

Then copies code.py, lib/, settings.toml, and config.json to the mounted CIRCUITPY drive β€” no compilation required.

πŸ› οΈ Flashing By Hand

If you'd rather flash an Arduino-family board yourself instead of letting the wizard do it, deja deploy also drops a self-contained bundle you can open in PlatformIO, Arduino CLI, or the Arduino IDE. The exact commands for your board are shown on the Cloud app's device details page and in the bundle's own DEPLOYMENT.md β€” copy them from there rather than guessing, since they're generated per device type.

deja-mqtt (Pico W) doesn't have a manual build step β€” it's just CircuitPython files copied to the CIRCUITPY drive, which the wizard does for you.

Your device must be registered in the Cloud app before deploying. See Cloud β†’ Devices.

πŸ“š Next Steps