Infrared sensor - I am lost

So, I'm trying to build a unit with twelve infrared sensors using radioshack paired emitters and phototransmitters. I have a arduino that will be reading on/off from the pins and then generating a midi signal up to a controller.

To prototype I built the following two circuits

5V ----- //// ---- emitter ---- LED ---- Gnd (LED stays on so we're getting power)

5V ---- //// -- photransister --- LED --- Gnd (LED never comes on)

The emitter is rated to 5V 150ma and I'm in spec. I did have two of them where the smoke came out as I miswired this very easy circuit.

HELP! What on earth am I doing wrong? It's driving me screwy.

Colin

The first resistor is 280Ohm

The second is 1K ohm.

Try it with the phototransistor connected to an arduino input pin. Take the LED out of the circuit and connect it up like this:

5V ---- //// -- wire to Arduino input pin---- phototransister --- Gnd

Run one of the switch test sketch's, the wire to the phototransistor will act like a switch and make the digitalRead go low and high as IR light level reaches the correct level for the phototransistor.

Is this the item you're using? RadioShack.com Official Site - America's Technology Store

It says the emitter is 2V, 40mA. Assuming about 2V for your LED, you have 1 volt dropped across the resistor, which means you have 3.6mA through the LEDs (using ohm's law and kirchoff's current law). I would imagine the visible LED is fairly dim, and the IR LED is even dimmer.

Edit: This might be a stupid question but are you sure you have the polarities right on the IR components and don't have the emitter and detector reversed?

Try it with the phototransistor connected to an arduino input pin. Take the LED out of the circuit and connect it up like this:

5V ---- //// -- wire to Arduino input pin---- phototransister --- Gnd

Run one of the switch test sketch's, the wire to the phototransistor will act like a switch and make the digitalRead go low and high as IR light level reaches the correct level for the phototransistor.

In picture form, you want to wire your emitter/phototransistor circuit something like:

You'll want to tweak the two resistor values to achieve the ideal response curve for your particular emitter-detector pair.

  • Ben

Yes! It worked. Thanks for the advice.

It's very sensitive to ambient light. I need to tweak my resistors some I guess.

Colin.

It's very sensitive to ambient light. I need to tweak my resistors some I guess.

They way commerical remote controls solve this is when they want the LED to be "on" they strobe it on and off and around 40kHz. When they want it off, it's just off.

Then the receiver filters out everything that is not strobing at around 40kHz, and since ambient light doesn't strobe like that, it is ignored.