Introduction: Theremin W/Zapper,laser,Arduino
I created this Theremin like device after seeing this article in Make magazine: http://m-cdn.dashdigital.com/make/vol15/?pg=69#pg67
While this looked pretty straight forward it turned out to be a bit much for me at the time. But after much effort, I got it to work pretty good.
I had trouble getting the laser to aim correctly so I chose to mod a zapper I had available to hold the laser. This worked well.
So I will recap the steps:
Step 1: Video of Finished and Working
Here I am randomly choosing different styles .
I expect it would work nicely with any other midi player.
Step 2: Get Stuff
Parts that are needed:
Basically I used the parts list that is on the first page of the Make Magazine article. But that list is for the harp which has 6 lasers so most quantites can be just 1..
1. Arduino - I used a Diecimila
2. Inexpensive laser pointer - I got a red one from eBay for a couple of dollars
I was hoping to be able to see the laser but have learned that red will not show up unless it is quite powerful.
So it might be better to have a green laser instead of red.
3. Power Source - I used an AC adapter that I had . It outputs 12Volts and 1.7 Amps.
4. Adjustable voltage regulator - used the Trossen #P-VR-DE-SWADJ
5. 5V - 7805 voltage Regulator - I got from Jameco - pn 51262
6. LM324 quad op-amp chip - Jameco - 23683
7. Red LED - I had - can get from Radio Shack
9. Resistors - 220 ohm
- 68 K
10. Photocell - 100mw - jameco - 202403
11. IR range sensor - Trossen - GP2D12
12. tumbled rock - Hobby Lobby
13. potentiometer - 100k - jameco - pn29103
14. 5 pin DIN MIDI connector - jameco pn 15844
15. circuit boards - radio shack
Also a midi cable to connect the Theremin to a MIDI device eg a computer running software that can interpret MIDI input. I got one from eBay for about 10.00.
Step 3: Schematics
The Make article refers you to this link http://makezine.com/15/laserharp/ . You can then download a zip file with schematics. I have photoed them and attached here.
As I am new to this I had to do a lot of head scratching and trial and error to get things working . But I believe i learned a lot.
Step 4: Building It - Power Supply
I did bread board this but I did not take pictures at that time .
To make it simpler for me to understand, I separated the major parts onto separate circuit boards.
It seemed to make it easier to follow the flow of the schematics, at least for me.
The Power Supply:
8.5V goes directly to the Arduino to power the Arduino.
8.5 V goes directly to the Trossen adjustable voltage regulator. After the rest of the wiring is done, you adjust the regulator to output just enough voltage to turn the laser on.
8.5V goes to the LM7805 which outputs 5v to go to the Sharp sensor
Step 5: Build It - Detector Circuits
The article has a good description of how this is done.
5V from the 7805 goes to the LDR.
The output from the LDR becomes input to the LM324.
When the beam is broken, no voltage will go to the LM324.
The output from the LM324 goes to digital pin 2 on the arduino.
The potentiometer is used adjust the voltage to the LDR. Adjust to the point where the LED just comes on.
Of course , refer to the schematic for the complete circuit.
A data sheet for the LM324 can be found here; http://www.datasheetcatalog.org/datasheet2/9/0oa8seftq8d6peigox0lrx6e9wwy.pdf
Step 6: Build It - Midi Jack
Follow the article instructions:
Green to TX pin on Arduino
Black to ground
Red from 5v - thru a 220 ohm resistor
Step 7: Build It - Laser
After trying and failing to hack a cheap red laser and mount in a similar way as shown in the article, I decided to just hot glue the laser into the body of a zapper gun. This turned out to be much easier .
Simply open the gun and take everything out.
I took a cheap red laser and after using a dremel to open the case, I had just the laser to work with. I soldiered a small wire across the button terminals as the button will not be used. The power for the laser will come from the Variable voltage regulator when the theremin is turned on.
The black wire is to ground and the red wire is from the voltage regulator.
Step 8: Build It - Range Sensor
These are installed under the zapper.
The black wire goes to ground
The yellow goes to analog pin 0 on the Arduino
The Red is 5 volts .
Step 9: Build It - the Code
The original code can be found at this site :http://makezine.com/15/laserharp/
Step 10: Test It With Midi-OX
Once everything is connected and turned on, you will see Note On , Note off and Pitch Bend messages.
Step 11: Additional Items
1. I built a box out of scrap wood that I had. The range on the sensor is 30 inches but my frame is only about 16 inches. I think I would have made it a bit longer and I would have tried a green laser.
The sketch has a line; #define SENSORSCALE 70.0. This number can be adjusted to get better response from the sensors. I did change it to 40.
As I understand it(and I may be wrong) but when the laser is not broken, the Arduino gets a "note off" signal and a "note on"when the laser is broken. When the Arduino gets the "note on" , it will also get the distance from the Sensors to your hand. This distance will be interpreted into a pitch value. Then a midi stream is sent out .
A Google search found this site which explains the midi structure. http://tonalsoft.com/pub/pitch-bend/pitch.2005-08-31.17-00.aspx
This was a difficult project for me as I am new to Arduino and electronics in general but it seems to work and I learned a lot.