Go Down

Topic: TSSP4038 (Read 3136 times) previous topic - next topic

darkgiuseppe

Hello all.

I want to get a light barrier going for simple tripping when an object breaks the beam. I have never had a project with IR but I do understand that the TSSP4038 I am using can be used for CW 38kHz. Thing is, I  am not sure if my receiver is working. From my understanding, when there is no light, the output pin should go high, and when there is CW, it should go low. But in my case, it is always low.

I was thinking that there may be ambient noise so I covered the lens with my finger and even turned my lights off and I still read a low. Am I missing something obvious?

Here is a datasheet of my receiver http://www.vishay.com/docs/82458/tssp40.pdf

Need parts? Check out my new store! http://centipedestudio.com
Happy making!

Wawa

#1
Jul 20, 2016, 05:10 am Last Edit: Jul 20, 2016, 08:03 am by Wawa
A 3-pin IR receiver is designed to ignore ambient (static) light.
It only detects modulated light. 38kHz for the TSSP4038.
An Arduino can generate that frequency, and drive an IR LED with an output pin.
See example sketch.
Leo..
Code: [Select]
const byte IR_LED = 11; // IR transmitter LED with 100ohm (minimum) CL resistor
const byte IR_Receiver = 8; // from receiver output
const byte onboard_LED = 13; // onboard indicator LED
boolean receiverState;

void setup() {
  pinMode (onboard_LED, OUTPUT);
  pinMode (IR_LED, OUTPUT);
  pinMode (IR_Receiver, INPUT);
  // from Nick Gammon
  TCCR2A = _BV (COM2A0) | _BV(WGM21);
  TCCR2B = _BV (CS20);
  OCR2A =  209; // ~209 = ~38kHz | ~219 = ~36kHz
}

void loop() {
  receiverState = digitalRead (IR_Receiver);
  if (receiverState == HIGH) { // beam interrupted
    digitalWrite(onboard_LED, LOW); // green onboard LED off
    delay(1000);
  }
  else { // beam detected
    digitalWrite(onboard_LED, HIGH); // green LED on
  }
}

Chagrin

That receiver can be affected by bright light (direct sunlight) but typical indoor lighting should not cause a problem.

I suggest you swap out the IR LED with a white or red LED just so you can see it. You won't get the range of an IR LED but still a few meters of distance which is more than enough when you're testing.

darkgiuseppe

I guess I should post a schematic tonight to show what I mean with some pictures of my setup.

I do understand that I need modulated light. I am achieving this with a 555 timer. I have not gotten to my Arduino part yet since I cannot measure with my multi-meter a HIGH or a LOW from the output of the TSSP4038. I have verified that there is indeed a modulated signal from my 555 timer going into my IR LED. I used an old flip phone camera to see the light.

So to reiterate, with NO light, the output should be HIGH right? All I measure is a LOW. And by trying to eliminate ambient light, I covered the lens with my thumb and completely blocked out any incoming light and I still do not measure a HIGH. I thought maybe I had a dud part (I think unlikely) and swapped it and still got nothing.

Let me post some pics tonight to show what I mean. Thanks for the replies so far.
Need parts? Check out my new store! http://centipedestudio.com
Happy making!

Grumpy_Mike

Figure 3 of that data sheet shows that with no light input the output of that chip will be low, not high.

raschemmel

Quote
Figure 3 of that data sheet shows that with no light input the output of that chip will be low, not high.
low = no 38 kHz CW , right ? (as opposed to continuously on light)

Grumpy_Mike

Yes, it will not respond to continuous light at all. That is the whole point of a tuned amplifier.

Wawa

Figure 3 of that data sheet shows that with no light input the output of that chip will be low, not high.
Confusing diagram.
The pulses and the square wave are not lined up.
It starts with no pulses and a HIGH though.

The receivers I have used were normally HIGH.
Leo..

Grumpy_Mike

Quote
The pulses and the square wave are not lined up.
That is because they are not.
There is a delay between incident light and the output responding.

