[Tonights post is by Ed Smith, participant in the Humboldt Microcontrollers Group.]
In this post well go through the Humboldt Makers Groups Humboldt Laser Harp (HLH) in rather more detail than we have previously.
If youre not familiar with the concept of a laser harp YouTube has plenty of videos of different styles, or of course you can keep reading and get familiar that way. This is our harp:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH2muGzciUv0toZ5kK6spNPTQSxDOTlwx4YBle_VMki7WnDksnSBfPc_MnL-YJacR31L4qP9FTukgTPA-DwywPaw2asNRZmbHON8h-arhl0rQ-PKoV1KO_6DKhggFSxVSuRGlEJo2xUAOZ/s1600/HLH-front.jpg)
We opted for a closed-frame harp rather than an open frame, as the closed frame struck us as an easier proposition. It also gives us control over the laser path, rather than letting it head off into the ether. Important for harps that will be played outdoors (as ours is) or near airports / airplane flight paths.
For lasers we opted for super cheap laser pointers from the local dollar store; at a buck per laser this beat mainstream suppliers prices by a huge margin.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7F3ySM7ABuTy89pL5iWs-frJriy0z3kok6J2bFqLVkXLUs67CMeiz90pD74zsE-WAcorS0sRuhyphenhyphencvEVyJX2Dv03Yt8bx0AMlERaJsIN3MiAvKJoa6wTK2j-0jltjZwLey95iPeZ5J_Pr1/s1600/HLH-LaserPackage.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKGHBl9jedpGWsy_88PtEiX_AV0ciPTgagDTH0fJOcT9hyR6NJE8yfQZrBxbeklgsXv7nDpIJqUa1XhNGyBSOi9jvrVTjX_yAnUOKM1tXLy66ct-B7dx04Iftxu2d9jZKyZf52ksdSNJFw/s1600/HLH-LaserCorePCB.jpg)
Those of you familiar with LEDs / laser diodes and button cell batteries may be able to guess what happened next.
We read the battery spec, 1.5v each, and fed the lasers ~4.5v. What we failed to consider was the internal resistance and resulting voltage drop of the button cell batteries.
The lasers looked amazing, for about half an hour.
Then they started to burn out. Oops.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTC_1YY0-dDxknQkLad1pbSWOBxBRUQHpEaxrkw7q5FbW5YCQIqrsK1QUEWeK7mJrvyyPCLKkd-utDBYY5niPENV7Jqw4bY3pTpjKxuQLBlHG7OuUV6c9lUijiqgxd0C2Sd6pggtErnTNA/s1600/HLH-guts-lasers.jpg)
We are debating different methods of laser amperage control for future harp designs.
To hold the Lasers Nick designed and 3D printed some lovely adjustable mounts for them.
The corks hold the top end of a spring, which pushes the mounts against their legs (screws) and against the harp frame. By turning the screws the aim of the laser is easily adjustable. I failed to take a picture of a mount up close, but you can see the general idea.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSfefXUgc5xjvjwny_LPceXeCinZv0ajOltAwEBvpr2fatJcQJZhdo2fSanOhkvmwi9eSwgB-6WDzS-k8xZGgtgrFVT3ah6bGSLnScg2G1LJa8R1BceuVHqvq15Wp2jiwk4uHJ6UhB5A0Q/s1600/HLH-guts-receptors.jpg)
The black heatshrink around the tube helps block out ambient light and results in a stronger signal from the laser. This turned out to be crucial when operating the harp in daylight outdoors.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5uwgJjy4VLGpJNsHbpjT56A_84Bm5BgdHCUjNUyLe16VSflTuRBDdZUU0c7l2guLbGNOSlfTfipr3OgorRvX8Gz0U0frMUZmVjtzra5Fu_Fr9DS4sT9nAvLB5C9CXs1LK2vvk28JwCkt9/s1600/HLH-base-1.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwOQdgjed0knnwT1wu6V9Mwb0SLA5-aY3y3N0MtvvQCUC5_bYDsTPhLVUeN1ZDT6ZmNIrgf5RZIEPPhCLTiNY2sKVpMa_C3Lf4fU6GAuA90mdOBmwKggemtzFfuE7MtRw6vq151ZlLiStI/s1600/HLH-base-2.jpg)
The combination of mild steel base and aluminum body gives the harp a very low center of gravity and makes it quite stable. I was very happy about this when sitting behind it at the recent maker fair, as the road had a fair crown to it and we had the harp on a card cable. If it was inclined to tip it would have been a very nervous time for me!
To finish off the hardware side of the harp, heres a view from the rear.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2c2tug1C00TrD6YzniXvNrnvcG9PbHgfrF89oQLrR-0uwvb0lHmnXNSa2ZPUmqBcMQi_iaEgMVe7M0AmdTmw4HDbU_9d_ZXgI2YMSLjPnaISoHvPT6gtR1_Kyocy4lt-t4aHTQtP3G7iI/s1600/HLH-rear.jpg)
I was in charge of the electronics package for the harp, I used a Texas Instruments Stellaris Launchpad microcontroller board for the brains. The primary reason I chose that board is that it has 12 analog inputs, making the job of reading 12 LDRs much easier. This project could be done with a microcontroller with fewer analog inputs, but you would need to use an external ADC or some comparators to turn the analog voltage from the LDRs into a digital signal.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjUeSxqwqpEN-YBYtUYfJrkaz0ZMubeNdw9gDQoYWBKSx3vyVnsDMBI96Tsq6ubPpu9x4AayVtIlVUuoo7nXw3B2H6P4XJl300wpTLY2zAa2-H90knhWjdEDzbeQOYwt6RAg25hE9HBem9/s1600/HLH-guts-electronicsTop.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhh_j-3eXSD03zkWuryTxajf2ayFbaqD130e3K1Z0dc7cUVAqouM4kUJeU7fHjZFamkrWRHuhWcI7wvPXER3J_U1VWjX-ayRBpjpt6ELq1lGqYXSxAalK3KO6Uu9Nb88BW5bSQIvN6XW8_j/s1600/HLH-guts-electronicsBottom.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjohjG33fEPypS03EAJPRyDDBlaraonBf_q3Q9xSmhdVz91R1MmisMaplQy0Nf_cRfvpu6vBJm1IWl9hHfcppsUTsBweHZN8IAV-_b5rGufYDv1Z7087SoLAYh1VxP4j3IUJOef2F7z6rh6/s1600/HLH-guts-electronicsBottomCloseLarge.jpg)
Having a variable resistor doing the high side of the voltage divider means that we can adjust the sensitivity of the sensors to match the strength (and aim) of the lasers. This is important when some lasers are new and happy and some are half dead! Also included in that circuit is a 0.1µF capacitor to help prevent EMI issues. Whether this is actually needed or not is unknown, but the result worked well so Im leaving them in place.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEWO3oZkVMpDh0Lx2CVFfOdOSYGEAMVOXmQEjSSG6Z8JmE61c0vfPY02baEkCXffXztp1tXJnRt5TTtoR25to3Wq8lvEpEAJS7Umd51PA4NaUgWEC_PrN6G3bNUMJwRTQL_v2gue2Swd4Q/s1600/HLH-guts-electronicsTopInside.jpg)
The other two circuits on the perfboard connect the MIDI output port to the microcontrollers second TTL Serial channel, and connect the +3.3V pin to the lasers via a MOSFET. This gives the microcontroller control over the lasers, a useful feature for automatic calibration.
Lastly, the code. I wrote the firmware for the laser harp in the Energia IDE. Energia is a fork of the Arduino IDE that is aimed at the TI Launchpad series of microcontrollers. Most simple programs can be copied straight across from Arduino to Energia and back, though you do need to change the pin definitions. Energia also has ports of many Arduino libraries, making things even simpler.
Im going to describe the code and then post a link to it on GitHub rather than inserting it in this post.
The code is aimed at being easily adjustable for different numbers of "strings". Its main loop checks the status of one string, if the string status has changed it finds an open MIDI port and sends the Note On or Note Off message to the external MIDI synthesizer. If it has not changed, it does nothing. After that it increments the string counter and goes through the loop again, check the next strings status.
This loop takes between 67 and 1050 microseconds, or 0.067 - 1.05 milliseconds if you prefer. Not very long. The variation in time largely comes from whether it needs to send MIDI messages or not. The code is set to send the entire message before it goes through the next loop, to prevent against buffer overflow. This probably isnt necessary, but I didnt want it crashing in its first public outing!
The Launchpad has two pushbuttons on it. One of them activates a now partially defunct programming mode that allows you to set the MIDI Velocity variable (how hard the "string" is plucked) and the threshold for the analog inputs that defines what is a HIGH and what is a LOW signal from the LDRs. The MIDI Velocity is still in place; the global threshold has been removed in favor of each "string" having its own threshold.
The second button is used to set those thresholds. It first turns off all the lasers and reads the analog voltage from each LDR, then turns all the lasers on and reads the LDR voltages again. The threshold for each string is set to the mid point between the two readings.
This change to the code fixed the majority of the issues we had on the Humboldt Laser Harps first outing.
This change to the code fixed the majority of the issues we had on the Humboldt Laser Harps first outing.
The trimmer resistors still need to be adjusted to give a good voltage range, but once they are adjusted to match the laser you dont have to do it again. Previously, every time the ambient light conditions changed, you had to redo all 12 trimmers, which took long enough that the ambient light conditions had typically changed again by the time I had finished.
You can find the code here: GitHub Code Link.
As we upgrade the Humboldt Laser Harp well make new posts about it here on the blog.
--Ed Smith
**********
0 komentar:
Posting Komentar