Skip to content

MIDI Conversion Approach

Scan all keyboard contacts and transmit MIDI, optionally coexisting with the original analog sound generation. The organ keeps working as-is — the MIDI encoder taps the key contact bus wires in parallel.

The ESP32-S3 is inherently bidirectional — the same USB, BLE, and DIN-5 interfaces that send MIDI-Out also receive MIDI-In. The reverse path takes incoming MIDI messages and converts them into voltages and switch closures that drive the organ’s analog circuits: spinning the Leslie up to tremolo speed, sweeping the Orbit III’s Wah-Wah filter, selecting voice presets, or injecting pitch CV into the VCO. The Output Inventory catalogs every controllable target, and the Output Stage Hardware describes the DACs, relay drivers, and op-amp gain stages that bridge the ESP32’s 3.3V logic to the organ’s 12V analog world.

The ESP32-S3 handles all three MIDI output formats simultaneously:

  • USB-MIDI — wired, lowest latency
  • BLE-MIDI — wireless, convenient for mobile/tablet DAWs
  • DIN-5 MIDI — classic, universal compatibility

Digital Input Scanning: 74HC165 Shift Registers

Section titled “Digital Input Scanning: 74HC165 Shift Registers”

151 digital inputs (keys + pedals + Orbit III dual contacts) are scanned through 19 daisy-chained 74HC165 parallel-in/serial-out shift registers (8 inputs each, 19 chips = 152 inputs, one spare).

The ESP32 reads the entire chain via SPI at high speed — a full scan of all 151 inputs completes in microseconds.

Two analog channels on the ESP32’s built-in ADC:

  • Expression pedal vertical axis (volume swell)
  • Expression pedal lateral axis (pitch bend)

The approach reads the electrical state of each key contact directly — the same 0-12V square wave signals that drive the organ’s voicing circuits. The shift registers convert these parallel signals into a serial data stream the ESP32 can read as a single SPI transaction.

graph LR
    KEYS["🎹 Key Contacts<br/>151 digital"] --> SR["74HC165 ×19<br/>Shift Registers"]
    SR --> SPI_IN["SPI In"]
    PEDAL["🦶 Expression Pedal<br/>2 analog"] --> ADC["ADC"]

    SPI_IN --> MCU{ESP32-S3}
    ADC --> MCU

    MCU --> USB["USB-MIDI"]
    MCU --> BLE["BLE-MIDI"]
    MCU --> DIN["DIN-5 MIDI"]

    USB --> MCU
    BLE --> MCU
    DIN --> MCU

    MCU --> SPI_OUT["SPI Out"]
    MCU --> GPIO["GPIO"]

    SPI_OUT --> DAC["DAC ICs<br/>(MCP4728 ×2)"]
    DAC --> OPAMP["Op-Amp<br/>Gain Stages"]
    OPAMP --> CV["Organ CV Nodes<br/>VCO · Filter · LFO"]

    GPIO --> DRV["ULN2803<br/>Relay Drivers"]
    DRV --> RLY["Relays"]
    RLY --> SW["Leslie · Tabs<br/>Effects"]

    style KEYS fill:#92400e,color:#fef3c7,stroke:#d97706
    style PEDAL fill:#92400e,color:#fef3c7,stroke:#d97706
    style MCU fill:#78350f,color:#fef3c7,stroke:#d97706
    style USB fill:#065f46,color:#d1fae5,stroke:#10b981
    style BLE fill:#065f46,color:#d1fae5,stroke:#10b981
    style DIN fill:#065f46,color:#d1fae5,stroke:#10b981
    style CV fill:#92400e,color:#fef3c7,stroke:#d97706
    style SW fill:#92400e,color:#fef3c7,stroke:#d97706
InputMIDI ChannelMessages
Upper Manual (Swell)Ch 1Note On/Off
Lower Manual (Great)Ch 2Note On/Off
PedalboardCh 3Note On/Off
Orbit III Contact 1 (note)Ch 4Note On/Off
Orbit III Contact 2 (aftertouch)Ch 4Channel Pressure or CC
Expression Pedal (volume)GlobalCC#11 (Expression)
Expression Pedal (slide)Ch 4Pitch Bend
TargetMIDI ChannelMessages
Leslie speedGlobalCC#80 (Off/Slow/Fast)
Orbit III CV (pitch, filter, LFO)Ch 4Note On, CC#74, CC#76, CC#77
Orbit III voice selectCh 4Program Change 1–10
Expression volumeGlobalCC#11 (Expression)
Tremolo / VibratoGlobalCC#92, CC#77

See the Output Inventory for the complete mapping and the Leslie Control and Orbit III CV Interface pages for detailed rationale behind each assignment.

The MIDI encoder is designed to be non-invasive. The shift registers present high-impedance inputs to the key contact bus — they read the state without loading or altering the signal. The original analog sound generation continues to work exactly as designed.

This means you can play the organ acoustically through its Leslie speaker while simultaneously sending MIDI to a DAW, hardware synth, or any other MIDI device.