IR sensor to get 1 or 0

I would like to control the following :

when a person move or put his hand over a sensor I need to get 1 value and when the hand is not over the sensor get and zero (0) value and then I will do whatever depending on this 1 or 0.

Can you tell me what kind of sensor to buy? I have IR EMITTER ld271. Is this useful for my purpose?. Can you tell me how to read this data

many thanks

I would suggest a sensor like the TSOP1838 or TSOP4838. The emitter you have will work. What you will need to do is pulse the emitter at 38 kHz and then read the output of the TSOP1838. This will output a 1 if there is nobody there, and a 0 if there is based on light reflected from an object. Of course, the IR emitter and IR detector have to be aligned on the same axis for light to reflect from the emitter, off the object, and back to the detector.

You will have to play with the duty cycle of the 38 kHz output to get the right range. Too high a duty cycle (too much power) and there will be so much light leaking from the IR LED that the TSOP1838 will always be on. Too small a duty cycle (too little power) and of course, there will not be enough IR light to reflect off the object being detected.

We have a demo of this object detection principle working for our Gadget Shield, you can also see a demo video of this principle in action, and also download the source code.

-- The Quick Shield: breakout all 28 pins to quick-connect terminals

Not sure what range you were looking for in your sensor but this is a very easy to use IR sensor that will give you a high/low output depending on if an object is within 10".

I use one of these I got from E-bay, works great.

It is a simple 3 wire interface, ground, +5vdc power, and signal output that is wired to a arduino digital input pin. You enable the arduino internal pull-up resistor to support the open collector type output from the sensor. Reading a digial low value means hand is covering sensor, and reading a high means it's not.


thank you very much.

What I need is the following:

I need to detect: - when a hand pass from left to the right over sensor and - when a hand pass from right to the left over the sensor

How can get this? many thanks

You will need two sensors. If sensor 1 triggers before sensor 2, the hand is moving right to left. If sensor 2 triggers before sensor 1, the hand is moving left to right.

-- The Aussie Shield: breakout all 28 pins to quick-connect terminals

thank you.

But I don't know what sensor to use. can you tell me please?

I would suggest a sensor like the TSOP1838 or TSOP4838.

There are also additional suggestions for sensors from others above. You will have to pick the one that best suits your application, level of comfort, and your budget. They should all work for doing what you need done.

-- Beat707: MIDI drum machine / sequencer / groove-box for Arduino