Step 3: IR Detector Circuit

Picture of IR Detector Circuit
Schematic and Notes.jpg
Phototransistor Notes.jpg
Disconnected Circuit.jpg
Completed Circuit.jpg
There are three separate circuits to connect to the Arduino. You can refer to my schematic and notes sketch in the images and to the pictures of the breadboard to see how I hooked it all up. Of course, the critical things to note are the anode/cathode orientation of the LEDs and transistors and the connections to power and ground. The whole circuit is powered from the Arduino board and since the program will communicate with the PC, I'm using the USB connector for power.

IR Detector Circuit
I figured the easiest way to detect breaks in the light path was to use an IR LED and IR phototransistor, configured so that the phototransistor is either "on" or "off" instead of using a photocell with an analog threshold.

I found the configuration in the Forrest Mims circuit notebook "Optoelectronic Circuits" - the excerpt is in the images below. These books are wonderful, by the way. I'm anxious to try many of the other sensors and circuits he describes in them with the Arduino.

A 10K Ohm resistor goes from the +5V connector on the Arduino to the collector on the phototransistor (pin 2). The emitter of the phototransistor (pin 1) is connected to ground (again on the Arduino board). Pin 3 is unused and can be bent out of the way or clipped. The collector (pin 2) is also connected to the digital pin 2 on the Arduino. Input 2 on the Arduino corresponds to interrupt 0, which we will be using to count pulses.

I used alligator clip patch wires to connect the phototransistor and small angled pins on the breadboard to connect to the circuit. The hookups for this project are simple enough that you could probably do point-to-board wiring and just plug the hookup wires into the sockets on the Arduino. I used a small breadboard instead. Of course, if you have the Arduino shield, construction would be even easier.

IR LED Circuit
The Arduino Diecimila has a current limiting resistor on pin 13, so to reduce the parts count, I connected the IR LED to that pin. If you have an older Arduino board, remember to connect an appropriate series resistor to the output pin. The connections for this were also done with a right-angled header on the breadboard and alligator clip patch wires to the LED. Anode to digital pin 13, cathode (flat side) to ground.

Status LED
Since we're dealing with invisible IR light, interrupts, and serial communications for status, I wanted to see something that would tell me the circuit is working, so I connected a RED status LED to digital pin 12 through a 220 Ohm series resistor.
wii5525 years ago
could this be done with a cds cell/photocell/LDR/photoresistor(all the same thing)
adrenalynn6 years ago
I concur with sscanf: This won't work as detailed in your "pretty picture" - you need to go back to your hand-drawn schematic on graph paper. As detailed in the first picture the transistor will never see the voltage it needs...
sscanf6 years ago
I just used this howto as a reference for a similar application using the same IR components and Arduino Diecimila. Everything worked great but note that there is an important difference between the circuit diagrams on this page for connecting the phototransistor. I found that the hand drawn connection shown on the graph paper worked but the other does not. Your mileage may vary.