Pages: [1]   Go Down
Author Topic: IR sensor to get 1 or 0  (Read 1228 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 of this principle in action, and also download the source code.

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

Offline Offline
Newbie
*
Karma: 1
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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". http://www.acroname.com/robotics/parts/R49-IR15.html
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

http://cgi.ebay.com/Arduino-Infrared-Reflectance-Sensor-Sensor-Shield-/160522462663?pt=LH_DefaultDomain_0&hash=item255fe265c7

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.

Lefty
« Last Edit: April 03, 2011, 03:35:56 pm by retrolefty » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you.

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

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: