
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
<title>Distance IR Bricklet – Tinkerforge</title>

<!--<link type="text/css" rel="stylesheet" href="http://www.tinkerforge.com/static/base_tf.css" />-->
<link type="text/css" rel="stylesheet" href="http://www.tinkerforge.com/static/jquery.lightbox-0.5.css" />
<meta name="keywords" content="Tinkerforge, Open Source Hardware, Bricks, Bricklets, USB Controllable, USB Sensing, USB Controlling" />
<meta name="description" content="Easy-to-use open source hardware. Control motors and sense the environment over USB, Ethernet or Wi-Fi/WLAN with C/C++, C#, Delphi/Lazarus, Java, JavaScript, LabVIEW, Mathematica, MATLAB/Octave, Perl, PHP, Python, Ruby, Shell, Visual Basic .NET or directly over TCP/IP." />
<meta name="copyright" content="Tinkerforge GmbH" />
<!--<script type="text/javascript">document.write('<style>.noscript { display: none; }</style>');</script>-->


    
    <link rel="stylesheet" href="../../_static/documentation_tf.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '1.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="top" title="Tinkerforge" href="../../index.html" />
    <link rel="up" title="Bricklets" href="Bricklets.html" />
    <link rel="next" title="Distance US Bricklet" href="Distance_US.html" />
    <link rel="prev" title="Current25 Bricklet" href="Current25.html" />

<script type="text/javascript" src="http://www.tinkerforge.com/static/jquery.lightbox-0.5.js"></script>
<script type="text/javascript">$(function() { $('#gallery a').lightBox(); });</script>
<script type="text/javascript">$(function() { $(".sphinxsidebarwrapper").filter(function() { return $.trim($(this).text()).length == 0; }).parent().hide(); });</script>


  </head>
  <body>
<div id="wrapper">
	<div id="tfcontent">
		<div class="boxContent3">


