This post’s subject is infrared sensors. It is possible to build or buy a complete one and make many electronic and robotic projects.
How it works?
An LED emits infrared light, the LED’s operation has been explained in another post, the button below will access the post.
The infrared light is reflected by a surface and goes to the receiver.
The receiver is a phototransistor, a bipolar junction transistor which instead of base terminal, it is encapsulated with transparent material, allowing the light to enter. The current is controlled by light intensity. In the schematics, the phototransistor is represented like a transistor, however with two arrows and without base terminal.
Some phototransistors have a base terminal to control the component.
In the phototransistor, the areas of base and collector are bigger than in the normal BJT transistor. When light hits the base, electron-hole pairs are generated in base-collector junction, moving by an electric field between the collector and emitter, creating a base current. In NPN, the collector is positive with respect to emitter, in PNP case, it is negative with respect to the emitter.
The most used material is doped gallium arsenide (GaAs). In phototransistors with a heterojunction structure, like in the figure below, the material to the emitter is aluminum gallium arsenide (AlGaAs).
Building the sensor
The components to build an infrared (IR) sensor are: 1 IR LED, 1 phototransistor, and 2 resistors: one of 10 kΩ and another of 330 Ω.
This is the schematics.
This is the sensor assembled in protoboard. The phototransistor is transparent, the flatted part must be linked to the resistor.
And assembled in a printed circuit board.
The circuit below makes the relay switch when IR sensor detects some object. The MOSFET (Field Effect Transistor) used is IRF840 and the relay is Metaltex AT1RC1 6VDC.
The circuit is assembled on a printed circuit board, and the phototransistor and IR LED are on the other side.
Commercial infrared sensors
Instead of using an IR LED and phototransistor individually, can use a reflective infrared sensor like the TCRT5000.
This is another commercial IR sensor obstacle detector, that was made to be connected to Arduino. Turns on a LED behind when detects an object in front.
This sensor has a screw behind it, to adjust the detection distance.
The sensor is connected to Arduino. The white wire is the sensor’s data input and is in digital pin 7.
The algorithm test has nothing new.
When there is no obstacle present, “1” appears on the serial screen. When detects an obstacle, the screen shows “0” and LED behind lights on. Other IR modules work in similar way.