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.
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).
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?
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.
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.