Skip to content

CapSense Feasibility

The shift register approach gives us rock-solid on/off detection for all 151 key contacts — but MIDI is capable of much more. Velocity, continuous key position, aftertouch, even proximity detection before a key is pressed. Acoustic pianos achieve velocity by measuring the time between two switch closures per key. The 555’s single-contact keys don’t offer that luxury directly.

Capacitive sensing could fill the gap. As a finger approaches and depresses a key, the change in capacitance near the contact mechanism provides a continuous analog signal that tracks key motion — not just the binary moment of contact.

We have a pile of Cypress PSoC chips with CapSense hardware:

ChipPackageFlash / RAMCapSense ChannelsKey Characteristics
CY8C20236A16-pin QFN8 KB / 1 KBUp to 10 buttonsDedicated CapSense controller, SmartSense auto-tuning, I2C slave, 1.8–5.5 V
CY8C29466-24SXI28-pin SOIC32 KB / 2 KB~20 via CSD user moduleFull PSoC1 — programmable analog/digital blocks, SPI/UART, 14-bit ADC, 5 V only
CY8C2644328-pin SSOP16 KB / 256 B~20 via CSD user moduleSmaller PSoC1, same architecture as CY8C29466, SPI/UART, 5 V only

What CapSense Would “See” at the Contact Rails

Section titled “What CapSense Would “See” at the Contact Rails”

The 555’s key contacts are not passive switches sitting at ground potential. They carry 0–12 V square waves at the note frequency — 27 Hz at the bottom of the pedalboard up through ~4 kHz at the top of the upper manual, plus harmonics from the TOD divider chain’s fast edges. This is the signal that the shift registers read as simple on/off.

CapSense works by measuring charge and discharge time on a sensing electrode — the CSD method uses a sigma-delta modulator clocked at tens to hundreds of kilohertz. That AC signal on the contact rails is right in the danger zone: audio-frequency square waves couple capacitively into any nearby sensing electrode and directly modulate the charge/discharge measurement. The sensor can’t distinguish “finger approaching” from “divider signal coupling.”

This means you can’t simply stick a CapSense electrode on or near the existing contact rails and expect clean readings while the organ is powered. The sensing electrode needs to be physically isolated from the rail signals, or the measurement approach has to account for (or exploit) those signals.

Two approaches emerge from this constraint — one fights the interference, the other embraces it.

Before diving into the approaches, it’s worth understanding the interference landscape. The divider-keyer ICs produce steep-edged square waves with significant harmonic content. A 440 Hz A4 note doesn’t just produce 440 Hz — the square wave harmonics extend well above the PSoC’s CSD measurement frequency.

The coupling paths include:

  • Direct capacitive coupling between contact rail and sensor electrode (dominant when they’re close)
  • Radiated EMI from the long bus wires running under the keybed acting as antennas
  • Ground loop injection through shared power or ground planes

Mitigation strategies for traditional CapSense (Approach A) include shielded sensor traces with active driven shields (the PSoC’s CMOD/shield pin drives a guard electrode at the same potential as the sensor), isolated PCB layers with a grounded copper pour between sensor and rail, and physical separation — mounting the sensor strip on the opposite side of the key mechanism from the contact rails.

Cypress’s own AN85951 covers shielding and noise immunity in detail. Silicon Labs’ AN447 addresses PCB layout for capacitive sensors in electrically noisy environments.

The proven path. Mount dedicated sensor pads on a thin flexible PCB strip positioned under each key, isolated from the contact rail. Each pad detects the proximity and position of the key above it as the key descends.

A narrow FR4 or polyimide strip runs the length of each manual, with individual copper pads (roughly 8–12 mm square) centered under each key’s travel path. The pads face upward toward the underside of the key, while the contact rails sit to the side or below — maximizing the distance between sensor and interference source. A ground plane on the back side of the strip provides a shield.

The CY8C20236A is the natural fit here. It’s a dedicated CapSense controller with SmartSense auto-tuning and an I2C slave interface — exactly what you’d want for a distributed sensor network. Each chip handles up to 10 sensor pads.

