The kit’s manual included an example circuit for controlling the brightness of an LED by turning a potentiometer knob. So Floyd took that basic concept and added a switch and a MIDI interface to the setup to enable it to control the pitch of musical notes played.
DIY MIDI Door: Fast facts
The project took Floyd one afternoon to complete
Floyd decided to play The Doors on his door… obviously!
This was his first project involving a Raspberry Pi and circuitry
He plans to continue exploring Raspberry Pi’s musical possibilities
An a-door-able idea
After testing the circuit design with a breadboard setup, Floyd glued a potentiometer to the hinge of a door so that opening the latter to different degrees alters its voltage. Read by an ADC connected to a Raspberry Pi, this then determines the note played by a synthesizer whenever the door handle is pushed down to close a circuit.
“A C program on Raspberry Pi reads the values picked up by the converter,” he explains. “These values range between 0 and 256. On a synthesizer, all notes are numbered from 0 (that’s C0, the lowest note) to 127 (G9, the highest note). So, my program just divides the converter’s input by a certain factor and rounds those numbers and sends them [via MIDI] to the synthesizer. Pushing the door handle closes an electrical circuit which makes Raspberry Pi send a ‘note on’ command to the synth, and releasing the handle sends the ‘note off’ command.”
It’s an ingenious use of Raspberry Pi, but not every step of the project was straightforward. For example, Floyd found that he had to spend some time finding the correct factor by which the numbers read by the ADC had to be divided. “Making the [door] movements too small wasn’t an option, because the whole system isn’t very precise. In the end, I defined some value ranges for the three or four notes which are used in the song [Break on Through (to the Other Side) by The Doors].”
In addition, some mechanical issues popped up, such as how to design a lever to turn the potentiometer’s knob, as it had to be very tight so the door movement could be picked up precisely. He settled on a solid metal paper clip, with one end glued to the inner edge of the door and the other end attached to a notch in the potentiometer knob – after finding that it was catching on the door frame, Floyd solved the problem by simply bending the clip with a pair of pliers.
Scores on the doors
Unsurprisingly, viewers of Floyd’s YouTube channel have found the idea to be very innovative. “I think most people thought it was really interesting, but in a weird way,” he says. “The kids loved it for sure. The whole system is suited for slow music (think ambient music, meditation and so on, haha – meditating on a door handle).”
So, could we see some kind of door orchestra in the near future? “While that would make for a spectacular video, I think I’ll use the ultrasonic distance sensor for determining the note’s pitch next, creating a variation of a theremin.”