Author Topic: IR reciever TSOP1138 help  (Read 1862 times)

0 Members and 1 Guest are viewing this topic.

Offline Jak24Topic starter

  • Full Member
  • ***
  • Posts: 96
  • Helpful? 0
IR reciever TSOP1138 help
« on: December 01, 2012, 02:23:50 PM »

I am a Robocup Junior soccer competitor,
http://rcj.robocup.org/soccer.htm
and I am currently in the process of selecting my ball sensor.
(The ball is an IR ball which emits pulsing infrared light.)
Now I found this article :
http://rcj.robocup.org/rcj2009/newball/cheapRCJ05sensors-RobotDemos09.pdf
And I ordered the TSOP1138 and connected it as the circuit in the document says I should with
a 100k resistor and a 1uF cap to get an analog reading.
And I am not getting any readings back besides 0.
So I did some further research and it turns out the ball actually outputs 40 khz instead of 38 which the sensor is set at,
but I should get at least some readings right even with the 2khz difference?
And also I don't suppose it's an issue but the capacitor I have is 1uf and 16v, would that be an issue?
Any advise appreciated, or if any one could suggest a better IR receiver !

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: IR reciever TSOP1138 help
« Reply #1 on: December 01, 2012, 04:38:44 PM »
If the 40kHz LED is very close to the 38kHz sensor you might get a response but probably not. The receiver in those IR sensors are pretty good at discriminating against the wrong frequency. Look at the plot of response verse frequency in the data sheet to see.

Most makers of those sensors make them form different frequencies. Re-check the source for the correct sensor. A wild guess is that the part number will be: TSOP1140

In the mean time you could pulse on IR LED at 40kHz. A small processor (like a PIC12F509 or a AVR Tiny) would work. Then at least you can continue testing waile waiting for the 40kHz sensor.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: IR reciever TSOP1138 help
« Reply #2 on: December 01, 2012, 10:15:23 PM »
Hi,

[...] I ordered the TSOP1138 and connected it as the circuit in the document says I should with a 100k resistor and a 1uF cap to get an analog reading.
And I am not getting any readings back besides 0.
So I did some further research and it turns out the ball actually outputs 40 khz instead of 38 which the sensor is set at,
but I should get at least some readings right even with the 2khz difference?
And also I don't suppose it's an issue but the capacitor I have is 1uf and 16v, would that be an issue?

38kHz is only ~5% less than 40kHz (and the frequency tolerance, or precision, on the center frequency is 5%). Even if it wasn't, a 5% discrepency in the frequency still gets you at least 80% of the range and given a range of 10..20m or so, you should hardly see any difference.

With no signal reaching the receiver when you apply power, you should see the voltage at the cap climb to close to 5V in around 0.6s.

