image

Laser Harp

Play strings of light, using laser pointers, rangefinders, photocells, and Arduino.

By Stephen Hobley

image

Photograph by Stephen Hobley

A multi-string laser harp is as cool to play as it is to build.

image

Photograph by Jacques De Selliers

One of my most vivid concert memories is seeing Jean Michel Jarre perform in 1986 at the city of Houston’s 150th birthday celebration. He played music by breaking laser beams with his hands. The beams came out of the stage and went off into space, and for a long time I thought it was a fake — I couldn’t understand how this instrument could work without any sensors above. That started me researching and tinkering, and 22 years later, I figured it all out and built my own.

Now I have several versions of the laser harp. The one I perform with uses a powerful laser and a scanning mirror system, designed for professional lighting effects, that splits one beam into multiple beams that can fan out and move dramatically. This article describes a simpler harp I designed more recently, which uses inexpensive laser pointers and doesn’t need the scanner.

The harp works as a MIDI controller, so it doesn’t make sound itself, but generates a stream of MIDI data to drive an audio synthesizer. Each beam strikes a photocell, and when the player’s hand interrupts it, the sensor prompts an Arduino microcontroller to send a MIDI “Note On” message. Additionally, a range sensor reads the position of the hand, which spawns MIDI controller messages that change the sound’s qualities.

First I’ll show how to make a single-beam laser theremin, which changes pitch with the position of your hand. Then we’ll replicate the circuit and reprogram the Arduino to produce a multi-string harp, with each beam corresponding to a different note. The Arduino has 6 analog inputs, so this harp is limited to 6 beams, but at the end of the article I’ll suggest ways to expand it.

MATERIALS

Arduino board I used an Arduino Diecimila, but more recent Arduino versions should work as well. Also consider the breadboard-pluggable Boarduino from Adafruit Technologies (adafruit.com).

Laser pointers (6) any color, but they need to have a decent IR filter to avoid confusing the range sensor. I bought 25 red pointers from eBay, where prices go as low as $1 each. Green is more visible and thus scores a higher coolness factor.

DC power source, switched, 8V–12V, 2–3 amps I used an old 8.5V camcorder charger.

Adjustable voltage regulator Trossen Robotics #P-VR-DE-SWADJ3, trossenrobotics.com

7805 voltage regulator, 5V

LM324 quad op-amp chips (2) RadioShack #276-1711; also available on eBay

Red LEDs (6) I used a 10-LED bar array, Jameco #1553686 (jameco.com).

Resistors, ¼-watt: 220, 1.5k (6), 3.9k (6), 68k, 1M (6)

Capacitors: 0.1μF (3) and 300μF tantalum (6)

Photocell, 100mW (6) Jameco #202403

Sharp GP2D12 or GP2D120 IR range sensors (6) from Trossen Robotics

Tumbled rocks, translucent (6) craft or bead store

Potentiometer, 100k

5-pin DIN (MIDI) connector

Blank circuit boards I used 1 dual mini and 1 medium, RadioShack #276-148 and #276-168.

24-gauge hookup wire various colors

Heat-shrink tubing

8-pin headers (5) (optional)

Aluminum tubes, ½" × 36" (2)

Wood and screws I used ½" fiberboard

Black paint

TOOLS

NOTE: I’ve developed my projects on a PC, so the software tools I use are PC-based, but there are equivalent tools for the Mac and Unix/Linux.

Computer

MIDI utility software to test output. I recommend MIDI-OX (midiox.com).

Software synthesizer I recommend Superwave P8 (home.btconnect.com/christopherg/main.htm).

USB-MIDI interface such as M-Audio Uno

Soldering equipment and solder

Insulated wire various colors

Wire cutters and strippers

Multimeter

Alligator leads (2)

Saw

Drill

Vise and clamps

Stephen Hobley, a photographer by trade, wants to continue tinkering with electronic instruments, but lately his brand-new role as “Dad” seems to take up most of his time.

Build the Pieces

We’ll build the main electronic components first and then put them together. We’ll start with the common power supply, light detector circuit board, and MIDI output jack. Then we’ll add photocells, range sensors, and lasers — 1 of each for the theremin, and 6 of each for the harp.