<div class="toctree">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../Getting_Started.html">Getting Started</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../Primer.html">Primer</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Tutorials/Tutorials.html">Tutorials</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../FAQ.html">FAQ</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="../Hardware.html">Hardware</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../Bricks/Bricks.html">Bricks</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="Bricklets.html">Bricklets</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="Ambient_Light.html">Ambient Light Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Analog_In.html">Analog In Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Analog_Out.html">Analog Out Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Barometer.html">Barometer Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Breakout.html">Breakout Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Color.html">Color Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Current12.html">Current12 Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Current25.html">Current25 Bricklet</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="">Distance IR Bricklet</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#features">Features</a></li>
<li class="toctree-l4"><a class="reference internal" href="#description">Description</a></li>
<li class="toctree-l4"><a class="reference internal" href="#technical-specifications">Technical Specifications</a></li>
<li class="toctree-l4"><a class="reference internal" href="#resources">Resources</a></li>
<li class="toctree-l4"><a class="reference internal" href="#test-your-distance-ir-bricklet">Test your Distance IR Bricklet</a></li>
<li class="toctree-l4"><a class="reference internal" href="#configure-infrared-sensor">Configure Infrared Sensor</a><ul>
<li class="toctree-l5"><a class="reference internal" href="#changing-the-voltage-distance-mapping">Changing the Voltage/Distance Mapping</a></li>
<li class="toctree-l5"><a class="reference internal" href="#available-voltage-distance-mappings">Available Voltage/Distance Mappings</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="#case">Case</a></li>
<li class="toctree-l4"><a class="reference internal" href="#programming-interface">Programming Interface</a></li>
<li class="toctree-l4"><a class="reference internal" href="#faq">FAQ</a><ul>
<li class="toctree-l5"><a class="reference internal" href="#the-distances-are-wrong">The distances are wrong</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="Distance_US.html">Distance US Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Dual_Button.html">Dual Button Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Dual_Relay.html">Dual Relay Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="GPS.html">GPS Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Hall_Effect.html">Hall Effect Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Humidity.html">Humidity Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Industrial_Digital_In_4.html">Industrial Digital In 4 Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Industrial_Digital_Out_4.html">Industrial Digital Out 4 Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Industrial_Dual_020mA.html">Industrial Dual 0-20mA Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Industrial_Quad_Relay.html">Industrial Quad Relay Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="IO16.html">IO-16 Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="IO4.html">IO-4 Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Joystick.html">Joystick Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="LCD_16x2.html">LCD 16x2 Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="LCD_20x4.html">LCD 20x4 Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="LED_Strip.html">LED Strip Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Line.html">Line Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Linear_Poti.html">Linear Poti Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Moisture.html">Moisture Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Motion_Detector.html">Motion Detector Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Multi_Touch.html">Multi Touch Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="NFC_RFID.html">NFC/RFID Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Piezo_Buzzer.html">Piezo Buzzer Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Piezo_Speaker.html">Piezo Speaker Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="PTC.html">PTC Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Remote_Switch.html">Remote Switch Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Rotary_Encoder.html">Rotary Encoder Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Rotary_Poti.html">Rotary Poti Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Segment_Display_4x7.html">Segment Display 4x7 Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Solid_State_Relay.html">Solid State Relay Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Sound_Intensity.html">Sound Intensity Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Temperature.html">Temperature Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Temperature_IR.html">Temperature IR Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Tilt.html">Tilt Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Voltage.html">Voltage Bricklet</a></li>
<li class="toctree-l3"><a class="reference internal" href="Voltage_Current.html">Voltage/Current Bricklet</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../Master_Extensions/Master_Extensions.html">Master Extensions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Power_Supplies/Power_Supplies.html">Power Supplies</a></li>
<li class="toctree-l2"><a class="reference internal" href="../Accessories/Accessories.html">Accessories</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Timeline.html">Timeline</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../Software/Software.html">Software</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../Software/Brickd.html">Brick Daemon (brickd)</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Software/Brickv.html">Brick Viewer (brickv)</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Software/API_Bindings.html">API Bindings</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Software/Firmwares_And_Plugins.html">Firmwares and Plugins</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Software/Device_Identifier.html">Device Identifier</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Source_Code.html">Source Code and Bug Tracking</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Programming_Interface.html">Programming Interface</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../Kits/Kits.html">Starter Kits</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../Kits/WeatherStation/WeatherStation.html">Weather Station</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Kits/HardwareHacking/HardwareHacking.html">Hardware Hacking</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Kits/ServerRoomMonitoring/ServerRoomMonitoring.html">Server Room Monitoring</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Kits/Blinkenlights/Blinkenlights.html">Blinkenlights</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Kits/InternetOfThings/InternetOfThings.html">Internet of Things</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Kits/CameraSlider/CameraSlider.html">Camera Slider</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../Embedded/Boards.html">Embedded Boards</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../Embedded/Raspberry_Pi.html">Raspberry Pi</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../Specifications.html">Specifications</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../Technical_Data.html">Technical Data</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Low_Level_Protocols/TCPIP.html">TCP/IP Protocol</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Low_Level_Protocols/Modbus.html">Modbus Protocol</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../Low_Level_Protocols/Wireshark_Dissector.html">Wireshark Dissector</a></li>
</ul>
</li>
</ul>

</div>



<div id="shoplink_img">
	<a href="../../../shop/bricklets/distance-ir-bricklet.html"><img alt="Shop" width="32" height="40" src="../../_images/Misc/cart-icon.png" /></a>
</div>
<div id="shoplink_a">
	<a href="../../../shop/bricklets/distance-ir-bricklet.html">In Shop</a>
</div>



    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="distance-ir-bricklet">
