D E
FG
Fig. D: A tumbled translucent rock spreads laser light
over the photodetector. Fig. E: The rangefinder works
better when positioned vertically, away from the
reflective laser pointer barrel. Fig. F: The power supply
board, detector board, and Arduino on a wooden base.
Fig. G: A 1-string optical theremin with green laser.
on one side and to ground on the other. I soldered
the photocells to small pieces of perf board for
easier mounting (Figure C). They connect in parallel
to +5V on one side and to the + input pins of the op-amps on the other.
them from their plastic housings. They connect in
parallel to +5V power, ground, and the Arduino’s
analog input pins 0– 5.
The output from the range sensors is nonlinear,
so the software converts output voltage into
centimeters of distance using a simple equation,
courtesy of Acroname Robotics ( acroname.com).
For the GP2D12 sensor:
Range [cm] = (6787 / (Voltage – 3)) – 4
RANGE SENSORS
Anyone who has played with a touchless D-Beam
control on a Roland synthesizer will recognize these
sensors immediately. The GP2D12/GP2D120 range
sensors fire a pulse of IR light and measure distance And for the GP2D120:
by triangulating on the reflection. R = (2914 / (V + 5)) – 1
For musical applications, I’ve found that the
output from these sensors can be noisy, due to the
constantly flashing IR drawing a lot of current every
40ms. You can smooth the output by connecting
a capacitor between voltage (pin 3) and ground
(pin 2); I used some 300μF tantalum caps.
You can also filter the signal with a dedicated filter
circuit (see schematic online), or in the software,
by averaging consecutive readings and using the
average value.
Before connecting the range sensors, I removed
Laser Theremin
Here’s an optical version of a theremin, with 1 laser
beam controlling both Note On/Off and pitch.
1. Download the Arduino programming software
from arduino.cc. Upload the program MAKE_MIDI_
TEST.pde from makezine.com/15/laserharp to
your Arduino. This program lets the Arduino generate test MIDI messages. Set the baud rate of the
Arduino to 31250.
Make: 67