Vous êtes sur la page 1sur 5

Simple Infrared Barrier http://dev.emcelettronica.


Your Electronics Open Source

Home > Blog > brumbarchris's blog > Simple Infrared Barrier

Simple Infrared Barrier

By brumbarchris
Created 01/19/2009 - 07:42

Technology infrared communication ir ir barrier simple infrared barrier

A while back, when I was just discovering the IR technology, I set myself on doing a small project meant to confirm my knowledge in this area. Although
a remote control is not so difficult to design and build, there is an even simpler option: the IR barrier. This consists of a constant IR signal permanently
going from an emitter to a receiver, both of them being in two different places (a few meters apart). When an obstacle comes in between the emitter and
the receiver, the IR signal is blocked and the receiver senses that it is missing, flagging the event in an appropriate manner.

The principle of operation is simple enough, and with most components taken off the shelf, it is easy to design the schematic.
The IR element in the emitter is a simple IR LED. This behaves absolutely like any other LED, with the sole exception that it emits light in the infrared
spectrum. The emitted light is thus invisible to human eye, but it is meant to excite the infrared receiving element on the other side of the barrier. One
important element of this LED is the wavelength of the emitted light, of which we already know that is in the infrared spectrum.
The infrared spectrum itself is pretty wide, starting at about 700nm up to 1mm. It has been subdivided by the International Commission on Illumination in

1 di 5 19/01/2009 18.24
Simple Infrared Barrier http://dev.emcelettronica.com/print/52070

three further bands:

• IR-A: 700 nm–1400 nm

• IR-B: 1400 nm–3000 nm
• IR-C: 3000 nm–1 mm

A common wavelength for the LEDs on the market is around 900nm. Any major component distributor (Farnell, Digikey or even Comet – if you live in
Eastern Europe) will be able to provide you with infrared LEDs, as they are very common on the market nowadays.

I chose a 940nm LED, as it would best match with the sensitivity of the receiver. As I said, this IR LED behaves like any other regular LED. So you must
bear in mind that the intensity of the light, even if in IR spectrum, will also be dependent on the current intensity flowing through the LED. As such, I
have decided to drive the LED not directly from the pin of a microcontroller, but through a transistor capable of handling a higher current. I was thus able
to obtain a range of about 7-8 meters for my barrier. Below, you may see the simple schematic of the emitter. It is based around a PIC12F675, but the
only reason for that is that this is what I had in the drawer. Any general purpose micro will do.

There are several reasons for not keeping the LED turned on all the time (this is a common question). A secondary reason is current consumption. I
intended to power up both the receiver and the emitter from 9V batteries, and I intended to allow a maximum lifetime of the battery. Hence, I would only
pulse the LED from time to time, the actually pattern searched by the receiver being not a continuous flow of IR light, but a pulse train. The main reason
behind this decision is the way the IR receiver functions. Below, you may also see the schematic for the receiver:

2 di 5 19/01/2009 18.24
Simple Infrared Barrier http://dev.emcelettronica.com/print/52070

The receiver is also centered on a PIC12F675, but it uses a dedicated RPM7100 IR receiver module from Rohm which is sensible at the infrared light.
This module is actually a 3-pin IC: power, ground and output terminal. When there is no ambient infrared light, the output terminal of the RPM7100
module remains low. When the module detects infrared light around it, the pin goes high. Unfortunately, if the infrared light around the detector persists,
the output will eventually go low due to the internal electronics of the module. This is not clearly specified in the datasheet (at least, not if you are an
infrared newbie) but it is somehow suggested in two ways. The first hint can be drawn from the internal block diagram given in the datasheet of the

3 di 5 19/01/2009 18.24
Simple Infrared Barrier http://dev.emcelettronica.com/print/52070

The diode on the left is the actual receiver. Between an amplifier stage and limiter stage, there is a series capacitor, which actually filters the continuous
component in the incoming signal (which is electrical signal at this stage). As such, in order to have a signal which you would want to pass through this
capacitor, you will need a pulsating infrared signal, which will be converted to a pulsating electrical signal, which, given the proper frequency, will not be
filtered by the series capacitor.

The second hint also comes from the datasheet, where the manufacturer shows a test signal for the receiver. It actually shows how the electrical signal
driving the LED should look like (Transmit signal) and what the expected output of the RPM7100 would be (Output signal):

Armed with these sources of knowledge, it was not difficult to put up a small code in the transmitting microcontroller in order to obtain the advised
waveform. The microcontroller in the receiver is always looking at the output pin of the RPM7100, expecting a pulse train with a specific frequency.
When that particular signal is missing, it decides that there is something blocking the direct path between the receiver and the emitter, hence an

4 di 5 19/01/2009 18.24
Simple Infrared Barrier http://dev.emcelettronica.com/print/52070

It flags this situation in two ways: first by blinking the attached D2 LED, which is a regular LED, visible to the human eye; secondly by sending a
message to the serial port of the PC (this is why the ST232 chip also found its way in the schematic). Since the PIC12F675 has no hardware UART, this
has to be implemented in software (there are tons of info on the internet about this). The PIC12F675 has an internal RC oscillator, therefore there is no
need for any crystal, and both schematics are complete. Also attached the software for both the receiver and the transmitter may be found (written in
assembly): For the emitter and for the detector in Download section


Source URL: http://dev.emcelettronica.com/simple-infrared-barrier

5 di 5 19/01/2009 18.24