Play table
Using proximity sensors for playing midi tones combined with LED visualization
Description
The goal of this project was to create a table-sized device equipped with multiple proximity sensors capable of playing MIDI tones. Each sensor is accompanied by LEDs that indicate the distance of the user's hand above the table. This interactive table can be used by one or more people simultaneously.
Hardware Setup
I began with a cardboard prototype to test the sensors and the underlying logic. Afterward, I ordered a custom plottered sticker with a design which was painted with bare conductive paint. I drilled holes and connected the touchboard to seven Arduino Nanos, each controlling 13 LEDs. Additionally, I incorporated two potentiometers: one for volume control and another for changing the note setup.
Programming
- Master Program (Touchboard): Reads values from the proximity sensors and sends messages to the slave Arduinos.
- Slave Programs (Arduinos): Receive messages from the master and toggle LEDs accordingly.
Using the Arduino IDE was quite helpful, especially since the touchboard came with a built-in MIDI library, simplifying MIDI integration. For communication, I created a simple protocol to distribute proximity data from the master to the slaves. The communication is seamless with no noticeable delay between the real distance and the LED responses (baud rate set to 9600).
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 cardboard prototype testing, I encountered issues with the touchboard’s TX functionality. I discovered that the board has two serial ports and needed to use Serial1
instead of the standard Serial
. This minor issue was not well-documented.
Update 2016-11-20
Testing
I collaborated with Julian, a musician, who provided valuable feedback after each testing session. He suggested additional features and adjustments to make the table more playable. We went through several refactoring cycles and optimizations to address memory limitations.
New features
The play table now includes a USB MIDI output interface, enabling external devices to master the output through the MIDI protocol.
I addressed the previous issue of volume control by assigning different MIDI channels to each sensor. This adjustment allowed me to implement various sensor modes, where distance acts as a trigger for different sounds.
During testing, we developed three additional sensor modes:
- Chord Mode: Plays a chord across the entire sensor range.
- Multi-Chord Mode: Toggles between multiple chords based on the distance above the sensor.
- Arpeggio Mode: Plays tones in a tempo that dynamically adjusts with hand distance.
- Arpeggio Auto Mode: Functions similarly to Arpeggio Mode but initiates automatic playback once the sensor is touched.
Hello Sir, Can you teach me how the programming code of your arpeggio mode and arpeggio auto mode. thanks
ReplyDeleteHi 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.
ReplyDeleteOk 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
ReplyDeleteYes 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.
ReplyDeleteGood 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
ReplyDelete