13 Note MIDI Laser Harp

by jbumstead in Circuits > Arduino

16821 Views, 199 Favorites, 0 Comments

13 Note MIDI Laser Harp

niceHarp - 1.jpg
Laser Harp 2
Laser Harp 1

The laser harp is an electronic instrument that is played by blocking laser beams. Several laser beams are produced, and a note is played when one of the beams is blocked by the player, similar to plucking a stick on a real harp. The device must therefore produce a laser beam for each note and also have a sensor for determining when a beam is blocked.

I constructed a MIDI laser harp controlled with an Arduino for Spectra, an optics group at Washington University in Saint Louis. This instructable goes over the commercial parts used, design of electronics, mounting parts that were 3D printed, and the frame. This project is also listed on my website with other projects

Overview and Generating Laser Strings

laserHarpSchematic.jpg
harp - 3.jpg
harpStrings.jpg
untitled (5).png

This laser harp has thirteen strings. To generate these strings, a laser beam is moved to thirteen different position (for thirteen different strings/notes) by moving a mirror galvanometer. The mirror galvanometer, or galvo for short, is a mirror that can quickly move to different positions depending on a control voltage that is sent to it. At the end of each laser beam is a photoresistor that is used to detect if a beam is blocked (labeled P0 - P12 in the schematic and shown as black points in the graph). When this is detected, a note is played. I also needed the laser beam to be turned off when moving positions so that it appeared as though there were thirteen distinct positions and not a continuous sheet of light.

Shown here is a schematic of all the electronics used in the project. To generate the signals used to move the galvo, I used an Arduino microcontroller. I needed an analog output that was fast enough to move the galvo (and laser beam) so that it appeared like there were really thirteen different beams and not a single beam being moved to different positions. The analog output of the Arudino is PWM and isn't fast enough, so I constructed a 4-bit R2R digital to analog converter (DAC). The digital output of pins 8-11 of the Arduino incremented thirteen times (for the thirteen positions), and the DAC generated an analog voltage ranging from 0 to 4V. The galvo I bought on ebay had a control voltage of +/-10V, so I had to build amplifiers to adjust signal for that range of voltages. The signal was initially amplified with inverted amplifier (G = 2.5) and ran through a differential amplifier to get an analog voltage from around -7 to 7 volts for the galvo. I didn't utilize the entire range of the galvo due to limited gain from the amplifiers I used.

The laser diode was synchronized with the galvo using TTL pulses generated by the Arduino. It was ON when positioned at a photoresistor, and then turned OFF when moving to the next note.

Detecting When a Note Is Played

harp - 2.jpg
harp - 1 (2).jpg
photoResistors.jpg

The thirteen beams were directed to thirteen different photoresistors (resistors that change resistance depending on how much light hits them). They are labeled as P0 - P13 in the schematic. These photoresistors enable you to convert changes in light to changes in voltage that can be measured. For setting up the photoresistors, here is good tutorial. When the beam is blocked, the resistance of the photoresistor changes because the laser light is no longer hitting the photoresistor. The change in voltage is then sent to the Arduino. Because the Arduino only has 6 analog input channels, I had to use a 4 bit multiplexer controlled by the same four digital signals that controlled the galvo. The output of the multiplexer was then directed to a single analog input channel on the Arduino (see schematic). The photoresistors were covered with old plaster film canister so that the light was diffused when hitting the sensor. This way the laser harp didn't have to be so perfectly aligned.

Generating MIDI Signals

laserHarpSchematic.jpg
IMG_5836.JPG

The Arduino software has a terrific MIDI signal library created by Francois Best, so it wasn't tough to convert the output from the photoresistors to a MIDI signal. The output of the 4 bit multiplexer was connected to one of the analog input channels of the Arduino. The program checks if a beam is being blocked (by checking for a voltage change read by the analog input channel), and then creates the MIDI signal (note and velocity) depending on which beam was detected to be blocked. To fetch the code for creating these signals download the Francois Best MIDI library and check out the link above. You also need to get a MIDI jack and connect it as shown in the schematic. Check here for more info on connecting the jack, but I really suggest the MIDI library I have listed above.

This laser harp is really a MIDI controller (i.e. it does not have its own sound engine). You can select whatever type of MIDI signal you desire. I chose to select middle C to the C one octave higher in frequency. Another MIDI instrument or reader (I used by Macbook Pro and Garageband) must then be used to actually create audio signals that could be played through speakers.

Building Laser Harp Frame

harp - 2 (1).jpg
DSC_0441.JPG
harp - 1 (3).jpg
IMG_5844.JPG
IMG_5843.JPG
IMG_5839.JPG
IMG_5838.JPG
IMG_5837.JPG
IMG_5846.JPG

Because the beams needed to be separated enough so that only one was blocked at a time, I had to design a frame that enabled the beams to travel a long distance. Several mirrors were used to have the beams reflect at two positions as shown in the pictures above. The laser harp turned out being so big that it was designed to be taken apart. The assembly consists of three parts that can be folded with several hinges and held in place with 18 bolts that can be tightened by hand. Shown here are all three parts of the harp.

The electronics were secured in a wooden box with the galvo mounted at the top. The beams travel downward and reflect off the first mirror. This part is then attached using 4x1 wooden beams that slide into place and are bolted. These beams then attach to the part of the frame that directs the beams upward towards the photoresistors. Finally, two beams are attached using foldable hinges that hold up all thirteen photoresistors. A cable consisting of the signals needed for the multiplexer is also connected. Check out the video that is included to see the full assembly of the laser harp

3D Printing Mounts

harp - 1 (1).jpg
3DprintFig.jpg
harp - 1 (2).jpg
harp - 3.jpg

I had to mount several components: laser diode, the Arduino, galvo, mirrors, and photoresistors. Using Autocad, I designed these parts and 3D printed them at work. Here are a few examples of the parts. The most crucial part of building these mounts was ensuring that the laser was well aligned with the galvo. If these parts were not secure and well aligned, then the beams would not hit the photoresistors accurately.

Software

The program for controlling the laser harp was written in Arduino programming environment. You could program the harp to direct the beam to any position at any speed. A laser show? Yes, definitely possible. Controlling the type of MIDI signal created is also possible. Here is some example code to get started:

#include

int TTL_laser = 2; // digital output for laser

int notes[] = {60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72}; // notes to play for midi signal

int sensePin = 5;

double volCut = 100; // cutoff for playing a note if beam is being blocked (1024 max - photoresistor is not blocked)

int pauseOn = 2500;

int pauseOff = 1000;

int pauseMidi = 4000;

int pauseReturnOn = 100;

int pauseReturnOff = 200;

MIDI_CREATE_DEFAULT_INSTANCE();

void setup() { // put your setup code here, to run once: DDRB = 255;

pinMode(TTL_laser, OUTPUT); MIDI.begin(MIDI_CHANNEL_OFF);

}

void loop() { // put your main code here, to run repeatedly: //

/// NOTE #0 PORTB = B00000000;

digitalWrite(TTL_laser, LOW); delayMicroseconds(pauseOff);

digitalWrite(TTL_laser, HIGH); delayMicroseconds(pauseOn);

int valC0 = analogRead(sensePin); // reading from photodiode

if (valC0 < volCut) {

MIDI.sendNoteOn(notes[0], 100, 1); delayMicroseconds(pauseMidi);

// kill note MIDI.sendNoteOff(notes[0], 100, 1);

}

/// NOTE #0 END