Go Down

Topic: Infrared sensor - I am lost (Read 1 time) previous topic - next topic

Colin

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


Colin

The first resistor is 280Ohm

The second is 1K ohm.

mem

#2
May 08, 2008, 07:45 pm Last Edit: May 08, 2008, 07:46 pm by mem Reason: 1
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.

Oracle

#3
May 08, 2008, 08:23 pm Last Edit: May 08, 2008, 08:25 pm by Oracle Reason: 1
Is this the item you're using? http://www.radioshack.com/product/index.jsp?productId=2049723&cp=&sr=1&origkw=ir+emitter&kw=ir+emitter&parentPage=search

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?

#4
May 08, 2008, 09:13 pm Last Edit: May 08, 2008, 09:15 pm by bens Reason: 1
Quote
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

Colin

Yes! It worked. Thanks for the advice.

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

Colin.

Oracle

Quote

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.

Go Up