Showing posts with label shadow harp. Show all posts
Showing posts with label shadow harp. Show all posts

Tuesday, April 26, 2011

What does the invisible man play? An invisible instrument



To date, we've been calling our instrument a "shadow harp".
While this is accurate - the instrument detects the presence of shadows in order to play notes - we've been undecided about the name for a while. Really, because Peter DeSimone has already created an instrument he calls a shadow harp (albeit one that was abandoned and replaced with his "pocket harp") and although this instrument was inspired by his, it really is a different project (more in-line with his original pin-hole light harp than his final shadow harp solution).

After a bit of debate and a few beers (ok, a few cups of tea) we decided to call our version the "invisible instrument". It's a specific enough name to convey what the instrument does (it's an instrument but the playing surface is invisible) but vague enough to allow for modifications and changes to the design and behaviour in future revisions!

So from now on, any references to a "shadow harp" are purely accidental - we mean, of course, "the invisible instrument".

It's stopped working!

Last night we celebrated (albeit in true nerd style, with a cup of tea and a Bourbon biscuit) after getting our "shadow harp" working properly.
It was possible to trigger 1,2,3 and even 4 different samples in sequence (one after the other) or together (by spreading my hands sideways and covering all four inputs at once). It seemed to be working exactly as designed.

This morning, keen to repeat the successes of last night, I plugged the new instrument into my PC and tried to play a simple tune. Nothing!
The LDR values didn't seem to change. I altered the sensitivity threshold but only saw activity when it was reduced down to 2 instead of 10 as it was last night. This was so sensitive that other inputs were triggering sounds even at the slightest movement near them.

I noticed that the raw input values had increased from around 220 to 252 and reduced very slightly when the end of each tube was covered.
Thinking about how the LDR works (with a variable resistance from 5Mohm down to a few hundred Kohm) it sort of made sense. During the day, natural daylight floods the room, so the "top" resistance is lower, compared to the fixed 1Mohm resistor to ground. At night, when playing the instrument under artifical light, the somewhat dimmer conditions mean the "top" resistor has a higher value - so the ratio between the top and bottom resistors is lower on each input pin. This theory is in line with the input values seen: at night, the input values are noticeably lower than during the day.

The solution? Not sure - my gut reaction is to replace the bottom resistors with linear pots, so that the instrument can be "tuned" to the ambient light conditions.
A simple set-up screen when the instrument is first switched on will allow the user to find the optimum values for the "bottom" resistor before play commences.
Perhaps something like take a reading from each pin in turn, compare to the mid-point (128) value and display it as a bar on the screen. The user then twiddles each pot in turn, until all inputs are set to about half-way. They can then press a button to start playing the instrument, knowing that hand gestures will be correctly sensed and processed as inputs for the device.

[update: I just tried replacing the 1Mohm bottom resistors with lower valued ones (about 330Kohm) and the instrument once again became sensitive enough to play. It seems that allowing the user to change the initial resistance of the bottom resistors (i.e. replace with potentiometers) could be the way to go!]

How the new shadow harp works



Each of the four analogue inputs as a simple voltage divider.
5V is connected to one side of a light-dependent resistor (LDR), which is wired in series with a resistor to ground. The input signal is taken from between the two resistors.

As the user places their hand over the LDR, the resistance falls, causing the ratio between the two resistors to drop. This variable voltage is fed into an analogue pin, converted to a digital value (0-255) by the microcontroller's ADC hardware and compared to the last value read in.

Even when static, analogue input values tend to "drift" - i.e. float around, +/-1 or +/-2 (so a "constant" value of 128 may actually vary between 126 and 130 over time!)
To overcome this, we take a reading from the analogue pin, compare it to the previous value and if the difference is greater than 2, this represents a genuine change in resistance, which we then process.

In fact, depending on light levels, sometimes it is necessary to adjust this value to 4 or 5, to avoid cross-talk as the user places their hand in a position that influences to LDRs, next to each other. By making this threshold value a variable, we can allow the user to set their own "sensitivity" level for playing the instrument.

In indoor lighting, the LDR inputs typically read around 220.
When you place your hand over an input tube, this value drops to around 205.
Sometimes neighbouring LDR values drop when you place your hand over an input - by setting the sensitivity to 8, in this case, only the sensor with a hand above it actually triggers an input signal.

Triggering inputs is quite simple - if an input value is falling compared to its previous value, this represents the presence of a hand above the input.
When the input value is constant, the hand is still present. When the value is rising, this is the user removing their hand away from the input.

Using Oshonsoft's hidterm DLL and an 8-byte USB buffer, we can send the raw input values AND the trigger values (0 or 1) for four inputs at a time:

Monday, April 25, 2011

Simplified shadow harp

After nearly a week of getting nowhere, we're thrilled to announce that we've (finally) got a working, consistently accurate shadow-type harp! It's much simpler than original designs, using only four LDRs (light dependent resistors) and a modified enclosure.



