IR barrier

Hi, I wat to make IR barrier using arduino mega2560.
what I want is in the picture but use IR LED and phototransistor, not PIR:

then IR phototransistor get IR led signal simple LED start to shine.

I use:
5mm 100mA 1,2V 940nm IR LED,
http://lemona.lt/index.php?page=item&i_id=26514
3mm 0,8mA 940nm IR phototransistor,
http://lemona.lt/index.php?page=item&i_id=59638
5mm white LED.

can anyone draw scheme how to do this and write simple code?

before this I try to make the same think using this scheme:

but for some reason it didn't work

You'll likely either need to stick some kind of amplifier on the output of the photo-transistor, or use an uncollimated IR LED laser to light up the area, if you want to stand any kind of chance of getting a signal on the receiving side of things, unless you only want to detect things only a few 10's of centimeters away.

What you might want to do is use an uncollimated IR LED - and modulate it at the frequency (using a 555 timer, perhaps) of an IR remote control detector module; the module will have all the filtering and amplification circuitry in it. Basically, you want to use such a setup if you expect to have this work in an area in daylight or with other IR sources present; the modulation of the output works to filter out the noise (add an IR filter in front of the photo-transistor for more noise filtering, as well).

PIR uses the difference in output of the two sensors and when that difference changes, then movement is 'detected'. Maybe an op amp could help there.

I want to do looks like this:

how they do it? Does not seem very complicated

They do it by having a very small range of detection as was said a few cm

this is what I need. so there I can found schematic of this product?

ammygo:
this is what I need. so there I can found schematic of this product?

The data sheet at the bottom of that page has the schematic in it.

Is there a good reason for using an infra-red receiver? It's messy (you need wires to the receiver) and difficult. There's plenty of solutions which only have a sensor on one side of the passage.

Also, your drawing talks about the people being a "heat source". Is that needed?

fungus:
Is there a good reason for using an infra-red receiver?

It's harder to false.

Ammygo, try this:
http://playground.arduino.cc/Main/PanasonicIrSensor

But only for 1, and you don't have to use that exact sensor. Any IR sensor may do. They can be found cheap, a few for a dollar.

There is even simpler. This can be adapted to make the led bright if shadow is on it instead of dimming when light level drops:
http://playground.arduino.cc//Learning/LEDSensor

It requires 1 led, 1 resistor (I used 220 ohm, not 100) and 2 pins per light.
The 2 pins is the "expensive" part.

GoForSmoke:

fungus:
Is there a good reason for using an infra-red receiver?

It's harder to false.

Really? If you know it's there then all you have to do is avoid blocking the line between transmitter and receiver - very easy to do!

What line?
Passive IR works by direct heat IR detection, active IR works by reflected spread IR light.

You seem to have those mixed up with beam interrupt methods.

Also, avoiding the sensor is NOT falsing. Falsing is what results in false alarms.

ammygo:
before this I try to make the same think using this scheme:

but for some reason it didn't work

Yeah, this thing is only useful for very short distances, like under 1/2" [12mm].
That little cutout indicates you took this image from a photointerruptor datasheet.
See what it says about usable range.

Also, the devices that use IR Leds for illumination and 38-Khz TV remote detectors
for pickup are usually called IRPDs [IR proximity detectors] and their effective range
is usually about 18-24" max.

Besides what the others mentioned, if this only needs to work in the light and the
distances don't need to be too great, one possible thing to try is a simple LDR [light
dependent resistor]. Hook up as a voltage divider, and place a tube around the cell in
order to get some directionality.

Then, you constantly sample the output to track the ambient light levels, and look
only for quick changes in response from ambient, indicative of someone walking on
the field-of-view. Slow ambient lighting changes will be subtracted out.

Another thing to look at is the following, although it's mainly used for fairly short
distances and for tracking movement. The d/s sheet has a schematic.
http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_2150441_-1

It's used in the following robot,
http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_2150580_-1

and there is a tutorial page with code examples,
http://letsmakerobots.com/node/24348

GoForSmoke:
What line?
Passive IR works by direct heat IR detection, active IR works by reflected spread IR light.

Oh, I thought it was a beam.

In that case, put a piece of glass in front of the sensor before you walk past.

If you sit well back from a narrow window and look out through one eye, the light that reaches that eye would all come straight in from what the diagram shows as one of those detecting areas.

Active IR is higher frequency near-IR (body heat is not near-IR) receiving near-IR reflected off objects and detected by a near-IR light sensor (far less cost than PIR) which you can use an aperture (window/hole) to shape the area that the sensor sees through.

Then you would need two and sense only the difference. If the background light level changes the same for both then the difference won't change, tada, a source of false alarms is gone.

IR Leds emit light at 790-880 nm (around .8 um, at the right edge of "visible"
in the picture), while PIR devices pickup heat at around 10,000 nm (10 um).
Human bodies generate heat, but not near-IR or visible light. They only reflect
the latter, meaning it has to come from some other source, like an Led.