POWER SUPPLY

I built the power supply on a mini circuit board following the schematic at makezine.com/projects/laser-harp. A 7805 regulator steps down the 8.5V from my camcorder charger to 5V for the range sensors. An adjustable voltage regulator lets you tune the power to the lasers to just above the detection threshold. The Arduino gets 8.5V directly, since it has its own onboard voltage regulator. To suck up any power spikes, I added a 0.1μF “bypass cap” across each of the 3 output voltages: 5V, variable, and 8.5V. These capacitors are optional. Finally, to neaten the connections out, I used two 8-pin headers for the outputs to the lasers and range sensors.

DETECTOR CIRCUITS

The photocells (aka light-dependent resistors or LDRs) are on their own little boards, across from the lasers. But I assembled the rest of the detector circuitry onto the larger circuit board (Figure A). The board needs to have 1 circuit for the theremin, or 6 circuits in parallel for the harp. Each of the two LM324 op-amp chips supports 4 detector circuits, and I went ahead and created 8 circuits, even though the harp only needs 6. The 68K and 100K resistors create a shared reference voltage, so we only need 1 of each. See the schematic online.

image

Photography by Stephen Hobley

Fig. A: The detector board uses 2 quad op-amp chips to support 6 detector circuits (2 op-amps are unused).

MIDI JACK

Wire the MIDI output jack by connecting pin 5 to the TX pin on the Arduino, pin 2 to circuit ground, and pin 4 through a 220Ω resistor to +5V. (MIDI jack pins are numbered 3, 5, 2, 4, 1, from left to right, facing the pins.) The outermost pins, 1 and 3, are not used for MIDI (Figure B).

image

Fig. B: MIDI jack wiring, with signal pin TX from Arduino.

LASERS AND PHOTOCELLS

The lasers connect in parallel to the variable voltage 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.

image

Fig. C: A small piece of perf board holds the photo-detector for easy mounting.

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 by triangulating on the reflection.

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 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

And for the GP2D120:

R = (2914 / (V + 5)) – 1

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/projects/laser-harp to your Arduino. This program lets the Arduino generate test MIDI messages. Set the baud rate of the Arduino to 31250.

2. Connect the MIDI jack to your computer with a USB-MIDI interface. Launch MIDI-OX (or equivalent software) and open that port. You should see Note On and Note Off messages in the MIDI inspector. If not, then test the +5V, ground, and TX pins for connectivity.

If the MIDI test is OK, upload the laser theremin program MAKE_THEREMIN.pde to the Arduino.

3. Take one of your laser pointers apart and measure the battery voltage. Adjust the variable regulator on your power supply board until its output matches this voltage. This lets you run the laser from your power supply board. One neat way to connect it is with alligator clips.

4. Now make the physical frame. I cut a long piece of scrap wood into 3 pieces: to make a base, a laser holder, and a detector holder.

Drill the laser holder piece for the laser to fit through horizontally, and drill a smaller perpendicular hole for a screw to hold down its power button.

5. Drill a hole through the detector holder where the laser will shine, tape the photosensor board to the outside with the sensor facing in, and glue a translucent tumbled rock over the hole in front (Figure D, previous page). The rock diffuses the light, which helps the sensor see it.

image

Fig. D: A tumbled translucent rock spreads laser light over the photodetector.

6. Next, attach the range sensor to the laser. I found that it worked better mounted vertically (Figure E) — when it was horizontal, I think the IR beam was reflecting off the laser pointer’s barrel and causing misreadings. Having a rangefinder too close to a wall can also diminish accuracy.

image

Fig. E: The rangefinder works better when positioned vertically, away from the reflective laser pointer barrel.

7. Connect the photosensor circuit’s output from the op-amp to pin 2 on the Arduino and connect the rangefinder’s output to Analog In 0. Connect your computer back to the MIDI out and run MIDI-OX. Switch everything on (Figure G). Adjust the pot on the detector board so that the LED just comes on. At this point, breaking the laser beam with your hand should switch it off, and MIDI-OX should show you Note On, Note Off, and Pitch Bend messages as you move your hand in the beam.

