# Narrow-beam lenses



## theshao (Mar 8, 2016)

I'm working on a project to build a light harp, using IR distance sensing, a smoke machine and narrow light beams. Currently I create the light beams with generic ajustable-focus LED torches from eBay (like this one). These work fine, I'd estimate the beam spread on max zoom to be around 6 or 8 degrees.
What I'd like to do is replace the torches with more compact fixed-focus lenses and LEDs. As far as I can tell I'll need lenses something like this one but I can't seem to find any information about compatibility with the various CREE models. I'm happy to just order some bits and see what works but I'd also welcome any advice as to what LEDs and lenses are compatible and most suited to this project. In terms of focus I'm aiming for around hand-sized at 1.8m distance; this matches the beam on my distance sensors.
Does anyone know:

If it's possible to buy pre-fabricated LED-and-lens units
What narrow-focus lenses are available that are compatible with CREE LEDs
Which of the CREE range would be best suited for this application.
Thanks in advance for any info/suggestions.

Jim


----------



## evilc66 (Mar 9, 2016)

1. As far as I know, no, other than buying flashlight heads.
2. Depends on how tight you want to go, and how large of an optic you can tollerate. I'll link some examples below.
3. Take your pick. I'm assuming you don't need eye searing brightness, so almost anything can work. I'd say the XP-E range will probably be your best bet from a cost and optic availability standpoint. They will also be easier to work with than the smaller LEDs.

Ledil has a few options for the XP-E:

SEANNA-A 1.2 degree (large 152mm diameter)
CRYSTAL-MINE 3 degree (46.8mm diameter)
IRIS 4 degree (38mm diameter)

Carclo Options:

26.5mm diameter 6 degree

Khatod Options:

35mm diameter 4 degree
50mm diameter 4.3 degree

These are just some examples. There are many more out there.


----------



## theshao (Mar 9, 2016)

That's incredibly helpful, exactly the sort of info I need. Thanks evilc66


----------



## greenlight (Mar 9, 2016)

you could you could always use a simple aspherical lens mounted on a piece of PVC with the LED below, however, you have to make sure that led is lined up perfectly with the lens.


----------



## Steve K (Mar 9, 2016)

just throwing out some other ideas to consider...

- put a mechanical slit a small distance in front of the lens, to narrow the beam further.

- use optics on the photodiode (or whatever the receiver is) to limit the angle that it will be sensing.

- modulate the light and synchronously demodulate at the receiver. This is usually a way to reject other sources of noise (i.e. other light sources) and permit picking up a weaker signal. It could help each receiver ignore light leaking in from its neighbor. This will probably be the least attractive of the options.

- use lasers instead of regular LEDs & optics. The collimation for lasers is generally much better.


----------



## theshao (Mar 10, 2016)

Steve K said:


> just throwing out some other ideas to consider...
> 
> - put a mechanical slit a small distance in front of the lens, to narrow the beam further.
> 
> ...



Couple of good ideas here, thanks  With some of the lenses linked above I don't think beam angle on my LEDs is going to be a problem any more. I do now have other issues though - any amount of smoke that makes the beam visible also triggers my IR distance sensor. Should have been obvious in hindsight - if I can see the beam bouncing off the smoke then my detector can see the IR beam bouncing off the smoke. Just to clarify I have a separate IR beam/receiver that I'm using for the distance; the LED light is just so people can see where the detection beams run.
I've got a few ideas of ways to fix this but need to test some other hardware (and see if it's possible to focus an ultrasonic distance sensor...); I might also look at just using photoresistors and/or camera/kinect-based hand tracking. But that's a different problem entirely; cheers for the led/lens recommendations everyone


----------



## Steve K (Mar 10, 2016)

I took a quick look at the wiki page for laser harps: https://en.wikipedia.org/wiki/Laser_harp

the unframed "harps" do look cool, but I can see where there are a lot of challenges. It does mention the method of time multiplexing the lasers as a way to distinguish each beam, which makes a lot of sense. 

To avoid confusing the reflections from the smoke or other stuff in the air will probably require setting some threshold between the level of reflection from the intended target and that of the background noise (smoke, particles, etc).


----------



## WeLight (Mar 10, 2016)

PM me Jim, think I can help
Cheers
Mark


----------



