Skip to content

Ground Truth

The 555 has 151 key contacts. Every one of them carries a 0-12V square wave from the TOS divider chain at the note’s own frequency — 27 Hz at the bottom of the pedalboard up through 4 kHz at the top of the upper manual. The first question for any MIDI conversion is how to read them.

Nineteen daisy-chained 74HC165 parallel-in/serial-out shift registers, one SPI transaction, a full scan of all 151 inputs in microseconds. Each register reads eight contacts; 19 chips give 152 inputs with one spare. The ESP32-S3 clocks the chain, compares the result to the previous scan, and sends MIDI Note On or Note Off for any key that changed state. This is the core of the approach and it is deliberately boring. Binary, deterministic, no ambiguity. A key is either pressed or it is not. The shift register tells you which, and it is always right.

This layer is the ground truth — the authoritative record of which keys are down at any given moment. Everything else in the system defers to it.

MIDI is capable of more than on/off. Velocity, aftertouch, continuous key position — these are the dimensions that separate a controller from an instrument. Acoustic pianos achieve velocity by putting two switch contacts under each key, staggered vertically, and measuring the time interval between their closures. Faster keystroke, shorter interval, higher velocity. The mechanism is elegant and it requires two contacts per key.

The 555 has one. A single silver-plated SPST contact per key, bridging the contact rail over perhaps 1-2 mm of travel at the very bottom of the key’s stroke. There is no second contact. There is no velocity data in the switch closure itself.

Giulio Moro’s PhD thesis — “Beyond Key Velocity” (2020, Queen Mary University of London) — investigated exactly this problem on the Hammond organ. The Hammond has nine contacts per key, and Moro showed that the dynamics of their sequential closure carry continuous expressive information: velocity, touch type (pressed versus struck), even a five-state key lifecycle from partial press through post-release. His player studies with professional organists confirmed that a minimum of three virtual contacts per key are needed for perceptually useful expression — below that threshold, the control feels like a switch. The prior art survey covers his findings in detail. But nine contacts per key is a different instrument from one contact per key. The question is whether any of that expressive data can be extracted from the 555’s single-contact action without modifying the original key mechanism.

This is where the 555’s architecture does something unusual. Because the key contacts carry the divider signal — a square wave at the note’s own frequency, always present on the contact rail whether or not the key is pressed — the rail itself becomes an excitation source. As a key descends toward its contact rail, the capacitive coupling between the key mechanism and the rail increases. The amplitude of the coupled signal rises with the inverse of the air gap. The organ is broadcasting per-key position telemetry at known, unique frequencies; the sensing system just has to listen.

Each key in the 555 produces a different frequency from the TOD chain. That means each key’s coupled signal occupies a distinct frequency band — natural frequency-division multiplexing built into the instrument’s architecture. A pickup electrode near a group of contact rails receives a superposition of all nearby keys’ signals, but a bandpass filter tuned to the right frequency can separate them. The CapSense feasibility page explores both approaches — a traditional capacitive overlay that fights the interference, and this AC coupling scheme that embraces it.

The PSoC1 CY8C29466 is what makes the AC coupling approach practical at scale. Its 12 programmable analog blocks can be reconfigured by rewriting a handful of registers — center frequency, gain, topology — and the new configuration takes effect on the next clock edge, under a microsecond. A single bandpass filter chain retunes to 440 Hz, settles, samples, then retunes to 466 Hz, settles, samples, cycling through all the keys assigned to that chip in a time-division scan. Twenty channels at 50-100 microseconds each completes a full sweep in 1-2 ms. The analog block architecture page works through the settling time math and the external mux expansion that brings the chip count down to two or three for the entire instrument.

Those same 0-12V square waves that serve as excitation sources are also interference. The divider-keyer ICs produce steep-edged waveforms with harmonic content extending well into the tens of kilohertz. The long bus wires running under the keybed act as antennas. Direct capacitive coupling between adjacent rails, radiated EMI from the bus wiring, ground loop injection through shared power planes — the sensing electrode lives in a dense electromagnetic environment that it has to see through, not around.

The signal of interest — the change in coupling amplitude as a key descends through a few millimeters of travel — is measured in millivolts. The interference is measured in volts. The bandpass filter knows exactly where to look (each key’s divider frequency is unique and known), but the filter has finite rejection, and the harmonics of adjacent keys’ square waves can land inside the passband of the target. Sim 2 in the SPICE analysis showed that per-key pickup electrodes — one wire per contact rail, not a shared pickup across multiple rails — are what make the frequency separation tractable. Physical isolation compensates for electrical selectivity.

The simulations model the coupling physics and the filter chain, but the simulations are models, not measurements. Whether the signal-to-interference ratio is actually workable is an open question until there is an oscilloscope probe on a real contact rail with a real key moving above it. The bench probing plan includes exactly that experiment: a single insulated pickup wire soldered near one contact rail, AC-coupled into a scope, watching for an amplitude ramp as the key descends. If the ramp is there, the approach lives. If it is not, the entire AC coupling path is dead and we focus on the traditional capacitive overlay.

Here is the insight that resolves the apparent tension between the two sensing approaches: it was never an either/or. The shift registers and the capacitive sensing occupy different layers with different roles.

The 74HC165 chain is Layer 1 — the ground truth. It provides definitive, binary, microsecond-latency note-on/note-off for all 151 keys. This layer works today with well-understood parts and straightforward firmware. If nothing else in the project succeeds, this layer alone produces a fully functional MIDI controller with three transport options (USB, BLE, DIN-5) and correct note data on every keypress.

The CapSense/AC coupling system is Layer 2 — purely additive. It provides velocity, continuous key position, aftertouch, and proximity detection. These are the expressive dimensions that would give the 555 capabilities no organ of its era ever had — velocity sensitivity derived from key trajectory, aftertouch from post-contact pressure, anticipatory triggering from pre-contact proximity. The implementation roadmap places this layer in Phase 3, after the shift register scanning and the MIDI-In reverse path are proven.

If Layer 2 works, the instrument gains expression. If it does not — if the EMI is too dense, if the coupling changes are too small, if the calibration per key is too fragile — Layer 1 still works. The organ still sends every note, every pedal press, every Orbit III mini-key through three MIDI transports with microsecond scan resolution. Nothing is lost.

The shift register wins every disagreement. If the CapSense data says a key is at 60% travel but the shift register says the contact is open, the shift register is right. The contact either bridged the rail or it did not, and the shift register’s reading of that binary state is authoritative. Layer 2 provides context — how fast the key arrived, how hard the player is pressing, whether the finger was approaching before contact — but it does not override Layer 1’s record of what actually happened.

That constraint is what makes the whole layered approach safe to attempt. The ground truth layer carries zero risk. The expression layer carries all the experimental uncertainty. And the boundary between them is a simple rule: when they disagree, the ground truth wins.