image

Fig. F: The power supply board, detector board, and Arduino on a wooden base.

image

Fig. G: A 1-string optical theremin with green laser.

That’s it. Swap MIDI-OX for a soft-synth, or plug the MIDI jack into a hardware synthesizer, and you’re playing!

Laser Harp

Now we’ll expand on the theremin idea and create a 6-beam laser harp.

1. Build the frame. I made a wooden base to hold the lasers, rangefinders, and circuitry. Two metal tubes at either end support a top tube, which has 6 holes drilled through its underside to expose the photosensors. Space the lasers at least 4" apart, or else cross-talk between the range sensors can throw off their readings.

2. Wire the other lasers and photosensor/detector/rangefinder loops in parallel with the first ones; see the schematic online. For neatness on the detector board, I used 8-pin headers for the photosensor and Arduino connections.

Also check that the variable regulator can handle the current drawn by the lasers: multiply the lasers’ amperage by 6, and confirm that it’s below the voltage regulator’s rated max current. To make sure, you can also measure the current that comes into the regulator (Figure H).

image

Fig. H: Measuring total current drawn by the harp lasers.

3. Instead of messing with alligator clips, I made connector plugs for the laser pointers. I cut a slot in the back of each with a Dremel tool, made a wood plug to fit into the barrel, and thumbtacked a wire to each end (Figure I). Insert the plug, pass the wires through the slot, and screw on the back. The case contact in back will be ground. To keep the lasers switched on if the screws slip, wrap the barrels with electrical tape.

image

Fig. I: Wooden plug power connection to the laser pointer.

4. Connect the detector outputs from the op-amps to Arduino pins 2–7 and connect the range sensor outputs to the Arduino’s analog input pins 0–5. Adjust the potentiometer until all 6 LEDs come on. You should now be able to turn them off individually by breaking the 6 beams. If ambient light becomes a problem, cut rings of narrow PVC pipe, paint them black, and attach one around each detector. If the lasers just miss the photosensor holes, glue on tumbled rocks as diffusers.

5. Upload the program MAKE_HARP1_CTRL.PDE to the Arduino, and start playing. The software assigns the MIDI note numbers 60, 62, 64, 65, 67, and 69 to the beams, but you can change this by editing the notearray[] structure. The controller messages from the range sensors are sent as note 74. With my synthesizer, this changes the filter sweep and creates a funky, retro synth sound.

You can also try MAKE_HARP1_VEL.PDE, a modified version of the code that maps your hand position to MIDI velocity, to mimic how hard you would strike a key on a keyboard.

Further Development

You’re not limited to just playing notes. Ableton Live software allows you to MIDI-trigger drum loops, sequences, and other musical events. It’s not free, but you can download a demo version at ableton.com.

If you want to go crazy and add more beams, you’ll need to expand the digital and analog inputs of the Arduino using a multiplexer. There are a couple of neat, off-the-shelf ways to do this. I’ll mention two here, and you can find more at the Arduino Playground (playground.arduino.cc).

One approach is to use an analog multiplexer like the R4 AIN MIDIbox module, which is based on the 4051 chip (kit available from AVI Showtech, avishowtech.com). This will support 32 inputs, for 32 harp strings.

With some clever programming, you should be able to bypass the detector board and read the laser harp through the analog multiplexer. To do this, connect the photocell array’s outputs to the multiplexer’s inputs, feed the multiplexed output to the Arduino, and detect which beams are broken in your software.

You can also use a digital multiplexer like the R5 DIN Module, another MIDIbox kit from AVI Showtech, which is based on the 74HC165 chip. With these, you can chain modules together to support an unlimited number of inputs.

If you want to tackle a full-sized scanning laser harp (Figure J), visit my website, stephenhobley.com.

image

Fig. J: Author Stephen Hobley plays his full-sized laser harp.

image For project code, schematics, and further development resources, visit makezine.com/projects/laser-harp.

Acknowledgment: This project is a testament to the collaborative power of the internet. I could not have done it without the help of many people who were good enough to answer the questions I posted on a variety of forums. I’d like to take this opportunity to pass on my gratitude!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset