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.
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 )
ID_SEPARATOR # ID # VALUE_SEPARATOR # VALUE #.....
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).
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).
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
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.