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.
Bidirectional MIDI
Section titled “Bidirectional MIDI”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.
Hardware Design
Section titled “Hardware Design”Microcontroller: ESP32-S3
Section titled “Microcontroller: ESP32-S3”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.
Analog Inputs: Expression Pedal
Section titled “Analog Inputs: Expression Pedal”Two analog channels on the ESP32’s built-in ADC:
- Expression pedal vertical axis (volume swell)
- Expression pedal lateral axis (pitch bend)
Scanning Approach
Section titled “Scanning Approach”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
MIDI Channel Assignment
Section titled “MIDI Channel Assignment”| Input | MIDI Channel | Messages |
|---|---|---|
| Upper Manual (Swell) | Ch 1 | Note On/Off |
| Lower Manual (Great) | Ch 2 | Note On/Off |
| Pedalboard | Ch 3 | Note On/Off |
| Orbit III Contact 1 (note) | Ch 4 | Note On/Off |
| Orbit III Contact 2 (aftertouch) | Ch 4 | Channel Pressure or CC |
| Expression Pedal (volume) | Global | CC#11 (Expression) |
| Expression Pedal (slide) | Ch 4 | Pitch Bend |
MIDI-In Channel Assignment
Section titled “MIDI-In Channel Assignment”| Target | MIDI Channel | Messages |
|---|---|---|
| Leslie speed | Global | CC#80 (Off/Slow/Fast) |
| Orbit III CV (pitch, filter, LFO) | Ch 4 | Note On, CC#74, CC#76, CC#77 |
| Orbit III voice select | Ch 4 | Program Change 1–10 |
| Expression volume | Global | CC#11 (Expression) |
| Tremolo / Vibrato | Global | CC#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.
Coexistence with Analog Sound
Section titled “Coexistence with Analog Sound”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.