Play table

Using proximity sensors for playing midi tones combined with LED visualization


The aim of this project was to create a table sized device with multiple proximity sensors that can play midi tones. Each sensor had a few LEDs to show hand distance above the table. This table could be used by one or more persons at once.

Hardware setup

First I created a prototype from a cardboard to test sensors and some logic behind. Than I ordered a customized plottered sticker with a design which was painted with bare conductive paint. Afterwards I drilled some holes and connected the touchboard with 7 arduino Nanos. Each arduino was connected to 13 LEDs diodes. At the end I added two potentiometers. One for controlling volume and one for changing notes setup.


Programming consists of two parts. Master(touchboard) program that reads values from proximity sensors and sends messages to slaves(arduinos). Second program for slaves that reads messages from master and toggle LEDs.
Using Arduino IDE for programming was helpful, even more that the touch board has got already built in midi library, so it was quite simple to use it. For communication I created a simple protocol to distribute proximity from master to slaves . There is no delay between real distance and lit up LEDs (baud rare is set to 9600 )

Protocol example:

Lesson learned

My very first idea was to control the volume for each sensor by distance. I tried to use separate midi channels, but it didn't worked. So I have to come up with another solution. I decided to use thresholds for the distances.

During the testing version with cardboard I've had some small issues with touchboard. Sending messages out using TX like in any other arduino didn't work here. Later after reading official docs. I've noticed that this board has two serials. So I have to use Serial1 instead (minor issue but didn't find anything mentioned about it anywhere).

Update 2016-11-20


I've got in touch with Julian who is a musician. After every session of testing we had, he gave me tips for more features or small changes, so he can play something on the table. We've come across few refactoring cycles, some optimalization (the memory limit can be achieved very easily).

New features

Play table provides a USB MIDI output interface. This feature allows us to master the output from the table using a MIDI protocol.

I solved the previous issue that each sensor can use it's own volume by setting a different channel. I've used this feature for two sensor modes which use distance like a trigger to launch single tone or chord.

During testing sessions, we came up with 3 more different sensor modes:

  • chord mode: plays an chord in full sensor range
  • multi chord: toggling multiple chords based on the distance above the sensor
  • arpeggio mode: play tones in tempo that is dynamically changing by the hand distance above the sensor
  • arpeggio auto mode: same as arpeggio mode, but with auto-play after user touches the sensor

Lesson learned

After few sessions the painted sensors were little blurry because the paint would fade away because of touching. I was thinking about adding new thin layer, but transparent spray paint solved this problem for good. The resistance characteristics did not visibly change. So if you are planning to use bare paint you can freely use transparent spray paint to preserve the conductive paint from blurring.



  1. Hello Sir, Can you teach me how the programming code of your arpeggio mode and arpeggio auto mode. thanks

  2. Hi Alasto, thank you for your interest. I'll try to keep it short. It is very simple logic. The arpeggio mode is just repeating notes in loop by tempo that can be changed by distance of your hand. To better understand let's have an example: Remember we are using midi library, so any note can be represented as number. Let's take an array of notes arr[] = {58, 62, 65, 69, 70, 74, 77, 81, 77, 74, 70, 69, 65, 62}; So if I put my hand above the sensor, the distance value will be let's say 100. So we can hear that these notes are playing with changing frequency 1000 milliseconds. Now I'll put my hand closer to the sensor, the distance value will be let's say 50. So the note's tempo are repeating more frequently (with 500 milliseconds frequency). The auto mode is just another option to keep the loop in same frequency without waiving hand above the sensor.

  3. Ok thanks Sir, by the way im have question need to ask again, do the 1 play area where on video above have use 7 play area can use 2 sensor together like touch sensor and distance sensor programing? thanks or just 1 play area just can use 1 sensor between touch or hand distance.hahaha

  4. Yes you can use it as a touch and distance sensor at a same time. There is no difference between them. The value, when your hand is very close is the same when you are touching the sensor.

  5. Good night sir , sorry for asking again, may i know the previous reply " Remember we are using midi library " , May i know which midi library sir have use it for make distance sensor with arpegio mode because in im here have many midi example like " midi_interface_generic , Midi_theremin, and Midi_piano " thanks and sorry to bother


Post a Comment

Popular posts from this blog

YI Dash Car Camera API

Toilet light wall

Working with android contacts