Skip to content

Output Stage Hardware

The output stage sits between the ESP32-S3 microcontroller and the organ’s analog circuits. It converts digital commands into the voltages and switch closures the organ expects.

graph LR
    MIDI["MIDI-In<br/>(USB · BLE · DIN-5)"] --> MCU{ESP32-S3}

    MCU -->|SPI| DAC["DAC ICs<br/>(MCP4728 ×2)"]
    MCU -->|GPIO| DRV["Relay Drivers<br/>(ULN2803)"]
    MCU -->|PWM| MOT["Motor Driver<br/>(TBD)"]

    DAC --> AMP["Op-Amp<br/>Gain Stages"]
    AMP --> CV["Organ CV Nodes<br/>VCO · Filter · LFO"]

    DRV --> RLY["Relay Modules"]
    RLY --> SW["Organ Switches<br/>Leslie · Tabs · Effects"]

    MOT --> LSL["Leslie Motor<br/>(if DC — Scenario B)"]

    style MIDI fill:#065f46,color:#d1fae5,stroke:#10b981
    style MCU fill:#78350f,color:#fef3c7,stroke:#d97706
    style CV fill:#92400e,color:#fef3c7,stroke:#d97706
    style SW fill:#92400e,color:#fef3c7,stroke:#d97706
    style LSL fill:#92400e,color:#fef3c7,stroke:#d97706

The DAC subsystem generates analog voltages for the organ’s continuous-control circuits (VCO pitch, filter cutoff, LFO parameters, expression). Channel count is derived from the Output Inventory continuous targets table.

Primary choice: MCP4728 (4-channel, 12-bit, I2C)

FeatureSpecification
Channels4 per chip (2 chips = 8 channels)
Resolution12-bit (4096 steps)
InterfaceI2C (2-wire, addressable)
Output range0–2.048V (internal VREF) or 0–VDD
Update rate400 kHz I2C → ~50 kHz per channel
EEPROMStores power-on default values

Two MCP4728s on the I2C bus provide 8 DAC channels — enough for all identified continuous targets with room for expansion. Each chip has a unique I2C address (factory-set, changeable via special command).

Alternative: MCP4922 (2-channel, 12-bit, SPI)

Faster update rate than I2C (SPI clock up to 20 MHz), but requires more chips (3–4 for 6–8 channels) and more GPIO for chip-select lines. Better suited if update rate proves critical for pitch tracking.

Each DAC output feeds a non-inverting op-amp gain stage that scales 0–3.3V to the organ’s operating voltage:

Target VoltageGainR1 (kΩ)R2 (kΩ)Op-Amp Supply
0–5V1.52105.1+12V
0–10V3.031020+12V or +15V
0–12V3.641027+15V

Op-amp selection: TL074 (quad JFET op-amp) — one chip handles four channels. Low offset voltage, rail-to-rail not required since the supply rails exceed the output range. Two TL074s cover all 8 DAC channels.

The exact gain for each channel will be set after bench measurement of the target CV node voltage ranges (see Output Inventory investigation queue).

Binary targets (Leslie speed, tab stops, tremolo/vibrato, rhythm) require switch closures. The ESP32’s 3.3V GPIO drives relay coils through Darlington transistor arrays.

FeatureSpecification
Channels8 per chip
Input3.3V–5V logic compatible
OutputOpen-collector, 500 mA per channel
ProtectionInternal flyback diodes for relay coils

The ULN2803 is the standard interface between microcontrollers and relay coils. Each input pin connects directly to an ESP32 GPIO; each output pin drives a relay coil. The internal flyback diodes suppress the inductive voltage spike when a relay de-energizes — no external protection diodes needed.

From the Output Inventory binary targets:

GroupRelaysNotes
Leslie (Off/Slow/Fast)2Two relays encode three states
Orbit III voice tabs10One relay per tab stop
Tremolo1On/off
Vibrato1On/off
Rhythm select2–4Depends on switch matrix investigation
Total16–18

Two ULN2803 chips (16 channels) cover the minimum count. A third chip provides headroom for rhythm selection and future expansion.

Preferred: SRD-05VDC-SL-C (Songle 5V SPDT relay) — ubiquitous, cheap, available on pre-built relay modules with screw terminals for prototyping. Switching capacity: 10A @ 250VAC, far exceeding the organ’s tab stop and signal switching requirements.

For the Leslie motor control (if relay-switched per Scenario A), use a relay rated for the motor’s inrush current — typically 3–5× running current for an AC induction motor.

The ESP32-S3 operates at 3.3V logic. The organ’s circuits use 5V and 12V signals.

DirectionVoltageMethod
ESP32 → ULN28033.3V → relay coilULN2803 handles directly (3.3V input threshold met)
ESP32 → DAC (I2C)3.3VNo shifting needed (MCP4728 operates at 3.3V)
DAC → organ CV0–3.3V → 0–12VOp-amp gain stage (see above)
ESP32 GPIO → motor driver3.3V → driver inputMost motor drivers accept 3.3V logic

The ULN2803’s internal Darlington pairs have a low enough input threshold (~2.5V) to trigger reliably from 3.3V GPIO. No separate level shifter is needed for the relay subsystem.

The Leslie motor interface depends on the investigation results. Three hardware options correspond to the three Leslie scenarios:

ScenarioMotor TypeDriver HardwareESP32 Interface
A (relay)AC inductionRelay module (mains-rated)2× GPIO via ULN2803
B (variable)DCL298N H-bridge or BTS7960PWM output
C (VFD)AC inductionVariable Frequency DriveSerial or analog

Scenario A requires no dedicated motor driver — the same ULN2803 + relay chain used for tab stops handles the Leslie speed relays. The relays must be rated for motor inrush current.

Scenario B adds an H-bridge motor driver (L298N for small motors, BTS7960 for larger ones). The ESP32 generates a PWM signal; the driver converts it to motor voltage. Direction control is not needed (Leslie spins one way).

Scenario C is documented for completeness — a VFD is a separate industrial component that would be specified and installed independently of the ESP32 output stage.

The output stage needs to power DACs, op-amps, relays, and potentially a motor driver. Rather than adding an external supply, the design taps the organ’s existing power rails:

RailSourceUsed By
+5VOrgan’s 5V regulator or ESP32 USBRelay coils, ULN2803 VCC
+12V (or +15V)Organ’s Orbit III power supplyOp-amp supply rails
+3.3VESP32 onboard regulatorDAC ICs, ESP32 GPIO
GNDCommon groundAll subsystems

Phase 1 uses off-the-shelf breakout boards and modules wired to an ESP32-S3 dev board. No custom PCB is needed until the circuit is proven.

ComponentModuleInterfaceApproximate Cost
ESP32-S3ESP32-S3-DevKitC-1$10
DAC (8 ch)MCP4728 breakout × 2I2C$8 × 2
Relay (16 ch)16-channel relay moduleGPIO via ULN2803$12
Op-ampsTL074 on breadboardDAC outputs$2
ResistorsAssorted 1% metal filmGain setting$5
Total~$45

The prototyping phase validates each output channel independently:

  1. DAC → op-amp → voltmeter — confirm voltage scaling for each target range
  2. GPIO → relay → continuity test — confirm relay switching for each tab stop
  3. Connect one channel to the organ — start with the Leslie (most dramatic, easiest to verify by ear)
  4. Add channels incrementally — expression volume, then Orbit III CV, then remaining targets

This incremental approach minimizes risk to the organ’s circuits — each new connection is validated in isolation before moving to the next.