using a light barrier to trigger max events

kaboo's icon

Hi,
any advises how to connect a light barrier via usb to the computer and get the data to max?
Which hardware do I need?
For sure a light barrier but how do i get the data to max?
Can this be done with an arduino bord? If yes, which one?

For example I would like to start a movie if somebody crosses the light barrier.

Thanks
kaboo

yair reshef's icon

with a webcam you can achieve a simple light barrier trigger.
put a led light across the way from camera > when the webcam stops seeing it someone passed.
you can use jit.3m to detect amount of light.
use jit.submarix to crop the view to only the few pixels the led takes on the sensor.
as always with sensors your environment must be controlled.

Wetterberg's icon

or an arduino with an LED/LDR combo would probably work as well, but the results would be a bit more flakey.

brendan mccloskey's icon

Yes Andreas
I've had varying degrees of success with light sensors: LED, LDR and IR, but the most reliable is, ahem sorry, the Wiimote. LED, LDR and IR are very susceptible to ambient light (eliminating data noise is not an issue though), infra red sensors on a breakout board (collector/emitter bundle) are better, but all three tend to have a limited range c.30cm. Unless anyone has encountered long range light sensors.

So, in my limited experience, either get a cheap Arduino clone and an IR sensor OR get a Wiimote and some candles.

Or perhaps, could one hack together a cheap "laser", with a superbright led and a long thin tube of reflective foil?? Naw.
Brendan

seejayjames's icon

Arduino with a photocell and an actual laser (mounted and steady) would work just fine, it's just the setup that would need to be pretty precise.

Since you're only going to have one data stream from the Arduino, you can probably just use [serial] rather than needing the whole Maxuino setup. That said, you may want to try that out anyway, it might give you more ideas for how to expand the project...

BTW you can buy lasers which can be pulsed via the Arduino, rather than using the pointer-type ones. They're inexpensive and don't need batteries (runs from the Arduino's power source). But of course the best part is pulsing them at all kinds of crazy speeds from your Max patch...!

kaboo's icon

Thanks for all the answers.

As I would like to keep it simple, the light situation will probably not be controllable and I need at least 10m to cover, I think using a camera is not the right way. Also I do not have any experience in programming an arduino.
What I found is this.
http://www.conrad.de/ce/de/product/117536/INFRAROT-LICHTSCHRANKE-50-M-BAUSATZ/SHOP_AREA_17362&promotionareaSearchDetail=005
Its a cheap infrared light barrier with a relay and works for a 50m distance...so they say.
I already did some stuff with switches and relays that I connected to a MIDI Footswitch Controller to trigger different cues in Max with this:
http://www.midisolutions.com/prodf8.htm
worked very well, but somehow I would really like to get rid of that MIDI Stuff.
I hope the light barrier will arrive in the middle of the next week so I can test this setup.

The next thing I thought about is to connect the relay of the light barrier to this USB joystick controller:
http://www.leobodnar.com/products/BU0836X/
Does anybody have this controller and did this or similar things with it?