## theshao (Mar 11, 2016)

Steve K said:


> I took a quick look at the wiki page for laser harps: https://en.wikipedia.org/wiki/Laser_harp
> 
> the unframed "harps" do look cool, but I can see where there are a lot of challenges. It does mention the method of time multiplexing the lasers as a way to distinguish each beam, which makes a lot of sense.
> 
> To avoid confusing the reflections from the smoke or other stuff in the air will probably require setting some threshold between the level of reflection from the intended target and that of the background noise (smoke, particles, etc).



Yes indeedy - multiplexing lasers is out of price range for this particular project but going forward there's some fantastic open-source laser rangefinders for hobbyists coming onto the market that I'll be having a play with. I'm currently using super-budget Sharp IR rangefinders (because that's what I had around from some robotics projects) and there's no scope whatsoever in those for setting detection thresholds or anything like that - there are some more advanced ones available though. Currently testing a whole load of possible approaches to this (ultrasonic distance detection; using lights in white plastic tubing so the smoke's not needed, kinect/camera based detection) but most of those are probably beyond the scope of this forum, although I'll keep the thread updated if people are interested 
[edit] To clarify, I'm using 8 entirely separate light beams and detectors; I may well not even have them all set up together as a harp - for testing/PoC I'm considering only a single beam/note.


----------



## Steve K (Mar 11, 2016)

interesting stuff! 

the whole problem of measuring time of flight of light for short distances and good resolution is significant! I suppose if you throw fast logic or perhaps fast analog at it, it could be done. I've seen laser radars and laser rangefinders in the past and was impressed. Most weren't trying to resolve small variations in distance, though. Have you figured out what sort of resolution is needed? 10mm? 1mm?

One alternative to simply measuring time of flight (i.e. the time it takes for a bunch of photons to leave the emitter, strike a target, and get back to the detector) is to modulate the carrier and look at the phase shift of the received signal as a way to calculate the time of flight, allowing the distance to be determined. This does require modulating the light with a frequency that will have a wavelength that is roughly the distance of the range to be measured. 

For instance, if you are measuring a range of 1 meter, then the wavelength of the modulating signal could be 1 meter (or so), which translates to a modulating frequency of 300MHz (if my math is correct). Hmm... that still seems like a challenge. Using a longer wavelength will still work, although it requires more precision from the phase detector. Modulating with 30MHz seems easier than with 300MHz. 

If I had 6 months to dedicate to it, that could be a fun problem to work on.


----------



## theshao (Mar 14, 2016)

There are a couple of other approaches that don't require the timing precision that time-of-flight needs, and also some clever methods of determining flight time to a high resolution using much slower timing (like 3GHz equivalent precision at 30MHz, can't find the linky now, but I believe it's very loosely analogous to the workings of a vernier caliper...). There are some systems using phase shift (And this rather curious one that uses x-band doppler effects to detect movement but can't determine distance); there's also some I'm definitely going to test that use a 1-dimensional CMOS array offset slightly from the emitter and just do the trigonometry - this is a mathematically easy approach 
I have a few months for this but it's is part of a larger installation and only one of several hobbies so fast and functional's likely to win out over elegant when push comes to shove. At least in theory the Raspberry Pi's perfectly capable of modulating a signal at 300Mhz; people are using them for FM transmission up to 750MHz but honestly I'd rather not delve into that if I can avoid it - in order of preference I'm probably going to use an ultrasonic sensor (getting some good early results focusing the detection using a rubber or foam tube on the emitter or receiver) or run the light up the inside of white plastic tubes. The latter does give me the option of using RGB WS2812b LED strips instead of single lights and making it more interactive - it wouldn't be a light harp in the conventional sense but would still be fun to play I imagine.
The actual installation's going to be at a festival along with a few other interactive music-and-lighs stuff so needs to be pretty robust.

Cheers for all the suggestions Steve, very interesting and a few approaches I hadn't considered


----------



## Steve K (Mar 14, 2016)

I like the option of using a CMOS array and just using trig to calculate distance. If you can actually get the array and the proper optics, that would be the way to go (he says, while crossing his fingers). 

Raspberry Pi's are fast enough to do FM modulation at 750MHz? wow...!! The whole area of software defined radio and that sort of really fast DSP just amazes me. Of course, I'm still amazed at simple analog stuff running at 750MHz too.  That's well beyond my experience.