ManualKeysCY8C20236A ChipsI2C Addresses
Upper (Swell)4450x00–0x04
Lower (Great)4450x05–0x09
Pedalboard1320x0A–0x0B
Orbit III2530x0C–0x0E
Total12615

Alternatively, the CY8C29466 handles ~20 channels per chip (8 needed for 151 keys), but requires more firmware effort — the CSD user module needs manual configuration, calibration, and the communication interface (SPI or UART) requires custom protocol design.

The CY8C20236A speaks I2C natively. Fifteen chips on a single I2C bus (at 400 kHz Fast Mode) could report all 151 channels in under 2 ms — well within MIDI’s timing budget. The ESP32-S3 has two I2C controllers, so the sensor bus can run independently from any other I2C peripherals.

graph LR
    subgraph UPPER["Upper Manual"]
        UP1["CY8C20236A<br/>keys 1–10"]
        UP2["CY8C20236A<br/>keys 11–20"]
        UP3["CY8C20236A<br/>keys 21–30"]
        UP4["CY8C20236A<br/>keys 31–40"]
        UP5["CY8C20236A<br/>keys 41–44"]
    end
    subgraph LOWER["Lower Manual"]
        LP1["CY8C20236A<br/>keys 1–10"]
        LP2["CY8C20236A<br/>keys 11–20"]
        LP3["CY8C20236A<br/>keys 21–30"]
        LP4["CY8C20236A<br/>keys 31–40"]
        LP5["CY8C20236A<br/>keys 41–44"]
    end

    UP1 & UP2 & UP3 & UP4 & UP5 --> I2C["I2C Bus<br/>400 kHz"]
    LP1 & LP2 & LP3 & LP4 & LP5 --> I2C

    I2C --> ESP["ESP32-S3"]
    ESP --> MIDI["MIDI Output<br/>USB / BLE / DIN-5"]

    style ESP fill:#78350f,color:#fef3c7,stroke:#d97706
    style MIDI fill:#065f46,color:#d1fae5,stroke:#10b981
    style I2C fill:#1e3a5f,color:#bfdbfe,stroke:#3b82f6

Andrew McPherson’s TouchKeys project (2012, NIME) demonstrated capacitive sensing overlaid on a standard piano keyboard. The sensor strips detect not just key press but lateral finger position and contact area — mapping to vibrato, pitch bend, and timbral control. The Snyderphonics Manta takes the concept further with a 48-sensor hexagonal grid. Both prove the underlying physics works at musical performance speeds.

This is the clever one — and it’s specific to organs with tone divider architecture.

Instead of fighting the 0–12 V square wave on the contact rails, treat it as an excitation signal. As a key descends toward its contact rail, the capacitive coupling between the key mechanism (or a nearby pickup electrode) and the rail increases. The amplitude of the coupled signal rises proportionally to the inverse of the air gap distance. The organ’s own divider output becomes a per-key excitation source at a known, unique frequency.

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 would receive a superposition of all nearby keys’ signals, but simple bandpass filtering (or DFT) can separate them.

graph TD
    DIV["TOD Divider Chain<br/>0–12 V square wave<br/>per note frequency"] --> RAIL["Contact Rail<br/>(existing)"]

    RAIL --> |"capacitive coupling<br/>(varies with key position)"| GAP["Air Gap"]
    GAP --> PICKUP["Pickup Electrode<br/>(thin wire or PCB trace<br/>near contact rail)"]

    PICKUP --> BPF["Bandpass Filter<br/>(tuned to note frequency)"]
    BPF --> ENV["Envelope Detector<br/>(peak amplitude)"]
    ENV --> ADC["PSoC 14-bit ADC<br/>or ESP32 ADC"]
    ADC --> ESP["ESP32-S3<br/>position → MIDI"]

    style DIV fill:#92400e,color:#fef3c7,stroke:#d97706
    style RAIL fill:#92400e,color:#fef3c7,stroke:#d97706
    style GAP fill:#374151,color:#f3f4f6,stroke:#9ca3af
    style PICKUP fill:#1e3a5f,color:#bfdbfe,stroke:#3b82f6
    style BPF fill:#1e3a5f,color:#bfdbfe,stroke:#3b82f6
    style ENV fill:#1e3a5f,color:#bfdbfe,stroke:#3b82f6
    style ADC fill:#78350f,color:#fef3c7,stroke:#d97706
    style ESP fill:#78350f,color:#fef3c7,stroke:#d97706

