Connecting an IR Sensor

From ROBOTC API Guide
< Tutorials‎ | Arduino Projects/Mobile Robotics/BoeBot
Revision as of 17:04, 16 October 2012 by Jwatson (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Schematic

Since the IR Sensor uses a light sensor, the schematic is very similar to that of the light sensor. The only difference is the addition of an IR LED and that the IR detector requires connection to 5V and ground.

IR Sensor schematic

Breadboard Setup

To setup the sensors you will need:

  • 2x IR Detectors
  • 2x IR LEDs in housings
  • 2x 2kΩ resistors (red-black-red)
  • 2x 220Ω resistors (red-red-brown)
  • 2x red jumper wires
  • 2x black jumper wires
  • 2x signal jumper wires (can be of any color)


First we need to make sure that the IR LEDs are in their housings

1) Insert IR LED into larger housing part with leads sticking out. 2) Press the LED firmly into the housing. 3) place the smaller housing part over the LED.

Placing the IR LEDs

Now we can place the IR LEDs into the breadboard. Note that the anode (longer lead, rounded edge) is the positive side and the cathode (shorter lead, flat edge) is the negative side. Reversing the polarity may damage the LED.

virtual breadboard with IR LEDs
breadboard with IR LEDs

Placing the IR Detectors

Now we can place the IR Detectors into the breadboard. The middle prong of the collector should be on the same bus as the LED's cathode (in order to tie it to Ground).

virtual breadboard with IR Detectors added
breadboard with IR Detectors added

Resistors

Remember, the IR LED's are still a form of LED and will need a resistor in place to limit the amount of current flowing through them. This is especially important to remember with infrared LEDs because the wavelengths of light they emit are not visible to the human eye; it may be difficult to determine if they are working or not.
virtual breadboard with resistors added
breadboard with resistors added

Wires

The last thing to do is to wire the IR LEDs, the resistors, and the IR receivers into the Arduino. First, connect the +5v prongs of the IR receivers (right prong if facing the receiver) using the red wires. They should be directly hooked up to the +5 volt port on the Arduino with no resistor in series. Next, connect the Ground prongs of the IR receivers (middle prong), which should be on the same bus as the IR LEDs' cathode, to the GND port of the Arduino using the black wires. The third prongs, or signal prongs, of the IR receivers (left prong if facing the receiver) should be connected through the 220 ohm resistors to the Arduino's pins 7 and 8 (right receiver on pin 7, left receiver on pin 8) using the grey wires. Finally, the anode of the IR LED's should be run through separate 2k resistors into port 9 using the yellow wires. Check the virtual breadboard to ensure each wire is hooked up correctly.
virtual breadboard with wires added
breadboard with wires added