βοΈ Configuration Reference
DEJA IO devices use different configuration formats depending on the device type and transport. This reference covers all of them.
| Device type | Config file(s) | Generator |
|---|---|---|
π’ deja-arduino | config.h (compile-time) | generateArduinoConfig() |
π deja-esp32 | config.h (compile-time) | generateArduinoConfig() |
π deja-esp32-wifi | config.h (compile-time, with baked WiFi/MQTT) | generateEsp32WifiConfig() |
π deja-mqtt (Pico W) | settings.toml + config.json (runtime) | generatePicoSettings() + generatePicoConfig() |
All generators live in @repo/modules/device-config and are shared between the Cloud app, the IO build/deploy scripts, and the deja deploy CLI.
π’π Arduino & ESP32 USB β config.h
Compile-time configuration shared by deja-arduino and deja-esp32. The Arduino firmware reads these values at build time. Located at io/src/deja-arduino/config.h (copy from config.default.h if it doesn't exist).
π¦ Feature Flags
| Flag | Type | Default | Description |
|---|---|---|---|
DEVICE_ID | string | "deja-arduino" | Unique device identifier β must match your Cloud device entry |
ENABLE_PWM | bool | true | ποΈ Enable PCA9685 servo driver support |
ENABLE_OUTPUTS | bool | true | π‘ Enable digital GPIO outputs |
ENABLE_SIGNALS | bool | true | π¦ Enable signal head control |
ENABLE_SENSORS | bool | true | π‘ Enable sensor input reading |
ENABLE_TURNOUTS | bool | true | π§ Enable servo-driven turnouts |
πͺ Pin Arrays
int OUTPINS[] = {8, 9, 10, 11}; // Digital output GPIO pins
int SIGNALPINS[] = {4, 5, 6, 7}; // Signal head GPIO pins
int SENSORPINS[] = {A0, A1, A2}; // Sensor input pins (analog or digital)
π§ Turnout Definitions
TurnoutPulser turnouts[] = {
TurnoutPulser(channel, closedAngle, thrownAngle),
};
channelβ PCA9685 servo channel (0β15)closedAngleβ servo angle for closed position (degrees)thrownAngleβ servo angle for thrown position (degrees)
π ESP32 WiFi β config.h
Compile-time configuration for deja-esp32-wifi. The sketch lives at io/src/deja-esp32-wifi/. Unlike the Pico W (which reads settings.toml at runtime), the ESP32 WiFi firmware bakes WiFi and MQTT credentials in at build time. The deja deploy wizard prompts for these and writes them in via generateEsp32WifiConfig().
πΆ WiFi Settings
| Define | Type | Required | Description |
|---|---|---|---|
WIFI_SSID | string | β | WiFi network name |
WIFI_PASSWORD | string | β | WiFi password |
π¬ MQTT Settings
| Define | Type | Required | Description |
|---|---|---|---|
MQTT_BROKER | string | β | MQTT broker IP / hostname |
MQTT_PORT | int | β | MQTT broker port (default 1883) |
MQTT_USERNAME | string | optional | MQTT username (leave empty for anonymous) |
MQTT_PASSWORD | string | optional | MQTT password |
π·οΈ Device Identity
| Define | Type | Required | Description |
|---|---|---|---|
DEVICE_ID | string | β | Unique device identifier (matches the Firestore device doc) |
LAYOUT_ID | string | β | Layout identifier |
TOPIC_ID | string | β | MQTT topic prefix (default "DEJA") |
π¦ Feature Flags & Pin Arrays
ENABLE_PWM / ENABLE_OUTPUTS / ENABLE_SIGNALS / ENABLE_SENSORS / ENABLE_TURNOUTS and the OUTPINS / SIGNALPINS / SENSORPINS / TurnoutPulser definitions all use the same semantics as the deja-arduino config above.
π If you change WiFi or MQTT credentials, you have to re-flash the device β the values are compiled in.
π Pico W β settings.toml
Runtime environment configuration for deja-mqtt. Loaded by CircuitPython at boot.
| Variable | Required | Description |
|---|---|---|
CIRCUITPY_WIFI_SSID | β | πΆ WiFi network name |
CIRCUITPY_WIFI_PASSWORD | β | π WiFi password |
MQTT_BROKER | β | π MQTT broker IP address |
LAYOUT_ID | β | πΊοΈ Your layout ID in DEJA Cloud |
DEVICE_ID | β | π·οΈ Unique device identifier |
TOPIC_ID | No | π‘ MQTT topic prefix (default: "DEJA") |
ENABLE_CONFIG | No | βοΈ Load pin mapping from config.json (default: "true") |
ENABLE_PWM | No | ποΈ Enable PCA9685 servo support (default: "true") |
ENABLE_MQTT | No | π¬ Enable MQTT communication (default: "true") |
π Pico W β config.json
Pin mapping from logical pin numbers to physical CircuitPython GPIO names.
{
"pins": {
"6": "GP6",
"7": "GP7",
"8": "GP8",
"9": "GP9"
}
}
Keys are the logical pin numbers used in commands ("pin": 8). Values are CircuitPython GPIO names ("GP8").
ποΈ Layout-Specific Overrides
Per-layout configs live under:
io/layouts/{layoutId}/deja-pico-w/{deviceId}/config.json
When the deploy script runs, it uses the layout-specific config instead of the default io/src/deja-pico-w/config.json.