IR sensor doesn't work if I increase the LED luminosity

Hi everybody, I'm trying to build a IR reflective proximity sensor.

Here you can find the circuit layout and the code: https://123d.circuits.io/circuits/1998125-ir-led-sensor/

To pulse the led at 38khz (the IR receiver has a Band-pass filter) I'm using a TIP120. It's a bit overkill for this application, but that's what I had at home :)

The IR LED I'm using has a Continuous Forward Current of 100mA. (https://cdn-shop.adafruit.com/datasheets/IR333_A_datasheet.pdf)

The Forward Voltage is around 1.6V so: R = (5 - 1.6) / 0.1 = 34 I used a 39 ohm resistor

The sensor doesn't seem to sense the light even if I can tell the LED is on (my phone's camera detect a bit of IR light). BUT, if I use a 220 ohm resistor it works, although the sensor is not very sensitive.

I measured the current in the LED: With the 220 ohm resistor it's around 7mA (I was expecting 15, but I guess as I'm pulsing the led with a 50% DC, 7 is correct) With the 29 ohm resistor it's around 33mA

I don't know why the sensor is not working with the 39 ohm resistor, I guess there could be some transient somewhere (the TIP120 maybe?) and the LED doesn't blink at 38khz..

Any ideas??

Thanks you in advance :)

if I use a 220 ohm resistor it works, although the sensor is not very sensible.

What does it do, wear a silly hat? Or you could mean the word sensitive instead.

That circuit is crap. There is no decoupling capacitor or resistor on the sensor. In fact I can't tell what sensor it is as there is no part number attached. So take the sensor you are using, look up the data sheet and apply the decoupling circuit it tells you to use.

Edit:- There is no resistor in the base of the TIP120 either.

Where is the code for this?

The sensor appears to have 4 connections.

Never seen one like that.

If i could find a cute puppy pic this would go to bar sport.

Your circuit should work, even with more reduced LED current. For currents below 40mA you can omit the transistor, and power the LED from a digital output and the current limiting resistor.

You also may try various (alternating) currents, from e.g. 2 digital outputs with different resistors. Then you can send with either current, or their sum or difference, depending on whether you pulse one or both outputs, or make one an input (not affecting current). This could give a better distinction of near-by or far away objects.

Lacking a circuit diagram, do you power the sensor with the proper voltage? Mine (YL-55 module) require 3.3V, don't work on 5V.

Grumpy_Mike: What does it do, wear a silly hat? Or you could mean the word sensitive instead.

English is not my first language. Apologies

Grumpy_Mike: That circuit is crap.

Thanks!

Grumpy_Mike: There is no decoupling capacitor or resistor on the sensor. In fact I can't tell what sensor it is as there is no part number attached. So take the sensor you are using, look up the data sheet and apply the decoupling circuit it tells you to use.

Edit:- There is no resistor in the base of the TIP120 either.

this is the sensor: https://cdn-shop.adafruit.com/datasheets/tsop382.pdf I already used it in another project to decode remote signals and it worked perfectly without decoupling. Also I found other tutorials for that sensor and they are not using decoupling either.

Grumpy_Mike: Edit:- There is no resistor in the base of the TIP120 either.

I actually had a 10k resistor in the base of the TIP120, but I removed it after I saw this: http://www.arduino.cc/en/Tutorial/TransistorMotorControl

Grumpy_Mike: Where is the code for this?

int led = 13;
int IRled = 2;
int sensor = 3;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  pinMode(IRled, OUTPUT);
  pinMode(sensor, INPUT);
  noInterrupts();
}

// the loop routine runs over and over again forever:
void loop() {
    // 38 kHz is about 13 microseconds high and 13 microseconds low
   digitalWrite(IRled, HIGH);  // this takes about 3 microseconds to happen
   delayMicroseconds(11);         // hang out for 10 microseconds, you can also change this to 9 if its not working
   digitalWrite(IRled, LOW);   // this also takes about 3 microseconds
   delayMicroseconds(9);
   
   digitalWrite(led, digitalRead(sensor));
}

DrDiettrich: Your circuit should work, even with more reduced LED current. For currents below 40mA you can omit the transistor, and power the LED from a digital output and the current limiting resistor.