This idea isn’t entirely new — there’s a thread of AC-coupled keyboard sensing running through keyboard history:

IKOR (1967) built keyboards with AC coupling between emitter pads and PCB tracks. Fixed-capacitance emitters and receivers were separated by an aperture-shielded key that modulated the coupling as it moved. This is the first known AC-coupled keyboard sensing design — the key literally acts as a variable capacitor in the signal path. Source: telcontar.net

Pye Electro-Devices (1960s) designed an operator console that detected finger touch via 1 pF capacitive coupling to a 100 kHz oscillator signal — demonstrating that sub-picofarad coupling changes are measurable with period-appropriate electronics. Source: telcontar.net

Giulio Moro’s PhD thesis (2020)“Beyond Key Velocity: Continuous Sensing for Expressive Control on the Hammond Organ and Digital Keyboards” (Queen Mary University of London) — directly investigates the Hammond organ’s 9-contact-per-key action and shows that contact-closure dynamics carry continuous expressive information. The rate at which the contacts close (velocity) creates frequency-dependent transients that can be measured and mapped to MIDI expression. This is the closest published research to what we’re proposing. Source: instrumentslab.org

Hammond organ key-click — the sequential closure of 9 contacts during a single key press creates frequency-dependent transients that vary with keystroke velocity. Players learned to control the “click” expressively. The underlying physics is the same: the divider signal couples differently at different points in the key’s travel.

Moro’s work on the Hammond C-3 provides hard numbers that inform our approach. A few key findings from the thesis (which we have a local copy of):

Contact dynamics are velocity-dependent. Using optical reflectance IR sensors (Omron EE-SY1200) sampled at 44.1 kHz alongside the digital state of all 9 contacts, Moro showed that the contact bounce duration, the closing time offset between the first and last contact, and the presence of “late bounces” all correlate with both the speed and the type of touch (pressed vs. struck). Two key presses at the same average velocity produce measurably different contact patterns depending on whether the finger was already moving when it engaged the key (struck) or started from rest on the key surface (pressed).

The contact-closing region is narrow. On the Hammond, 95% of contacts close within a ~3.5 mm window of key travel (out of an 11 mm total throw). The 555’s single SPST contact per key has an even narrower engagement zone — the silver-plated plunger bridges the rails over perhaps 1–2 mm of travel. This means any continuous sensing approach needs high resolution in that critical region.

Contact bounce has a characteristic frequency. Individual contact bounces oscillate with a period of roughly 200 μs (~5 kHz), alternating between open and closed states. Early bounces last less than 5 ms; late bounces (triggered by the key rebounding off the keybed) can appear 3+ ms later and extend the overall transient. On the 555, we’d see a similar phenomenon — the silver contact plunger bouncing against the rail — but with a single contact rather than nine overlapping ones.

Optical reflectance sensing works. Moro’s platform uses McPherson’s keyboard scanner — infrared LED/phototransistor pairs (QRE1113) mounted at the back of the keys, sampling at 1 kHz per key. The sensor’s response follows an inverse-square relationship with distance, requiring a nonlinear calibration (three paired measurements per key). The achieved action-to-sound latency: 3.33 ms mean, < 5 ms worst case — well under the 10 ms threshold Wessel and Wright (2002) recommend for responsive instruments.