The original pocket- or shadow- harp designs used a pinhole "lens" to detect the position of the player's hand above the instrument. Even the original instrument's designer, Peter DeSimone, said that his original design was plagued with problems and false-triggers. To solve his false-triggering problems, Peter introduced capacitors and used the LDRs to create an oscillating input (counting the time between pulses to detect the presence - or otherwise - of a shadow).

This seemed like a lot of work for us - the problem is the LDR changes resistance continually, even by small amounts. In theory, a simple voltage divider approach should still work, we just need to eliminate the "false reads" caused by fluctuating analogue inputs.

Using a combination of hardware and software limits and sensitivity settings, we've managed to solve the problems associated with the voltage divider approach and by encasing each LDR inside a black tube, we've also managed to get rid of the cross-talk the plagued other designs.


Our LDR tube sleeves were just drinking straws covered in black crepe paper. There were no black straws in our local Morrisons, so we got these 80s style neon ones and covered them!

We're using just four LDRs and we're treating each as an individual input.
This means that we can trigger four different samples - in software we can decide whether a single sample plays or multiple (polyphonic) sounds can be produced.



Obviously four different notes/chords/samples is a bit limiting, so we're working on a dial that lets the player select a "sample set" during playing - in the same way they can change the key or chord/scale type (e.g. set to C major and the notes could be C, E, G, C, twiddle the dial and the notes could become E,G,A,B from the Em pentatonic scale).

The first thing we need to do is check we've enough spare pins for an LCD display, 4 analogue inputs, 4 LED outputs (an addition that might be useful: an indicator to show that an input has been detected) plus a few extra analogue inputs for the pots/dials. On a beefy 18F4550 that would be a doddle - we've a load of 18F2455 chips lying around from previous projects and it'd be nice to squeeze a bit more use out of those!

Check back for schematics and more videos shortly.......

Sunday, April 17, 2011

Pinhole box to focus light beams

Here's the basic idea - to place a row of LDRs (light dependent resistors) in a row, then place the whole lot inside a box. The inside of the box stays darks, and a small pin-hole is placed in the lid. Each LDR can now receive just a little bit of ambient light, but only from a specific direction. By moving your hand around above the hole, each LDR should be affected but only when your hand covers a narrow region above the box.



By doing this, we should be able to map when the user has placed their hand to a specific sound-trigger. I think this is how the pinhole light harp works. We're working on creating a digital trigger device to begin with, then we'll add an ultrasonic range-finder to calculate how high the player's hand is above the instrument (perhaps to increase volume or play different notes).

Light harp for Brighton Fringe Festival 8th May

As part of the Brighton Fringe Festival, BuildBrighton have been invited to take over the Ocean Rooms on Sunday 8th May 2011. We're creating a number of sound- and light- installations for an evening of eletronic music madness.

Of course, the most visually impressive light-to-sound instrument for electroncia is Jean Michel Jarre's Laser Harp. There are quite a few homemade harps around (on Youtube and the like) but even the cheap ones are relatively expensive. The problem is, to get a visible laser beam, you need lots of smoke and something substantially more powerful than a laser pointer off eBay!



I looked into getting a powerful 250mW+ laser and using a galvo to draw the vertical "strings" for the harp - if you look closely on some of the YouTube videos, you can see that this seems to be the current approach as some strings appear to have a bit of flicker (the flicker isn't noticeable when played live, it's just the way digital cameras pick up fast-moving images).

Something like this Light Harp would be very impressive to make too - I love the idea of using some really old retro radio cabinet to house such a cool, futuristic instrument. Using lights instead of lasers also makes it much safer to use in a public space (and encourage the audience to have a go themselves). It plays like a real harp too - with the user "plucking" the light beams to trigger a sound.



The photos and schematics show that a lot of work went into this particular instrument - and the build cost was around $500, a little bit too much for many people to have a got at. In short, it's an amazing instrument, but too expensive and too complicated to try to explain at a single-night event.
What we need is something a little simpler.

Almost all homemade laser harps use some form of LDR (light dependent resistor) and a break-beam sensor to detect when a user has placed their hand over a light source. The laser beam hits an LDR, making the internal resistance low. When a hand breaks the beam, the resistance of the LDR increases and the controller recognises that the user has placed their hand in the beam.
Lasers have a nice, concentrated beam and are relatively easy to work with. LEDs and other diffused light sources are not quite so simple - light can come from a number of sources to strike the LDR, not necessarily from an LED placed over it.

While searching the 'net for "pinhole" lenses (to see if it is possible to narrow a beam from an LED) I came across someone who had a similar idea; only to turn the problem on it's head. Instead of trying to detect reflected (or broken) beams of light, Peter uses a series of light dependent resistors and a pin hole to create "cones" of detection, basically checking for the presence of shadows, as you wave your hand over the instrument.
It's a brilliantly simple but effective idea.



I think it's a project that we should be able to get up and working in a couple of days - and simple enough to create kits for other users to make their own, ready for a "big band ensemble" for the Fringe Festival!