Introduction: 13 Note MIDI Laser Harp
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
Step 1: Overview and Generating Laser Strings
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.
Step 2: Detecting When a Note Is Played
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.
Step 3: Generating MIDI Signals
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.
Step 4: Building Laser Harp Frame
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
Step 5: 3D Printing Mounts
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.
Step 6: 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
12 Comments
Question 5 years ago on Step 1
Hi Jon,
would you share the specifics about the amplifier chips you used and how the output of the differential amplifier was connected to the [-, GND, +] inputs on the galvo driver board?
Additionally, the image reads "non-inverting amplifier" while the text says "inverted amplifier" which brings a bit of confusion :)
Many thanks for the inspiration so far!
Piotr
Answer 5 years ago
Hi Piotr,
Thanks for your questions. It has been a long time since I did this project, so I some of the details are fuzzy. After looking through my documents, I think I can answer your questions. Although, I bet there is a more efficient way to do it.
After the non-inverting amplifier (sorry about the mistake in the text), the control voltage for the galvo varies from 0 to 12.5V, because the gain is 2.5 and the output of the R2R DAC ranges from 0 to 5V. This amplifier could be power 15V/GND or +/-15V. The issue is that the control signal from the galvo must range from -10 to 10V for the full range of scan angles. To offset the signal, I used a differential amplifier powered with +/-15V. If the amplifier were powered 15V to GND, then the control signal could not be negative and you would be limited to half the scan range of the galvo.
The non-inverting input to the differential amplifier was 7V, so the output would range from around 5.5 to -7V, not the full range of galvo but good enough for my harp. I'm not sure why I didn't set the non-inverting input to 6.25V so that the output would range from 6.25V to -6.25V. Doesn't matter in the end, because I could align the galvo, even if it wasn't oscillating about its center position at 0V.
I think I used LM741 op amp for both the non-inverting and differential amps. https://www.amazon.com/gp/product/B00CSKFT6A/ref=o...
For the power supply, I used the +/-15V supply that comes with the galvo. I didn't know about DC voltage converters at the time, so I used another 9V power supply for the Arduino.
Hope this helps!
Answer 5 years ago
Oh, many thanks for your reply, Jon! I will be experimenting with the said amps once they're delivered. They seem very versatile and should solve my issues with proper galvo feeding - so thank you very much for your explanation, time devoted and for digging in the depths of your mind and your archives :) Also, for the enlightment about using the +/-15V from the galvo's power supply! So obvious...
One thing bothers me, though. There are three pin inputs in galvos: +, - and GND. I understand that it's enough to connect GND from the differential amp and its output to let's say "+" input pin in galvo. Once it's powered with positive voltage, it should turn in one dirrection, while powered with negative voltage from the amp it should turn the opposite, am I right? The "-" input pin would be irrelevant to the galvo's movements and as such should be connected to GND as well or left unconnected?
Once I finish the project, I will send you some pictures of the thing I built with your instructable as well as your personal help :)
Thank you once again!
Answer 5 years ago
Glad I can help! The driver board of the galvo is connected to the +/-15V power supply. The power supply remains the same to the board. Don't send your control signals to the power pins. A separate pin on the driver board is used for the control signal that is coming from the differential amplifier. The board then sends the appropriate signals to the galvanometer. The attached image shows a galvo driver board that is similar to the one I used.
Excited to see what you create!
Answer 5 years ago
Thank you so much, Jon!
*I WILL NOT* send the control signals to the power pins, promise! :D I was talking about the three pins marked on your image as "-/+5V signal input". On my board, I'd say identical to yours, those pins are marked as "-", "G", "+". While I have ground reference (like for example ground from power supply) which can be connected to the "G" pin, the output from the differential amp will provide me with just a single voltage, varying from, let's say, -8V to +8V, as referenced to the mentioned ground.
So, I was only wondering about where to connect this voltage - to the "+" pin or to the "-" pin of the input. I understand that the only difference would be in inverted operation of the galvo: with voltage connected to the "+" pin, the galvo will be working CW with increasing voltage, and with "-" pin - CCW. If so, do I have to connect the unused pin to the ground or leave it be?
I will try different scenarios with the hope of not burning the board :) Edison would not invent a light bulb if he did not try and fail a hundred times, right? ;)
Thanks a lot for the time devoted to your replies, I feel like I used my limit already :) Take care!
Answer 5 years ago
Sorry for missing your question, now I've got it. I think that I just plugged my control signal to the positive control signal pin and left the negative pin disconnected. I'd start with that and then check the driver manual (if there is one out there) before grounding the negative pin. Even if your differential amp isn't working yet, you can test the galvo is responding to control signal by plugging in a positive dc signal (like 3V from the arduino) to the positive control pin. No troubles for the questions. Glad to help!
7 years ago
Cool!
7 years ago
Jean Michel Jarre will envy you! Good awesome work!
Reply 7 years ago
Haha, the laser harp master. No way!
7 years ago
Looks great
Reply 7 years ago
Thanks for checking it out!
7 years ago
Awesome Laser Harp!