You also may try various (alternating) currents, from e.g. 2 digital outputs with different resistors. Then you can send with either current, or their sum or difference, depending on whether you pulse one or both outputs, or make one an input (not affecting current). This could give a better distinction of near-by or far away objects.

Lacking a circuit diagram, do you power the sensor with the proper voltage? Mine (YL-55 module) require 3.3V, don't work on 5V.

The sensor (TSOP38238) works with supply voltages from 2.5 V to 5.5 V. I'm powering everything with the 5v of the arduino: https://123d.circuits.io/circuits/1998125-ir-led-sensor/

The circuit IS working with the 220 ohm resistor, but It's not with the 39 ohm. I wanted to use the 39 ohm to have 100mA in the LED and get a more sensitive sensor.

The sender current depends on what you consider “sensitive”. The higher the current, the more reflections will arrive from more distant objects. How do you test the “sensitivity”?

I think we can agree that with a smaller resistance and therefore a brighter LED the sensor will sense more distant objects / darker object.

I just want to understand why everything works with the 220 ohm resistor and doesn’t with the 39 ohm.

A bright light may overload the receiver.

I think you are getting bitten by something I ran into a while back. Some sensors are designed for continuous signals (at the correct frequency), others only work properly if the signal is modulated (say a 1khz modulation of the 38khz gated). The following from the data sheet seems to confirm my suspicion:

Some examples of disturbance signals which are suppressed are:
• DC light (e.g. from tungsten bulb or sunlight)
• Continuous signals at any frequency
• Strongly or weakly modulated noise from fluorescent lamps with electronic ballasts
(see figure 15 or figure 16

OK this looks like it is going to be a long haul because everything about this project is wrong.

First the good news that the thing you complain of in the title of the post can be cured by simply fitting a tube over the IR emitter and another one over the receiver. The problem is light spillage at the side of the emitter.

Now for your real problems:-

emanuele: I already used it in another project to decode remote signals and it worked perfectly without decoupling. Also I found other tutorials for that sensor and they are not using decoupling either.

Look at page 1 of the data sheet for that sensor at the Application circuit, that shows what you need. I couldn't give a flying fig what you find on the internet, there is a lot of crap out there, you can even find people saying the Earth is flat, because it is on the internet doesn't make it true. I also don't care that you have made something which you claim functions without it, those components are needed for proper operation. You probably don't have the test equipment to see it is going wrong. Do not confuse functionality with correctness.

I actually had a 10k resistor in the base of the TIP120

Probable too high use a 1K and put it back.

but I removed it after I saw this: http://www.arduino.cc/en/Tutorial/TransistorMotorControl

Sadly there are a lot of errors on this site too, the people who wrote that do not know what they are doing, they are educators not engineers. It is one of the things we have been trying to change for years but to no avail.

Finally gpsmikey is correct, that sensor is not designed for continuous pulsing, if you want one that is then you need the TSOP 4038. Look at page 5 of that data sheet. Look at the table at the bottom of the page that tells you about the maximum number of data bursts you can have. When you exceed this the output stops responding.

Thanks gpsmikey and Grumpy_Mike, you are right, this sensor is not designed to receive a continuos burst.

I should probably use a different sensor, but out of curiosity I want to try to add a 10 cycles delay every 70 cycles as they suggest in the table at page 5 (or 12 every 60, just to be safe).

Edit: I didn't see this: Maximum number of continuous short bursts/second = 1800 So even if I add a 10 cycles delay it won't work :(

FYI: The TSSP4038 would be a good IR Receiver for this application.

AnalysIR: FYI: The TSSP4038 would be a good IR Receiver for this application.

As I said in reply #10

Make sure which one you get - for the TSSP4038, the 3rd character indicates useage (see the data sheet for options). "O" = IR receiver applications, "M" is for repeater/learning applications and "S" is for Sensor applications.

emanuele: Hi everybody, I'm trying to build a IR reflective proximity sensor.

Why not just buy a ready-made one that works. I have recently got some QRE1113 devices which seem to work very well - just needs 2 resistors.

...R