<span id="id1"></span><h1>Distance IR Bricklet<a class="headerlink" href="#distance-ir-bricklet" title="Permalink to this headline">¶</a></h1>
{% from "macros.html" import tfdocstart, tfdocimg, tfdocend %}
{{
    tfdocstart("Bricklets/bricklet_distance_ir_tilted_350.jpg",
               "Bricklets/bricklet_distance_ir_tilted_600.jpg",
               "Distance IR Bricklet")
}}
{{
    tfdocimg("Bricklets/bricklet_distance_ir_front_100.jpg",
             "Bricklets/bricklet_distance_ir_front_600.jpg",
             "Distance IR Bricklet")
}}
{{
    tfdocimg("Bricklets/bricklet_distance_ir_back_100.jpg",
             "Bricklets/bricklet_distance_ir_back_600.jpg",
             "Distance IR Bricklet")
}}
{{
    tfdocimg("Bricklets/bricklet_distance_ir_master_100.jpg",
             "Bricklets/bricklet_distance_ir_master_600.jpg",
             "Distance IR Bricklet with Master Brick")
}}
{{
    tfdocimg("Bricklets/bricklet_distance_ir_sensors_100.jpg",
             "Bricklets/bricklet_distance_ir_sensors_600.jpg",
             "Distance IR Bricklet sensors")
}}
{{
    tfdocimg("Cases/bricklet_distance_ir_case_100.jpg",
             "Cases/bricklet_distance_ir_case_600.jpg",
             "Distance IR Bricklet in Case")
}}
{{
    tfdocimg("Bricklets/bricklet_distance_ir_brickv_100.jpg",
             "Bricklets/bricklet_distance_ir_brickv.jpg",
             "Distance IR Bricklet in Brick Viewer")
}}
{{
    tfdocimg("Dimensions/dist_ir_bricklet_dimensions_100.png",
             "Dimensions/dist_ir_bricklet_dimensions_600.png",
             "Outline and drilling plan")
}}
{{ tfdocend() }}<div class="section" id="features">
<h2>Features<a class="headerlink" href="#features" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>Measures distances up to 150cm with IR light</li>
<li>Sensor can be changed</li>
<li>Output in 1mm steps (12bit resolution)</li>
</ul>
</div>
<div class="section" id="description">
<span id="distance-ir-bricklet-description"></span><h2>Description<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2>
<p>The Distance IR <a class="reference internal" href="../../Primer.html#primer-bricklets"><em>Bricklet</em></a> can be used to
extend the features of <a class="reference internal" href="../../Primer.html#primer-bricks"><em>Bricks</em></a> by the
capability to measure distances. <a class="reference external" href="http://www.sharpsma.com">Sharp</a> 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.</p>
<p>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.</p>
</div>
<div class="section" id="technical-specifications">
<h2>Technical Specifications<a class="headerlink" href="#technical-specifications" title="Permalink to this headline">¶</a></h2>
<table border="1" class="docutils">
<colgroup>
<col width="33%" />
<col width="67%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Property</th>
<th class="head">Value</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>Sensor</td>
<td>GP2Y0A41 or GP2Y0A21 or GP2Y0A02</td>
</tr>
<tr class="row-odd"><td>Current Consumption</td>
<td>See sensor datasheet</td>
</tr>
<tr class="row-even"><td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr class="row-odd"><td>Distance</td>
<td><p class="first">Depends on attached <a class="reference external" href="http://www.sharpsma.com">Sharp</a> IR Sensor:</p>
<ul class="simple">
<li>GP2Y0A41:   4cm -  30cm (1.57&quot; - 11.81&quot;)</li>
<li>GP2Y0A21:  10cm -  80cm (3.94&quot; - 31.50&quot;)</li>
<li>GP2Y0A02:  20cm - 150cm (7.87&quot; - 59.06&quot;)</li>
</ul>
<p class="last">in 1mm steps, 12bit resolution</p>
</td>
</tr>
<tr class="row-even"><td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr class="row-odd"><td>Dimensions (W x D x H)</td>
<td>45 x 13 x 5mm (1.76 x 0.51 x 0.19&quot;)*, fits on backside of sensor</td>
</tr>
<tr class="row-even"><td>Weight</td>
<td>2g*</td>
</tr>
</tbody>
</table>
<p>* without cable and sensor</p>
</div>
<div class="section" id="resources">
<h2>Resources<a class="headerlink" href="#resources" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>GP2Y0A41 datasheet (<a class="reference external" href="https://github.com/Tinkerforge/distance-ir-bricklet/raw/master/datasheets/GP2Y0A41.pdf">Download</a>)</li>
<li>GP2Y0A21 datasheet (<a class="reference external" href="https://github.com/Tinkerforge/distance-ir-bricklet/raw/master/datasheets/GP2Y0A21.pdf">Download</a>)</li>
<li>GP2Y0A02 datasheet (<a class="reference external" href="https://github.com/Tinkerforge/distance-ir-bricklet/raw/master/datasheets/GP2Y0A02.pdf">Download</a>)</li>
<li>Schematic (<a class="reference external" href="https://github.com/Tinkerforge/distance-ir-bricklet/raw/master/hardware/distir-schematic.pdf">Download</a>)</li>
<li>Outline and drilling plan (<a class="reference external" href="../../_images/Dimensions/dist_ir_bricklet_dimensions.png">Download</a>)</li>
<li>Source code and design files (<a class="reference external" href="https://github.com/Tinkerforge/distance-ir-bricklet/zipball/master">Download</a>)</li>
</ul>
</div>
<div class="section" id="test-your-distance-ir-bricklet">
<span id="distance-ir-bricklet-test"></span><h2>Test your Distance IR Bricklet<a class="headerlink" href="#test-your-distance-ir-bricklet" title="Permalink to this headline">¶</a></h2>
<p>To test a Distance IR Bricklet you need to have <a class="reference internal" href="../../Software/Brickd.html#brickd"><em>Brick Daemon</em></a> and
<a class="reference internal" href="../../Software/Brickv.html#brickv"><em>Brick Viewer</em></a> 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.</p>
<p>Connect the Distance IR Bricklet to a <a class="reference internal" href="../../Primer.html#primer-bricks"><em>Brick</em></a>
with a Bricklet Cable (see picture below).</p>
<a class="reference external image-reference" href="../../_images/Bricklets/bricklet_distance_ir_master_1200.jpg"><img alt="Distance IR Bricklet with infrared sensor connected to Master Brick" class="align-center" src="../../_images/bricklet_distance_ir_master_600.jpg" style="width: 600.0px; height: 400.0px;" /></a>
<p>If you connect the Brick to the PC over USB, you should see a new tab named
&quot;Distance IR Bricklet&quot; 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.</p>
<a class="reference external image-reference" href="../../_images/Bricklets/bricklet_distance_ir_brickv.jpg"><img alt="Distance IR Bricklet in Brick Viewer" class="align-center" src="../../_images/bricklet_distance_ir_brickv.jpg" style="width: 466.0px; height: 452.0px;" /></a>
<p>After this test you can go on with writing your own application.
See the <a class="reference internal" href="#distance-ir-bricklet-programming-interface"><em>Programming Interface</em></a>
section for the API of the Distance IR Bricklet and examples in different programming
languages.</p>
</div>
<div class="section" id="configure-infrared-sensor">
<span id="distance-ir-sensor-configuration"></span><h2>Configure Infrared Sensor<a class="headerlink" href="#configure-infrared-sensor" title="Permalink to this headline">¶</a></h2>
<p>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.</p>
<div class="section" id="changing-the-voltage-distance-mapping">
<h3>Changing the Voltage/Distance Mapping<a class="headerlink" href="#changing-the-voltage-distance-mapping" title="Permalink to this headline">¶</a></h3>
<p>To write the voltage/distance mapping you have to connect the Bricklet
with a Brick to your PC with has <a class="reference internal" href="../../Software/Brickd.html#brickd"><em>Brick Daemon</em></a> and the
<a class="reference internal" href="../../Software/Brickv.html#brickv"><em>Brick Viewer</em></a> installed and running.</p>
<p>Press &quot;connect&quot; in the Brick Viewer and you should see the Distance IR tab.
Click on it.</p>
<p>Select the &quot;Distance IR Bricklet&quot; tab, press the &quot;File..&quot; button and choose a
voltage/distance mapping file. After this press the &quot;Save&quot; 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..</p>
<p>After this press the reset button on the Brick or power cycle to
load the newly stored voltage/distance mapping.</p>
</div>
<div class="section" id="available-voltage-distance-mappings">
<h3>Available Voltage/Distance Mappings<a class="headerlink" href="#available-voltage-distance-mappings" title="Permalink to this headline">¶</a></h3>
<p>We provide the voltage/distance mappings for the following sensors:</p>
<table border="1" class="docutils">
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Type</th>
<th class="head">Range</th>
<th class="head">Mapping File</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>GP2D120*</td>
<td>4cm - 30cm (1.57&quot; - 11.81&quot;)</td>
<td><a class="reference external" href="https://github.com/Tinkerforge/distance-ir-bricklet/raw/master/software/calibration/2D120.txt">Download</a></td>
</tr>
<tr class="row-odd"><td>GP2Y0A41</td>
<td>4cm - 30cm (1.57&quot; - 11.81&quot;)</td>
<td><a class="reference external" href="https://github.com/Tinkerforge/distance-ir-bricklet/raw/master/software/calibration/2Y0A41.txt">Download</a></td>
</tr>
<tr class="row-even"><td>GP2Y0A21</td>
<td>10cm - 80cm (3.94&quot; - 31.50&quot;)</td>
<td><a class="reference external" href="https://github.com/Tinkerforge/distance-ir-bricklet/raw/master/software/calibration/2Y0A21.txt">Download</a></td>
</tr>
<tr class="row-odd"><td>GP2Y0A02</td>
<td>20cm - 150cm (7.87&quot; - 59.06&quot;)</td>
<td><a class="reference external" href="https://github.com/Tinkerforge/distance-ir-bricklet/raw/master/software/calibration/2Y0A02.txt">Download</a></td>
</tr>
</tbody>
</table>
<p>* is no longer sold, replaced by GP2Y0A41</p>
<p>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.</p>
<p>A voltage/distance mapping file consists of comments (lines beginning with <tt class="docutils literal"><span class="pre">#</span></tt>)
and lines containing one <tt class="docutils literal"><span class="pre">&lt;distance</span> <span class="pre">in</span> <span class="pre">cm&gt;:</span> <span class="pre">&lt;analog</span> <span class="pre">value</span> <span class="pre">in</span> <span class="pre">mV&gt;</span></tt> tuple each.
Look in the provided files above to get an idea.</p>
</div>
</div>
<div class="section" id="case">
<span id="distance-ir-bricklet-case"></span><h2>Case<a class="headerlink" href="#case" title="Permalink to this headline">¶</a></h2>
<p>A <a class="reference external" href="https://www.tinkerforge.com/en/shop/cases/case-distance-ir-bricklet.html">laser-cut case for the Distance IR Bricklet</a> is available.</p>
<a class="reference external image-reference" href="../../_images/Cases/bricklet_distance_ir_case_1000.jpg"><img alt="Case for Distance IR Bricklet" class="align-center" src="../../_images/bricklet_distance_ir_case_350.jpg" style="width: 303.0px; height: 350.0px;" /></a>
<p>The assembly is easiest if you follow the following steps:</p>
<ul class="simple">
<li>Screw spacers to the Bricklet,</li>
<li>screw bottom plate to bottom spacers,</li>
<li>build up side plates,</li>
<li>plug side plates into bottom plate and</li>
<li>screw top plate to top spacers.</li>
</ul>
<p>Below you can see an exploded assembly drawing of the Distance IR Bricklet case:</p>
<a class="reference external image-reference" href="../../_images/Exploded/distance_ir_exploded.png"><img alt="Exploded assembly drawing for Distance IR Bricklet" class="align-center" src="../../_images/distance_ir_exploded_350.png" style="width: 350.0px; height: 365.0px;" /></a>
<p>Hint: There is a protective film on both sides of the plates,
you have to remove it before assembly.</p>
</div>
<div class="section" id="programming-interface">
<span id="distance-ir-bricklet-programming-interface"></span><h2>Programming Interface<a class="headerlink" href="#programming-interface" title="Permalink to this headline">¶</a></h2>
<p>See <a class="reference internal" href="../../Programming_Interface.html#programming-interface"><em>Programming Interface</em></a> for a detailed description.</p>
<table border="1" class="docutils">
<colgroup>
<col width="45%" />
<col width="18%" />
<col width="18%" />
<col width="18%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Language</th>
<th class="head">API</th>
<th class="head">Examples</th>
<th class="head">Installation</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>Modbus</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Modbus.html#distance-ir-bricklet-modbus-api"><em>API</em></a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr class="row-odd"><td>TCP/IP</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_TCPIP.html#distance-ir-bricklet-tcpip-api"><em>API</em></a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr class="row-even"><td>C/C++</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_C.html#distance-ir-bricklet-c-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_C.html#distance-ir-bricklet-c-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_C.html#api-bindings-c"><em>Installation</em></a></td>
</tr>
<tr class="row-odd"><td>C#</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_CSharp.html#distance-ir-bricklet-csharp-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_CSharp.html#distance-ir-bricklet-csharp-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_CSharp.html#api-bindings-csharp"><em>Installation</em></a></td>
</tr>
<tr class="row-even"><td>Delphi/Lazarus</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Delphi.html#distance-ir-bricklet-delphi-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Delphi.html#distance-ir-bricklet-delphi-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_Delphi.html#api-bindings-delphi"><em>Installation</em></a></td>
</tr>
<tr class="row-odd"><td>Java</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Java.html#distance-ir-bricklet-java-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Java.html#distance-ir-bricklet-java-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_Java.html#api-bindings-java"><em>Installation</em></a></td>
</tr>
<tr class="row-even"><td>JavaScript</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_JavaScript.html#distance-ir-bricklet-javascript-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_JavaScript.html#distance-ir-bricklet-javascript-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_JavaScript.html#api-bindings-javascript"><em>Installation</em></a></td>
</tr>
<tr class="row-odd"><td>LabVIEW</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_LabVIEW.html#distance-ir-bricklet-labview-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_LabVIEW.html#distance-ir-bricklet-labview-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_LabVIEW.html#api-bindings-labview"><em>Installation</em></a></td>
</tr>
<tr class="row-even"><td>Mathematica</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Mathematica.html#distance-ir-bricklet-mathematica-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Mathematica.html#distance-ir-bricklet-mathematica-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_Mathematica.html#api-bindings-mathematica"><em>Installation</em></a></td>
</tr>
<tr class="row-odd"><td>MATLAB/Octave</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_MATLAB.html#distance-ir-bricklet-matlab-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_MATLAB.html#distance-ir-bricklet-matlab-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_MATLAB.html#api-bindings-matlab"><em>Installation</em></a></td>
</tr>
<tr class="row-even"><td>Perl</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Perl.html#distance-ir-bricklet-perl-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Perl.html#distance-ir-bricklet-perl-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_Perl.html#api-bindings-perl"><em>Installation</em></a></td>
</tr>
<tr class="row-odd"><td>PHP</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_PHP.html#distance-ir-bricklet-php-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_PHP.html#distance-ir-bricklet-php-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_PHP.html#api-bindings-php"><em>Installation</em></a></td>
</tr>
<tr class="row-even"><td>Python</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Python.html#distance-ir-bricklet-python-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Python.html#distance-ir-bricklet-python-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_Python.html#api-bindings-python"><em>Installation</em></a></td>
</tr>
<tr class="row-odd"><td>Ruby</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Ruby.html#distance-ir-bricklet-ruby-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Ruby.html#distance-ir-bricklet-ruby-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_Ruby.html#api-bindings-ruby"><em>Installation</em></a></td>
</tr>
<tr class="row-even"><td>Shell</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Shell.html#distance-ir-bricklet-shell-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_Shell.html#distance-ir-bricklet-shell-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_Shell.html#api-bindings-shell"><em>Installation</em></a></td>
</tr>
<tr class="row-odd"><td>Visual Basic .NET</td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_VBNET.html#distance-ir-bricklet-vbnet-api"><em>API</em></a></td>
<td><a class="reference internal" href="../../Software/Bricklets/DistanceIR_Bricklet_VBNET.html#distance-ir-bricklet-vbnet-examples"><em>Examples</em></a></td>
<td><a class="reference internal" href="../../Software/API_Bindings_VBNET.html#api-bindings-vbnet"><em>Installation</em></a></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="faq">
<h2>FAQ<a class="headerlink" href="#faq" title="Permalink to this headline">¶</a></h2>
<div class="section" id="the-distances-are-wrong">
<h3>The distances are wrong<a class="headerlink" href="#the-distances-are-wrong" title="Permalink to this headline">¶</a></h3>
<p>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 <a class="reference internal" href="../Power_Supplies/Step_Down.html#step-down-power-supply"><em>Step-Down Power Supply</em></a> to provide the sensor with 5V and get a better
distance reading.</p>
<p>Another cause can be a calibration problem. First of all you should
check if the calibration for the correct infrared sensor is installed
(see <a class="reference internal" href="#distance-ir-sensor-configuration"><em>here</em></a>) and calibrate the ADC of your
Brick (see <a class="reference internal" href="../../Software/Brickv.html#brickv-adc-calibration"><em>here</em></a>).</p>
<p>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.</p>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
		<div id="tf_license">
			<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
				<img alt="Creative Commons Licence" width="88" height="31" style="border-width:0" src="/static/images/cc_license_logo.png" />
			</a>
			The content of this page is licensed under
			<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution 3.0 Unported License</a>.
		</div>
		</div>
	</div>
</div>

    <div class="footer">
        &copy; Copyright 2011-2015, Olaf Lüke (olaf@tinkerforge.com).
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
    </div>
  </body>
</html>