![]() |
embedded system library for e-puck
1.0.1
A redesigned API library for the e-puck robot platform
|
interface of the eight infrared proximity sensors More...
Files | |
file | el_ir_proximity.h |
interface of the eight infrared proximity sensors
IR proximity sensors are typically used to measure the approximate distance to an object that is in proximity to the sensors. A typical IR proximity sensor contains one IR LED and one IR optical transistor, both of which are pointed to the same direction. The IR LED emit a cone of infrared light towards the direction. If there is an entity that can reflect infrared light, the reflect infrared light will be sensed by the IR optical transistor. The voltage across the transistor are related to the infrared light intensity going in to the transistor.
For e-pucks, the maximum range of the eight IR proximity sensors is around 7.5 cm. These sensors give analog output and are sampled by the 12-bit ADC in the microcontroller, which means the raw readings of the sensors are ranged from 0
to 4095
. The higher the reading, the closer is the object in front of a sensor. Note, as the principle of the IR proximity sensors rely on reflection, the reflection property of objects' surface can affect the relation between the readings and the actual distance. For example, objects painted in black can hardly be detected whereas objects with bright surface may produce reliable readings.
This library provides three working modes for the IR proximity sensors.
The IR LEDs of the sensors do not emit. The ADC simply samples the transistors. As a result, the readings are the ambient infrared intensity in the environment. This mode can be used when a strong infrared light source in the environment need to be detected. For example, a incandescent light bulb or sun light from a window. In this mode, the only meaningful output type to get using el_ir_proximity_get is EL_IR_AMBIENT (see el_ir_proximity_output).
This is a common working scheme of IR proximity sensors.
In each sampling procedure (produce one set of valid readings that can be obtained using el_ir_proximity_get ), the ADC samples the transistors once before the IR LEDs are turned on. These samples are the ambient infrared light intensity (A)
. Then the IR LEDs are switched on. Shortly after (about 600 ns), the ADC samples the transistors for the second time and then the IR LEDs are turned off. These samples are the mixed infrared light intensity (M)
.
The readings of type EL_IR_REFLECTION are calculated by R =
M -
A,
which is the proximity to any objects in front of the sensors.
In this mode, EL_IR_AMBIENT can still be obtained and the results are simply A.
Because the original e-puck is not a good infrared reflector, this working scheme has been designed to improved the e-puck to e-puck detection by making e-pucks actively emitting infrared light. This may be used when a swarm of e-pucks need to work together.
In this mode, the IR LEDs are initially turn on. In each sampling procedure, the ADC samples the transistors once. These samples are the mixed infrared light intensity (M
). Then the IR LEDs are switched off. Shortly after (about 600 ns), the ADC samples the transistors for the second time and then the IR LEDs are turned on again. These samples are the ambient infrared light intensity (A
).
The EL_IR_REFLECTION readings are calculated by R
= M
- A
, which again is the proximity to any objects that can reflect infrared light efficiently.
In contrast to the Pulse mode, the EL_IR_AMBIENT readings in this mode can be used to determine the proximity to nearby e-pucks that also have their proximity sensors working in the Emit mode. Note, this is based on a assumption that there is no other significant infrared source in the environment, such as incandescent light bulb or day light from a window.
An example of using these sensors to maintain a distance to any object in front of the e-puck can be found in Feedback Control Loop.