Engineering Activities Resources Enrichment Program Summer School Contact Us


Building Tools for Mindstorms Lego System

Infrared Proximity Sensor

Garrett Hamilton–Smith, Raihan Khondker, and Will Norris,

School of Information Technology and Engineering, University of Ottawa


This exercise is based on the LEGO NXT Mindstorm robot’s infrared proximity sensor.  By isolating this component from the robot’s environment we can conduct much analysis of the component and gain sufficient knowledge of the operation of each individual electronic component and how it is integrated into the design.


The foundation of this exercise is based on both math and physics.  All design principles are derived from Kirchhoff’s voltage law (KVL) which relies on basic mathematic operations such as fractions and relations. The infrared light (IR) is based on the principles of optics. 

Principle of Operation

An IR proximity sensor works by applying a voltage to a pair of IR light emitting diodes (LED’s) which in turn, emit infrared light.  This light propagates through the air and once it hits an object it is reflected back towards the sensor.  If the object is close, the reflected light will be stronger than if the object is further away.  The sensing unit (for this experiment a Sharp IS471FE will be used), in the form of an integrated circuit (IC), detects the reflected infrared light, and if its intensity is strong enough, the circuit becomes active.  When the sensing unit becomes active, it sends a corresponding signal to the output terminal which can then be used to activate any number of devices.  For the purpose of this exercise, a small green LED will turn on when the sensor becomes active.


  Sharp IS471FE ´ 1;  Resistors: 1 kΩ, 10 kΩ ´ 1 each

Capacitor = 0.33 µF ´ 1; Green (or Red) LED ´ 1

 Fairchild QED234 Infrared LED x 2;   5V Power Supply

  Bread Board; Wire Cutters; Red and Black Wire (22 guage)



Figure 1: Schematic of IR Proximity Sensor

With the flat side of the Sharp IS471FE (the IC) facing you, gently spread each leg so they are aligned and place at the edge of the bread board.

Place the IR LED’s (D1 and D2) along the same edge of the bread board such that they face the same direction as the IC. It helps here to place a small “cone” of dark paper at the base of the LED to prevent light from shinning backwards. 

Connect the cathode (shorter leg) of D1 should be connected to the Anode (longer leg) of D2. It is recommended to use a wire to make this connection.

* Note, “Cathode” refers to a negative terminal, while the term “Anode” refers to a positive terminal.

 Connect the cathode of D2 (the shorter one) to pin 4 of the IC.

Connect C1 between pins 1 and 3.

Connect the cathode of D3 (the green or red LED) to pin 2.

Connect resistance R1 to the Anode of D3, and the other end to a common point to be later connect to +5V.

 Connect the Cathode of D1 and pin 1 of the IC to same common point to be connected to +5V.

 Connect resistance R2 from pin 2 of the IC to a common point to be later connected to ground.

 Connect pin 3 to the same grounded common point.

CHECK ALL CONNECTIONS!  Before connecting the power supply make sure it is set to +5V.

  If all connections are complete and correct, turn on the power supply and notice that when an object is brought within approximately 15cm from the IC, the green/red LED turns on!

Remember to always double check every connection and make sure your circuit is properly grounded.  Never work with high voltages as it might damage the components and/or cause bodily harm.  If you are unsure of anything about your circuit or about working with electricity, contact the lab supervisor.


This type of circuit is commonly used as a switch where physical contact is not an option.  For example, we commonly see infrared proximity sensors on public drinking fountains and in public washrooms.  Proximity sensors have found homes in a variety of other applications as well from collision detection and avoidance systems in robotics and cars, as well as position and distance sensors for a variety of applications.  One specific example of where proximity sensors have been integrated into an interactive system is the Lego NXT Mindstorm robot.  Lego has integrated proximity sensors to prevent the robot from colliding with any objects when it is active.  Short of a few extra cables and a slight change in components, the IR Proximity sensor as described and built in this experiment is very similar to that used on the Lego robot.