A velocity-based controller is insufficient. Moro’s listening tests confirmed that participants could reliably distinguish between pressed and struck touches on the Hammond — the contact-closure dynamics carry perceptually significant information beyond simple velocity. This reinforces the value of continuous sensing: even if we can only extract velocity from the 555’s single contacts, the shape of the key trajectory matters.

What Moro Built and Tested (Chapters 4–5)

Section titled “What Moro Built and Tested (Chapters 4–5)”

Chapters 4 and 5 of the thesis move from measurement to implementation — Moro builds a complete expressive Hammond emulator and validates it with professional players.

The Bela platform. The sensing hardware uses IR optical reflectance sensors (Omron EE-SY1200) sampling key position at 1 kHz, connected to a Bela embedded audio computer achieving < 100 μs round-trip audio latency. The software side is a modified setBFree — an open-source Hammond B-3 emulator — patched to accept continuous key position as input instead of simple MIDI note-on/off. This is the platform that established our design targets.

Virtual contact emulation. Rather than hardcoding the 9 contacts of a physical Hammond, Moro creates programmable virtual contacts placed at configurable positions along the key travel. This lets the system emulate anything from a single-contact instrument (like the 555) to the full 9-contact Hammond action. A player study with 10 professional organists compared:

  • C1 — single contact (equivalent to the 555’s current SPST action)
  • C3 — three virtual contacts, evenly spaced
  • C4 — three virtual contacts, compressed toward the bottom of key travel

During free exploration, players developed strong preferences for multi-contact configurations — the timbral variation from sequential contact closure was immediately perceived as more expressive. During structured performance with backing tracks, the differences were harder to detect, suggesting that free exploration better reveals the instrument’s expressive range. The threshold finding: minimum 3 virtual contacts are needed for perceptually useful expression.

Key state machine. Chapter 5 formalizes the key’s lifecycle into five states:

StateDescriptionMIDI Analog
Partial PressKey moving, no contacts closedProximity / anticipatory trigger
Press in ProgressContacts closing sequentiallyVelocity calculation window
Key DownAll contacts closed, key at restNote sustained
ReleaseContacts openingNote Off trigger
Post-ReleaseKey returning to rest positionDamping / release velocity

This state machine maps directly to our ESP32 firmware design — the shift register provides the binary contact state, while the CapSense/AC coupling layer provides the continuous position that determines which state the key is in and how fast it’s transitioning.

Percussiveness vs. velocity. Peak velocity during the early ballistic collision phase — the moment the finger first strikes the key — is distinct from the average velocity over the full key travel. The Hammond’s characteristic key click is driven by this peak, not the average. For the 555’s MIDI conversion, the position derivative should extract peak early-phase velocity specifically, using the first ~2 mm of key travel after initial acceleration exceeds a threshold.

Aftertouch from over-travel. On the Hammond, roughly 1 mm of key travel remains after the final contact closes. Moro maps this post-contact displacement to continuous aftertouch, with a dynamic dead zone normalized per-key (since mechanical tolerances vary). A second player study (6 professional organists) found: continuous key position was discovered spontaneously within 0–9 minutes of exploration, aftertouch was rarely discovered without prompting, and percussiveness control was found by only 1 of 6 players initially. Between-session learning significantly improved confidence, suggesting these controls reward familiarity.

Several properties of the Wurlitzer 555’s architecture make this approach particularly attractive:

  1. The excitation signal already exists — the TOD chain provides a continuous square wave at every note frequency, present on the contact rail whether or not the key is pressed. No additional signal injection needed.

  2. Each key has a unique frequency — natural multiplexing. A single pickup electrode near a group of rails could detect multiple keys simultaneously via frequency analysis.

  3. The PSoC1’s analog blocks are built for this — the CY8C29466’s programmable analog blocks can implement bandpass filters and envelope detectors in hardware. Its 14-bit ADC provides sufficient dynamic range to resolve the small coupling changes.

  4. No custom sensor PCB required — a pickup wire or thin PCB trace routed near the existing contact rail is the only new hardware. Compare this to Approach A’s 151-pad sensor strip.

  5. The coupling is inherently proportional — capacitive coupling between a rail and pickup electrode follows a roughly 1/d relationship (inverse distance), providing a smooth continuous signal as the key descends.

