The Distance IR Bricklet is discontinued. We are selling our remaining stock. The Distance IR Bricklet 2.0 is the recommended replacement.
The Distance IR Bricklet can be used to extend the features of Bricks by the capability to measure distances. Sharp analog infrared proximity sensors can be attached to the Bricklet. After configuring the attached sensor you can read out the measured distance in millimeters. With configurable events it is possible to react on changing distances without polling.
Infrared sensors with different distance ranges are available in the shop:
Typically these types of sensors are used in robotics to measure distances for mapping or localization purposes. But you can also use this sensors in other applications, such as a finding out if a door is opened or closed.
|Sensor||GP2Y0A41SK0F or GP2Y0A21YK0F or GP2Y0A02YK0F|
|Current Consumption||See sensor datasheet|
Depends on attached Sharp IR Sensor:
in 1mm steps, 12bit resolution
|Dimensions (W x D x H)||45 x 13 x 5mm (1.76 x 0.51 x 0.19")*, fits on backside of sensor|
* without cable and sensor
To test a Distance IR Bricklet you need to have Brick Daemon and Brick Viewer installed. Brick Daemon acts as a proxy between the USB interface of the Bricks and the API bindings. Brick Viewer connects to Brick Daemon. It helps to figure out basic information about the connected Bricks and Bricklets and allows to test them.
Connect the Distance IR Bricklet to a Brick with a Bricklet Cable (see picture below).
If you connect the Brick to the PC over USB, you should see a new tab named "Distance IR Bricklet" in the Brick Viewer after a moment. Select this tab. If everything went as expected you can now see the measured distance of the sensor, the output voltage of the IR distance sensor and a graph that shows the distance over time. In the image below we slowly moved a hand away from the sensor and to the sensor again.
After this test you can go on with writing your own application. See the Programming Interface section for the API of the Distance IR Bricklet and examples in different programming languages.
The supported infrared sensors simply produce an output voltage based on the measured distance. This voltage is measured by the ADC of the connected Brick. To compute the corresponding distance to this voltage a voltage/distance mapping is needed. This mapping specific to the selected sensor type is stored on the Distance IR Bricklet. If you want to use an IR distance sensor not directly supported by us, you have to calibrate this voltage/distance mapping yourself.
Press "connect" in the Brick Viewer and you should see the Distance IR tab. Click on it.
Select the "Distance IR Bricklet" tab, press the "Browse" button and choose a voltage/distance mapping file. After this press the "Save" button to write the data onto the Bricklet. The sampling points from the mapping file are interpolated by a spline to get equidistant sampling points for the whole measurement range of the sensor..
After this press the reset button on the Brick or power cycle to load the newly stored voltage/distance mapping.
We provide the voltage/distance mappings for the following sensors:
|GP2D120*||4cm - 30cm (1.57" - 11.81")||Download|
|GP2Y0A41SK0F||4cm - 30cm (1.57" - 11.81")||Download|
|GP2Y0A21YK0F||10cm - 80cm (3.94" - 31.50")||Download|
|GP2Y0A02YK0F||20cm - 150cm (7.87" - 59.06")||Download|
* is no longer sold, replaced by GP2Y0A41SK0F
You can write your own voltage/distance mapping for a sensor we currently do not offer. Or you can modify an existing mapping file to achieve a better quality of your sensor.
A voltage/distance mapping file consists of comments (lines beginning with #) and lines containing one <distance in cm>: <analog value in mV> tuple each. Look in the provided files above to get an idea.
A laser-cut case for the Distance IR Bricklet is available.
The assembly is easiest if you follow the following steps:
Below you can see an exploded assembly drawing of the Distance IR Bricklet case:
Hint: There is a protective film on both sides of the plates, you have to remove it before assembly.
See Programming Interface for a detailed description.
|Visual Basic .NET||API||Examples||Installation|
This can have different causes. The Sharp IR sensors require 5V power supply. If the connected Brick is powered over USB, 5V may not be reached. The reason for this is a voltage drop about 0.5V caused by protection diodes on our products. You can use a stack supply, e.g. the Step-Down Power Supply to provide the sensor with 5V and get a better distance reading.
If the distance measurements are still not precise enough, you have to write a voltage/distance mapping that is specific for your device. The voltage/distance mapping files provided by us are averaged over several sensors.