Sounds like a really neat project. Don't forget to post updates!


----------



## theshao (Mar 22, 2016)

So I got the trig method working, just using a torch beam and the Raspberry Pi camera module. This gets me better than 1cm resolution over a range of 20cm to 1.5m once calibrated, which would work fine for me. The problem with this solution is that it doesn't scale well; I can't easily or reliably track more than one or 2 with each camera and each pi can only have the one camera so my 8-note harp would require at least 4 cameras and 4 raspis. I'm glad I did the testing, I may well have use for the technique in other projects, but it's not going to work for me here. I've also done some testing with a few different ultrasonic modules and I don't think it's going to be possible to get the beam angle to be narrow enough to work well in this application - single notes/beams would be fine but an octave's worth within arm's reach isn't going to happen.
So I've gone for the slightly less ambitious approach; I'll be running the lights inside 40mm white plastic wastewater piping so they'll be visible without smoke and I'm back to using the Sharp GP2Y0A02YK0F infrared distance sensor. I'm currently using WS2812b individually-controllable strips 5050 RGB LEDs (neopixels) because i have loads of those from another project. These give me some interesting possibilities I wouldn't have had doing it any other way, such as just lighting up the section of the tube that matches where the hand is so the lights "chase" the hand so I'm reasonably happy with the trade-off of losing the "beam of light" effect.
I've proved the concept on the technical side and have the bones of the coding done now, so I'm onto building the framework etc; once that's done I'll get some photo/video up.


----------



## Steve K (Mar 23, 2016)

this does seem to be quite a project! Glad that you have some options, albeit somewhat pricey or complex options. 

The Sharp IR sensor seems reasonably priced. The datasheet doesn't give many insight into how it works, but my guess is that it is also based on triangulation. This is used in a lot of point & shoot cameras too, where there is a small array of sensing elements, and the change in distance causes the reflected spot to fall on different elements. 

This suggests that it uses a fairly small beam, which might require some attention to getting it aimed correctly. This should also help avoid any reflections from the next "harp string". 

The datasheet doesn't really say how fast it responds to changing inputs. It does mention an initial signal lag of up to 47ms, and suggests that subsequent lags are smaller, which seems like it would be adequate for tracking hand motion.

Neat project! Please keep us updated!


----------



## theshao (Apr 5, 2016)

The Sharp IR sensors do indeed us trigonometry and a 1-d sensor (I read that it's a PSD of unknown specification; I may dig further if it become important). I was not aware that this method was also used for auto-focus on (some) cameras - I'd always assumed they were detecting "blurriness" in the image but had alwasy been impressed how well it worked if that were the case. Thanks for that info, I'll do some reading and investigate cannibalization opportunities 

Robotics folklore gives a polling frequency of ~40ms for the Sharp sensors - my testing suggests 100ms as an absolute upper limit for my purposes before the sound starts to feel "laggy", and this my vary from person to person. Once I've got it all working I'll probably increase the poll frequency until I start getting odd results, then back off a little.

Beam width and spread is very small, this page has in interesting image showing the beam on a "magic mirror infrared sensor" (Any idea where one can obtain one of these? The one in the image was given away at an expo in the 80s and I can't find them easily available on the internet...).

I have one tube built and working nicely, just waiting on a load of WS2812B RGB strips, IR sensors and i2c analog-digital converters from China to complete the project. Will chuck a video up of the single tube working when I have a few minutes free.


----------



## Steve K (Apr 6, 2016)

back in the days when I was working with IR lasers, I'd seen those IR viewing cards. A quick-ish search on the phrase "IR indicator card" pulls up a few options, such as this one:
http://www.i-fiberoptics.com/tool-detail.php?id=560

I didn't check on the sensitivity, but this would be a handy little gadget.


----------



## theshao (Apr 6, 2016)

Cheers Steve - can't find them for less than around £100 in the UK but that's probably for want of the right search terms - that page gives me a few things to look up


----------



## kron (Apr 18, 2016)

I would recommend their XQE-HI product http://www.cree.com/LED-Components-and-Modules/Products/XLamp/Discrete-Directional/XLamp-XQE-HI

Should give you a very good throw given its high luminance (small DIE)


----------

