RADIX16 Laptop Touchpad Matrix MIDI controller
The RADIX16 is a custom MIDI controller I built over the last year.
The controller is fashioned from 16 surplus laptop touchpads arranged in a 4x4 matrix. Each touchpad transmits:
- Note on / note off when tapped
- 0-127 MIDI CC for touch pressure
- 0-127 MIDI CC for X axis position
- 0-127 MIDI CC for Y axis position
For a total of 16 notes and 48 control change values available at the fingertips.
The number of parameters per pad allows for nuanced and expressive control over external synthesizers / effects. A pad can (for example) trigger a drum sample with variable velocity (z-index), filter cutoff (y-index), and pan (x-index) depending on where the pad surface is tapped. Here's a quick video of one of the first post-build tests - testing out the pads on the RADIX connected to a MicroKorg synthesizer:
I built the touchpad modules first, using surplus Synaptics touchpads sourced from PCHub. The touchpads came complete with ribbon cables - I attached the ribbon cables to small PCB adapters I designed and printed at Pad2Pad (see below for the CAD files and parts list). The output side of the adapter is a standard 8 pin header suitable for jumper wire.
Next came the front face panel for the controller. I considered a few designs and ultimately went with a three-piece "sandwich" of one backing panel of delrin (plastic), one middle panel of delrin to hold the touchpads, and one top panel of aluminum to lock everything together. The three panels were designed in Inkscape and sent over to Ponoko for laser cutting. The Ponoko template SVG files are below.
Here is the touchpad "sandwich" with the pads mounted and wired up - the aluminum top panel would be added last:
The last piece of the build was the wood case. The case was constructed in my dad's workshop using scrap maple. We planed, cut, sanded, drilled, and stained it over the course of a weekend. I created and mounted an insert for the rear panel (power connector and switch, USB MIDI out) using a piece of angled aluminum.
I created a custom shield that connects up all the touchpads, the MIDI interface, and external power to the Arduino.
Wiring a Synaptics touchpad to an Arduino is pretty simple. I used this Instructables article as a starting point. Each touchpad needs a dedicated clock and data pin which means 32 of the 54 available on the Mega are in use. I basically repeated that circuit 16 times.
This article describes wiring up a USB MIDI interface to an Arduino for easy MIDI out. I followed the same model.
I will get a schematic of the shield up soon.
The software for this project was challenging.
The PS/2 protocol is well documented, but all of the sample code for doing this on an Arduino assumes only a single pad is connected. As such, the code is synchronous and will block while it waits for the touchpad clock. This means that the performance of the controller degrades proportionately with the number of pads that are connected - the more pads that are connected to the Arduino the greater the length of time between touching a pad and getting a MIDI message. With all 16 pads wired up latency was ~350 milliseconds - about 10 times too high. I had to get this down to a reasonable level.
Ultimately I ended up writing asynchronous PS/2 communication code from scratch. In addition I was able to do a few tricks and hacks (direct pin IO, unrolling loops) to get performance to an acceptable level. The final code is pretty ugly and will be harder to maintain, but latency is now around 50ms. The code is available for download below.
*** UPDATE *** Turns out I was a little pessimistic on my latency measurements. I set up some timers and and recorded an average latency of 32 ms - which is much better but not ideal. I have a few more optimizations to try and get this down further.