The CY8C20236A’s CSD hardware is designed to measure capacitance, not AC signal amplitude. But its sigma-delta modulator is fundamentally a charge integrator — if the charge injected from the coupled AC signal modulates the integration, the raw CSD counts would reflect the coupling amplitude. This is speculative and would need bench testing, but the hardware might work as an AC amplitude detector without firmware modification of the measurement loop.

The CY8C29466 is the safer bet for Approach B — its programmable analog blocks and 14-bit ADC can straightforwardly implement bandpass → envelope → sample.

Either approach (or a combination) opens up expressive dimensions that on/off contacts can’t provide:

CapabilityMechanismMIDI Mapping
VelocityRate of capacitance/coupling change during key descentNote On velocity (0–127)
Continuous positionAbsolute key depth proportional to coupling amplitudeCC (key-specific or zone)
Anticipatory triggeringDetect key approaching before mechanical contactNote On with pre-trigger timing
AftertouchPost-contact pressure changes coupling geometry slightlyChannel Pressure or Poly Aftertouch
Proximity detectionHand hovering above keys changes ambient couplingCC for zone-based expression
Per-key frequency taggingNatural multiplexing from TOD architecture (Approach B)Simplifies signal routing

The critical design principle: the CapSense/AC coupling layer is purely additive. The 74HC165 shift register chain remains the primary key detection system. If the capacitive sensing turns out to be too noisy, too expensive to calibrate, or not worth the added complexity — nothing is lost.

graph TD
    KEYS["Key Contacts<br/>151 digital"] --> SR["74HC165 x19<br/>Shift Registers"]
    SR --> |"SPI"| ESP{ESP32-S3}

    KEYS --> |"capacitive coupling<br/>or sensor overlay"| CAP["CapSense / AC Coupling<br/>PSoC Chips"]
    CAP --> |"I2C or SPI"| ESP

    PEDAL["Expression Pedal<br/>2 analog"] --> |"ADC"| ESP

    ESP --> |"Layer 1: note on/off"| MIDI["MIDI Output<br/>USB / BLE / DIN-5"]
    ESP --> |"Layer 2: velocity, position,<br/>aftertouch, proximity"| MIDI

    style KEYS fill:#92400e,color:#fef3c7,stroke:#d97706
    style SR fill:#1e3a5f,color:#bfdbfe,stroke:#3b82f6
    style CAP fill:#164e63,color:#cffafe,stroke:#06b6d4
    style ESP fill:#78350f,color:#fef3c7,stroke:#d97706
    style PEDAL fill:#92400e,color:#fef3c7,stroke:#d97706
    style MIDI fill:#065f46,color:#d1fae5,stroke:#10b981