Depending on the distance from the ball, the output of the TSOP will have duty cycle steps of 24%, 36%, 48% and 60% - the closer you are, the higher the duty cycle and the lower the voltage on the capacitor (which can have any voltage rating greater than what's applied).
The voltages you should see with the 100kOhm/1F is roughly 3.6V, 2.9V, 2.3V and 1.7V, so if you see 0.000V, you either have a dead receiver or, more likely, you connected it wrong.
Here's the pin-out for reference:


Integrating the signal for an A/D reading is very slow, as the cap charges through both the 100kOhm resistor in series with an internal 25kOhm resistor and discharges through the 100kOhm. Making the cap 10 times smaller will speed it up 10 times, a little ripple will be present, but since you just need to discriminate few steps, this will help, but it's still a slow read in a soccer game..

You get the fastest reading by using the other method suggested - by timing the pulse duration, as there's no delay, just the direct timing of the duration: 200s, 300s, 400s or 500s - much faster (>1000 times) than waiting a bit over half a second for each read, or, if sped up with a 100nF cap, around 60ms.
Regards,
Sren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Jak24Topic starter

  • Full Member
  • ***
  • Posts: 96
  • Helpful? 0
Re: IR reciever TSOP1138 help
« Reply #3 on: December 02, 2012, 06:32:59 AM »
Thanks for the advise guys!

So turns out the two sensors I was working with were both duds.

Integrating the signal for an A/D reading is very slow, as the cap charges through both the 100kOhm resistor in series with an internal 25kOhm resistor and discharges through the 100kOhm. Making the cap 10 times smaller will speed it up 10 times, a little ripple will be present, but since you just need to discriminate few steps, this will help, but it's still a slow read in a soccer game..

You get the fastest reading by using the other method suggested - by timing the pulse duration, as there's no delay, just the direct timing of the duration: 200s, 300s, 400s or 500s - much faster (>1000 times) than waiting a bit over half a second for each read, or, if sped up with a 100nF cap, around 60ms.


Alright I'll try to get a smaller uf cap. But I would definitely need a analog output, because I'm not that great of a programmer and I wouldn't really know how to interpret the time durations .
Now as for the working sensors,
If they don't see the ball they output 1023 and If I turn the ball on literally no mater were I put the ball the reading is around 600-650.
Is this because the IR reflects all around my room?
If the 40kHz LED is very close to the 38kHz sensor you might get a response but probably not. The receiver in those IR sensors are pretty good at discriminating against the wrong frequency. Look at the plot of response verse frequency in the data sheet to see.

Most makers of those sensors make them form different frequencies. Re-check the source for the correct sensor. A wild guess is that the part number will be: TSOP1140

In the mean time you could pulse on IR LED at 40kHz. A small processor (like a PIC12F509 or a AVR Tiny) would work. Then at least you can continue testing waile waiting for the 40kHz sensor.

I'll definitely order a 40 khz sensor but at this point I would need one that is less sensitive, because so far atleast, no matter where I put it my room the reading is 600-650 until I turn it off.


Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: IR reciever TSOP1138 help
« Reply #4 on: December 02, 2012, 01:56:25 PM »
Hi,

Alright I'll try to get a smaller uf cap. But I would definitely need a analog output, because I'm not that great of a programmer and I wouldn't really know how to interpret the time durations .
Wouldn't that be a great opportunity to learn then? :)
Depending on which controller you use and what programming language, it may be as easy as usng in-built commands or library functions.


Now as for the working sensors,
If they don't see the ball they output 1023 and If I turn the ball on literally no mater were I put the ball the reading is around 600-650.
Is this because the IR reflects all around my room?
No, but perhaps you just have a small room ;D
Try a distance of say 5m to 10m.


I'll definitely order a 40 khz sensor but at this point I would need one that is less sensitive,
The 38kHz IR-receiver is a less sensitive 40kHz sensor you may say, so getting a 40kHz sensor will just increase the sensitivity issue.

You could lower the sensitivity by placing a colored filter in front of it.
Filter may sound technical, but test different varietys of colored plastic from candy wrap and similar. Yellow/orange will only filter a little, blue/green will filter much more. If one layer won't do it, try adding 2, 3 or more layers.



On second thought..
Your numbers indicates that the receiver picks up the first two stages of the output waveform (the full power and the 1/4 of full power.
Up close it should pick up the 1/16 and 1/64 of full power as well, so if it doesn't, sensitivity is not the issue and you'll have to look at other causes - like how good are your soldering skills, are you sure everything is connected correctly?

Do you have a ball (or the equivalent circuitry) to test with?
Regards,
Sren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Jak24Topic starter

  • Full Member
  • ***
  • Posts: 96
  • Helpful? 0
Re: IR reciever TSOP1138 help
« Reply #5 on: December 03, 2012, 04:21:42 AM »
Hi,

Alright I'll try to get a smaller uf cap. But I would definitely need a analog output, because I'm not that great of a programmer and I wouldn't really know how to interpret the time durations .
Wouldn't that be a great opportunity to learn then? :)
Depending on which controller you use and what programming language, it may be as easy as usng in-built commands or library functions.


Now as for the working sensors,
If they don't see the ball they output 1023 and If I turn the ball on literally no mater were I put the ball the reading is around 600-650.
Is this because the IR reflects all around my room?
No, but perhaps you just have a small room ;D
Try a distance of say 5m to 10m.


I'll definitely order a 40 khz sensor but at this point I would need one that is less sensitive,
The 38kHz IR-receiver is a less sensitive 40kHz sensor you may say, so getting a 40kHz sensor will just increase the sensitivity issue.

You could lower the sensitivity by placing a colored filter in front of it.
Filter may sound technical, but test different varietys of colored plastic from candy wrap and similar. Yellow/orange will only filter a little, blue/green will filter much more. If one layer won't do it, try adding 2, 3 or more layers.



On second thought..
Your numbers indicates that the receiver picks up the first two stages of the output waveform (the full power and the 1/4 of full power.
Up close it should pick up the 1/16 and 1/64 of full power as well, so if it doesn't, sensitivity is not the issue and you'll have to look at other causes - like how good are your soldering skills, are you sure everything is connected correctly?

Do you have a ball (or the equivalent circuitry) to test with?

I'm using the A/D converter with a 1uf cap when I get the 600-650 and with the straight readings I am only getting 0 and 1023 pulsating.
and if it doesn't see the light i get 1023 only.
I am using the ball, but I don't have any extra IR emitters to spare :P.
I'm 99% sure It's hooked up right, the only thing the could be bad Is the sensor or my arduino.
Any ideas?
« Last Edit: December 03, 2012, 08:48:40 AM by Jak24 »

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: IR reciever TSOP1138 help
« Reply #6 on: December 03, 2012, 07:12:38 PM »
Do you have access to an O'scope?
Use one to debug just the hardware part as in what is the sensor output really doing.

As to the ADC part. have you connected just a pot to ensure your code for the ADC is working correctly?

This is the 'divide and conquer' strategy. Debug and get each part working before trying them together.
« Last Edit: December 03, 2012, 07:14:58 PM by waltr »

Offline Jak24Topic starter

  • Full Member
  • ***
  • Posts: 96
  • Helpful? 0
Re: IR reciever TSOP1138 help
« Reply #7 on: December 04, 2012, 02:34:36 PM »
Do you have access to an O'scope?
Use one to debug just the hardware part as in what is the sensor output really doing.

As to the ADC part. have you connected just a pot to ensure your code for the ADC is working correctly?

This is the 'divide and conquer' strategy. Debug and get each part working before trying them together.


No I don't but I will try to get one :P
Also I tested it out with a pot and it works great.
So does any one have any suggestions for a less sensitive sensor, with a smaller viewing angle?
I was looking at a couple here but can't decide which:
http://www.digikey.com/product-search/en/sensors-transducers/optical-photo-detectors-phototransistors/1967049?k=photo
I was looking at the ones that were 950 nm, any advise is appreciated.

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: IR reciever TSOP1138 help
« Reply #8 on: December 04, 2012, 09:10:30 PM »
For sensitivity and angle, a dark piece of glass or plastic or tape and a hole cut out of a black piece of paper placed a few inches in front of the sensor works fine. If that's all you need, no need to spend money!
For accurate localization of an IR light source, a cheap webcam with the IR filter removed might work, although that requires a high-power (relatively speaking) computer device on board, such as a BeagleBone or Raspberry Pi.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: IR reciever TSOP1138 help
« Reply #9 on: December 04, 2012, 09:29:38 PM »
Hi,

Please don't quote an entire post. The purpose of quoting is to make it easy to know what you're responding to, so simply quoting it all makes no sense, as you have the entire post already.

I'm using the A/D converter with a 1uf cap when I get the 600-650 and with the straight readings I am only getting 0 and 1023 pulsating.
and if it doesn't see the light i get 1023 only.
What do you mean by "straight readings"? Is it without the cap? (That would make perfect sense of the numbers.


I am using the ball, but I don't have any extra IR emitters to spare :P.
Then you don't need spare emitters :)


I'm 99% sure It's hooked up right, the only thing the could be bad Is the sensor or my arduino.
Any ideas?
Yes I've got some ideas. Look at it logically.
You wrote that it works with a pot, so the Arduino works.
You get varying readings from the IR receiver, so the receiver works.
Ergo, the problem lies between the receiver and the Arduino
In other words, assuming the ball is working and in the right mode (check), I'm 99.999% sure, that you hit the 1% chance of errors in the hook-up ;)

Try a TV remote. Keep eg. the "Vol-" button pressed while reading the port, to see what numbers you get from that (If it's the Nec protocol, you'll only get the repeat code and this would integrate to a very low number).


I've attached a graph of how the ball is modulated which is easier to read tan the one in the .pdf you linked. Each square is horizontal 100s and vertical 1.40625mA (assuming 45mA at full power).
Remember, this only show the transmission from the ball. Any level that is picked up bu the receiver will result in its output transistor pulling low with equal force.

When no IR is registered, the cap is charged via the receivers internal pull up resistor (25k or 30k, dependant on manufacturing date) in series with the 100k resistor and while IR is received, the cap is discharged through the 100k resistor.

With no IR, the cap will reach the max voltage in 5*Tau => 5*130'000*0.000001 (seconds) = 650ms, while it will be discharged for either 24%, 36%, 48% or 60% of each period when IR is received.
(Tau is the R*C product).

EDIT: Due to my lousy wireless keyboard that eats batteries fast and typed characters most of the time :(
« Last Edit: December 04, 2012, 11:30:36 PM by Soeren »
Regards,
Sren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Jak24Topic starter

  • Full Member
  • ***
  • Posts: 96
  • Helpful? 0
Re: IR reciever TSOP1138 help
« Reply #10 on: December 07, 2012, 03:37:34 AM »
I'm using the A/D converter with a 1uf cap when I get the 600-650 and with the straight readings I am only getting 0 and 1023 pulsating.
and if it doesn't see the light i get 1023 only.
What do you mean by "straight readings"? Is it without the cap? (That would make perfect sense of the numbers.
Yes without the cap.
Try a TV remote. Keep eg. the "Vol-" button pressed while reading the port, to see what numbers you get from that (If it's the Nec protocol, you'll only get the repeat code and this would integrate to a very low number).
I get 0 and 1023 fluctuating with any button I press on my remote.
Also I'm ordering the other  "suggested sensors" mentioned in the document (GP1UX511QS) I'll let you know how that works out once it gets here.

 


Get Your Ad Here

data_list