TELEO
 
 
 
 
 
 
COOKBOOK
 

IR Interrupter Sensor

How to Use an IR Interrupter Sensor:

 


Concept Overview

Circuit Diagram

Component Selection

Wiring the LED emitter

Wiring the Phototransistor Collector

A Max Patch using an IR Interrupter

Flash Code using an IR Interrupter

Project Ideas

Glossary

 

 
   

Initial Setup Requirements:

Components:

IR Interrupter
Multi I/O module
Resistors
Wire

Tools:

Soldering Iron
Solder
Voltmeter
IR Sensor Card

 

Concept Overview

IR interruptors consist of an LED that emits infrared light and a photoresistor that detects it. When there's nothing in the way of the light beam, the interrupter has very low resistance. If the beam is blocked, the resistance increases. When connected via a voltage divider to the Teleo's digital in, the interruptor can be used to sense when an object is present between its two posts.

fig. 1: concept diagram

Circuit Diagram

For an explanation of symbols, refer to circuit basics



fig. 2: circuit diagram

Component Selection

The IR interrupter we used is available in our store. It was wired using a 150 resistor on the emitter and a 1 k resistor from the +5V terminal to the digital in. These resistor values were chosen for 2 reasons.

A proper voltage divider must be set up in order to get a good response range from the interrupter. We did this using a potentiometer and voltmeter simultaneously, an approach that let us vary the circuit's resistance constantly until the desired voltage range was found. If you were to use any different IR interrupter, it would be necessary to go through a similar process to find the right resistor value for that interrupter.

The interrupter's LED emitter is rated at 1.2V and 0.03A. It would burn out if we wired it directly to the 5V terminal, so we'll need to limit the amount of current reaching it. To determine the necessary resistor value, we used Ohm's Law.

V(voltage) = I(current) x R(resistance)

5V = .03A x R

5/.03 = R

R = 166

We used a resistor slightly lower than the equation dictates because the LED will have some resistance that will make up the correct total. The exact resistance is not too critical.

 

Wiring the LED emitter

Connect a 150 resistor to the anode lead of the interrupter's LED post. The anode is the lead most directly below the letter N on the interrupter's Omron logo. The other end of the resistor wil connect to the +5V terminal. This step is represented with red wiring in figure 3.

Then connect the cathode (the lead next to the anode) to ground. Refer to the black wire in figure 3.


fig. 3: LED wiring

The infrared light the LED emits is invisible to the naked eye, however, if you have an infrared sensor card, you can use it to see if the LED portion of the interrupter is working. Connect the wires as directed in figure 3, power up the Teleo module, and hold the detector card between the two posts of the interruptor. A red glow should appear on it.

 

Wiring the Phototransistor Collector

Connect the collector lead of the photoresistor to ground either by splicing it into the black ground wire for the LED or directly connecting it to the Gnd terminal. The collector lead is the one directly across from the LED anode, and diagonal to the LED cathode.


fig. 4: phototransistor wiring

Now connect the emitter of the photoresistor to one end of the 1 k resistor, and then connect a wire from a digital in to the same end of the resistor. These steps are depicted using yellow wire in figure 4. Then connect the other end of the resistor to the +5V terminal. Once these steps are done, you are ready to use the interrupter and Teleo modules in conjunction with your computer.

 

A Max Patch Using an IR Interrupter


fig. 5: max patch

The box in the bottom left will receive a 0 or 1 depending on whether the IR beam is interrupted. These values can be reversed by checking the box in the top right. The object in the bottom left can then be connected with an object like trigger (simply 't' in Max) to set off a chain of events.

Flash Code Using An IR Interrupter Sensor

Objective
Control Flash with digital input from the IR interrupter sensor through an Intro Module.

How To
1. Be sure your Teleo module and the IR interrupter sensor are properly connected.

2. Run the Teleo XML server. Check the user guide for more information.

3. Create a Flash movie.

4. Insert the code found below into the Action Window in the first frame of a new layer called "Actions". The lines following "//" symbols are comments, which are ignored when the code is run but can help the coder keep track of what certain lines of code mean.

5. Run the movie, then interrupt the IR beam at will. In the Output Window, notice how the "New Digital In Value" changes in response.

Code   
//import the MakingThings Class Libraries 
import com.makingthings.*;
   
//create a new Intro Digital In object
var din:TIntroDin = new TIntroDin( 0 );
   
//read the digital input value each time it is changed
din.onValue = function( value:Number)
{
      //display the current digital in value in a separate output window
      trace("New Digital In Value: " + value);
      //now do something useful with the value
 }

Using the Digital in vs. Analog in

In general, an analog voltage source should not be connected to a digital input. The reason is that the there are two transistors in the input circuit of a digital input. One connects the next stage to+5V, the other connects it to Gnd. When a digital "1" (+5V) appears on the input, the transistor to the +5V turns on. Conversely, when a "0" (0V) appears on the input, the transistor connected to Gnd turns on. Now you might see the danger of applying an intermediate voltage - i.e. 2.5V: if both transistors are half on there's a path directly from +5V to Gnd - a short circuit. This can damage the transistors involved and disrupt other circuitry.

It is permissible to use this IR interrupter with our digital in because we've chosen the surrounding components to make it most likely to provide values close to 0 and 5V (corresponding to the beam being blocked vs. there being no obstruction). A Schmitt trigger would be necessary for any other circumstance where a variable voltage is fed to a digital in.

Project Ideas Using an IR Interrupter

Working Prototype Printer
The printer senses when paper is inserted into it using the IR interrupter, which triggers a feeder mechanism to activate and pull the paper through.

Holster Detector
The interrupter can be embedded into a sheath to detect when an object is placed in it or removed.

Notched Disc Reader
A spinning disc with holes notched into its rim can be spun through the interrupter to produce a unique and repeatable pattern of signals that can be fed into a Max patch or other software

 

copyright © 2002-2004 MakingThings LLC