The ESP32-S3 fuses both data streams: shift registers provide the definitive note-on/note-off events, while the CapSense or AC coupling layer provides the continuous expression data that MIDI velocity, aftertouch, and CC messages carry. If a CapSense reading disagrees with the shift register, the shift register wins — it’s the ground truth.

  1. AC coupling bench test (simplest — no custom PCB needed)

    Solder a single insulated pickup wire near one contact rail on the lower manual. Connect to an oscilloscope probe (high-Z, AC coupled). Power the organ and press the corresponding key slowly. Observe whether the coupled signal amplitude changes measurably as the key descends toward the rail. If a clean amplitude ramp is visible: connect the pickup to a CY8C29466 ADC input and log readings versus key position.

  2. CapSense baseline test (needs a small sensor PCB)

    Build a single-octave (12-key) test strip with CY8C20236A or CY8C29466. Mount it under one octave of the lower manual. Test with the organ powered OFF to establish the baseline noise floor and verify that finger/key proximity produces clean capacitance changes. Then power the organ ON and quantify the EMI impact. Add shielding (ground plane, driven shield) and measure the improvement.

  3. Integration prototype

    Whichever approach (or combination) proves viable, integrate a single-octave prototype with the ESP32 shift register chain. Map CapSense/coupling data to MIDI velocity on Note On events and to CC messages for continuous position. Evaluate latency, resolution, and noise in a real playing scenario.

  4. Per-key calibration (from Moro’s workflow)

    Each key’s sensor response is nonlinear and mechanically unique. Moro’s three-point calibration: measure sensor reading at fully up, half-press, and fully down positions for each key, then fit a linearization curve. Store the per-key coefficients in ESP32 flash (NVS partition). This calibration must hit the design targets: ≥ 1 kHz scan rate sustained during calibrated reads, < 5 ms total action-to-MIDI latency including the linearization lookup. Recalibration should be triggerable via a maintenance mode (e.g., holding a key combination on power-up).

  • Andrew McPherson — TouchKeys (2012, NIME) — Capacitive sensor overlays for continuous key position and lateral touch. nime.org
  • Snyderphonics Manta — 48-sensor hexagonal capacitive controller for continuous pitch, pressure, and position. snyderphonics.com
  • IKOR AC-coupled keyboards (1967) — First known AC-coupled keyboard sensing using emitter/receiver pad coupling modulated by key position. telcontar.net
  • Pye Electro-Devices (1960s) — Finger-touch detection via 1 pF coupling to 100 kHz oscillator. telcontar.net
  • Giulio Moro — PhD thesis (2020)“Beyond Key Velocity: Continuous Sensing for Expressive Control on the Hammond Organ and Digital Keyboards”, Queen Mary University of London. instrumentslab.orglocal copy
  • Moro, McPherson, Sandler (2017) — “Dynamic temporal behaviour of the keyboard action on the Hammond organ and its perceptual significance”, Journal of the Acoustical Society of America, 142(5):2808–2822. The journal paper covering the contact bounce measurements and listening test from Chapter 3 of the thesis.
  • Andrew McPherson (2013) — Portable keyboard scanner using infrared reflectance sensors (QRE1113) at 1 kHz sampling. Used by Moro as the sensing platform for the hybrid Hammond emulator.

  • QRS PNOScan — Commercially available piano retrofit using optical reflectance sensors under the keybed. qrsmusic.com

  • Moog Pianobar — Portable infrared reflectance device for grand pianos. Senses white keys by reflected IR, black keys by optical interruption. Originally output only Note On/Off; McPherson modified one for continuous key angle output.

  • Bösendorfer CEUS — Premium reproducing piano with continuous key position tracking via optical reflectance sensors at 500 Hz. The first commercially available instrument with continuous key position output.

  • Moro — Chapters 4–5 (2020) — Bela platform with IR optical sensors (Omron EE-SY1200), 1 kHz key position sampling, < 100 μs round-trip latency. Modified setBFree open-source Hammond emulator accepting continuous position input. Player study with 10 professional organists comparing single-contact vs. 3-contact virtual configurations.

  • Moro — Chapter 5: Key state machine and percussiveness (2020) — Five-state key model (Partial Press → Press in Progress → Key Down → Release → Post-Release), peak early-phase velocity metric for percussiveness, flute physical model for continuous-position timbral response, player study with 6 professional organists evaluating continuous position and aftertouch.

  • Moro — Chapter 6: Conclusion (2020) — “A velocity-based controller is insufficient to capture the nuances of the keyboard’s action.” Advocates for continuous key position as the minimum viable expressive input.

  • AN85951 — PSoC 4 and PSoC 6 MCU CapSense Design Guide. Covers shielding, noise immunity, PCB layout, and SmartSense auto-tuning. infineon.com
  • AN92239 — Proximity Sensing with CapSense. Extends CSD measurement to longer-range detection. infineon.com
  • Silicon Labs AN447 — PCB design guidelines for capacitive sensors in electrically noisy environments.
  • CY8C20xx6A — CapSense controller family datasheet. infineon.com
  • CY8C29466-24SXI — PSoC1 family datasheet. infineon.com