Distance IR Bricklet 2.0


  • Measures distances with IR light
  • Sensor can be changed
  • Supported ranges: 4-30cm, 10-80cm and 20-150cm


The Distance IR Bricklet 2.0 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 supported and 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.

Technical Specifications

Property Value
Sensor GP2Y0A41SK0F or GP2Y0A21YK0F or GP2Y0A02YK0F
Current Consumption 110mW (22mA at 5V)

Depends on attached IR Sensor:

  • GP2Y0A41SK0F: 4cm - 30cm (1.57" - 11.81")
  • GP2Y0A21YK0F: 10cm - 80cm (3.94" - 31.50")
  • GP2Y0A02YK0F: 20cm - 150cm (7.87" - 59.06")
Dimensions (W x D x H) 45 x 13 x 5mm (1.76 x 0.51 x 0.19")*, fits on backside of sensor
Weight 8g

* without cable and sensor


Test your Distance IR Bricklet 2.0

To test a Distance IR Bricklet 2.0 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 2.0 to a Brick with a Bricklet Cable.

If you connect the Brick to the PC over USB, you should see a new tab named "Distance IR Bricklet 2.0" 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 and a graph that shows the distance over time.

Distance IR Bricklet 2.0 in Brick Viewer

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 2.0 and examples in different programming languages.


A laser-cut case for the Distance IR Bricklet 2.0 is available.

Case for Distance IR Bricklet 2.0

The assembly is easiest if you follow the following steps:

  • Screw spacers to the Bricklet,
  • screw bottom plate to bottom spacers,
  • build up side plates,
  • plug side plates into bottom plate and
  • screw top plate to top spacers.

Below you can see an exploded assembly drawing of the Distance IR Bricklet 2.0 case:

Exploded assembly drawing for Distance IR Bricklet 2.0

Hint: There is a protective film on both sides of the plates, you have to remove it before assembly.

Programming Interface

See Programming Interface for a detailed description.

Language API Examples Installation
C/C++ API Examples Installation
C/C++ for Microcontrollers API Examples Installation
C# API Examples Installation
Delphi/Lazarus API Examples Installation
Go API Examples Installation
Java API Examples Installation
JavaScript API Examples Installation
LabVIEW API Examples Installation
Mathematica API Examples Installation
MATLAB/Octave API Examples Installation
MQTT API Examples Installation
openHAB API Examples Installation
Perl API Examples Installation
PHP API Examples Installation
Python API Examples Installation
Ruby API Examples Installation
Rust API Examples Installation
Shell API Examples Installation
Visual Basic .NET API Examples Installation
Modbus API