Quote
The receivers I have used were normally HIGH.
That means nothing, the data sheet for a device tells you how that device works.

Wawa

This might help OP.
https://learn.sparkfun.com/tutorials/ir-communication
TSSOP382 though (normally HIGH).
Leo..

Chagrin

Figure 3 of that data sheet shows that with no light input the output of that chip will be low, not high.
You're misinterpreting that figure in the datasheet, although I can't blame you for doing so -- datasheets shouldn't require you to use a straightedge to see that the pulses are slightly offset. Vishay has an app note that states what it is trying to say:

Quote
What this figure says is that the length of the output pulse is guaranteed to be greater than the length of the input burst less five cycles of the carrier frequency, and less than the length of the input burst plus six cycles of the carrier frequency
The output signal is low for 5 or 6 cycles after the the minimum signal (7 pulses) dissappears. So what you're seeing is that lag time in the receiver's output (active low) pulse.

7/f0 < td < 15/f0 "for a signal between 7 and 15 pulses..."
tpi - 5/f0 < t po < tpi + 6/f0 "...output will be on (active low) for a period of time greater than 5 pulses but less than 6 pulses"

Summary: Output is HIGH when no signal is received, LOW after at least 7 pulses received, and stays LOW for at least 5/38000 of a second after the signal disappears.

darkgiuseppe

Okay attached are my waveforms from my 555 timer. One is with no load and then the other is on the anode of the LED. Looks normal.

Grumpy_Mike, when I look at the block diagram (page 1), out of the demodulator section to the base of the BJT, I would expect a 38kHz CW to go LOW and with no light at all, the output should be HIGH. Am I wrong to think the opposite as you suggested?

My receiver and LED share the same power rails. I have bypass caps on my power lines and near my timer including my receiver but I decided to probe the power rail anyway.... and boy it looks bad. So I sprinkled the power rails with lots of 0.01uF caps and even though it got better, it still looked bad (this is also attached). I decided to just power off the 555 timer and voila! The output of the receiver now outputs a HIGH.

I think I am going to test further tomorrow by having the LED run on a battery and the receiving end by the Arduino. Just completely isolate it and see what happens.

I will let you guys know the result and hopefully this helps anybody else out in the same situation.
Need parts? Check out my new store! http://centipedestudio.com
Happy making!

Wawa

I want to get a light barrier going for simple tripping when an object breaks the beam.
What distance are we talking about.
I made a 5meter light barrier once with a Cmos 555 and a narrow beam LED that ran ~100hours on two NiCad batteries (2.5volt).

I guess I should post a schematic tonight to show what I mean with some pictures of my setup.
Yep, that would help. Your scope screens are sort of meaningless without it.
Leo..


darkgiuseppe

What distance are we talking about.
I made a 5meter light barrier once with a Cmos 555 and a narrow beam LED that ran ~100hours on two NiCad batteries (2.5volt).
Yep, that would help. Your scope screens are sort of meaningless without it.
Leo..


Right, I have one made it up on paper but I would be embarrassed to throw this up as it is very messy. I will redraw them and post.
Need parts? Check out my new store! http://centipedestudio.com
Happy making!

darkgiuseppe

Okay so I actually got everything figured out. It was a case of really bad power supply noise and not having enough bypass/ decoupling capacitance. For anyone else who comes across this thread needing something similar her are some design sources:

555 timer calculator:
http://houseofjeff.com/555-timer-oscillator-frequency-calculator/


Alternate TSSP4038 datasheet:
http://www.hackerstore.nl/PDFs/IROntvanger.pdf
The first one I had is still fine but is like a general datasheet for two different types of carrier freqencies. This one here shows just the TSSP4038 and shows the suggestion of using a low pass filter for the input voltage.

As for the schematic, it is attached. Thanks to all who replied and gave their input.
Need parts? Check out my new store! http://centipedestudio.com
Happy making!

Go Up