PDA

View Full Version : TSOP1738 versus PNA4602?



ra68gi
- 13th May 2006, 17:45
Hi Guys,
Ihave been constructing IR object detector for my robotic projects. Iam using
TSOP1738 IR receiver module to receive the reflected IR signal. Iam using a 555 IC to generate the 38Khz carrier signal. I first used the carrier signal to fire the IR LEDs directly without any modulating data. I did'nt receive any signal at the 3rd pin of the tsop1738. Later i modulated the carrier with data generated by the PIC16F84. I could immediately read the low output in pin3 of TSOP. I made a LED to light when it detected an object. It worked fine so far, but when i tried to move my hand very slowly in front of the detector it did not detect my hand. If i moved my hand fast or switch off & on the power supply it detected my hand.
I found that the TSOP does not respond to unmodulated carrier signal,also i found it to reject signals that has a constant periodicity or frequency.
I inserted a pause 250 in the program after every 30 counts of reading the TSOP and it worked fine.
My questions are
1) Is there a better way then to pause for such a long period. (my Robot is not expected to do anythig that fast so there is no problem).
2)can any one say if PNA4602M is better choice and is deviod of the above mentioned problems.
3)Will i also face the same problem if i tried serial ir communication(N2400 bauds) with out a pause.
It will be great if Bruce (Proprietor Rentron) can throw some light on this.
Thanks.
Raghunathan.

Archilochus
- 13th May 2006, 19:50
If I remember right, the TSOP has an AGC circuit, so you can not send continuous unmodulated carrier (which you discovered by experiment - it's also buried in the data sheet somewhere).

Never played around with the PNA4602M - but the TSOP series seems to have the lowest power consumption (or at least it did several years back) - so that might be an issue.

Arch

Bruce
- 13th May 2006, 22:55
For object detection you don't really need to send any data. Just turn ON the carrier, pause for a minimum of 10 cycles (or whatever time the data sheet indicates as minimum burst period), sample the detector output, and turn the carrier back OFF.

Don't turn the carrier on and leave it on. The detector will assume the continuous carrier signal is noise, and ignore it.

The TSOP brand is much better than the Panasonic, but they will both fail if you leave the carrier on for long periods, or if you do not provide a carrier burst long enough to meet the minimum burst period.

Look at the TSOP17xx data sheet in the Suitable Data Format section.

Turn the carrier on for a minimum of 10 cycles per burst, sample the detector output, then turn the carrier off.

These types of IR modules are designed to ignore carrier bursts that are too short, and continuous bursts. It assumes these signals are noise.

Also, it's important that you're using an IR LED matched for the detector. For the PNA4602M & TSOP1738 you'll want an IR LED with a wavelength of ~940nm. This is the peak spectral sensitivity region of these detectors. Using one that's way off the wavelength of your detector, you will definitely see odd results. If it works at all.

For object detection where the LED is located in close proximity to the detector, use a large value series resistor, and cover the LED with heat shrink or some material the blocks side emissions from the LED to detector. That will help.

ra68gi
- 14th May 2006, 10:59
Hello Bruce,
The TSOP17.. data sheet places the following conditions:
1) Carrier frequency should be close to center frequency of the bandpass(eg.38Khz).
2) Burst length should be 10 cycles/burst or longer.
3) After each burst which is between 10 cycles and 70 cycles a gap time of atleast 14 cycles is necessary.
4)For each burst which is longer than 1.8ms a corresponding gap time is necessary at some time in the data stream. This gap time should have at least same length as the burst.
5) Up to 1400 bursts per second can be received continuously.

I wish to write here my code for the ir sensor which iam using for my robots eye.
Iam using 3 IR leds and 3 TSOP1738 for left, center & right eye. Iam using a 555 to generate a 38Khz carrier signal which is connected to the 3 IR leds via a transistor whose base is controlled by portb.0 of pic16f84. The pin connections and code are as follows.

'RB0 -Transistor base driving IR leds
'RB1-LEFT TSOP 3RD PIN
'RB2-CENTER TSOP 3RD PIN
'RB3-RIGHT TSOP 3RD PIN
'RB6-INDICATION LED FOR LEFT OBJECT DETECTED
'RB5-INDICATION LED FOR CENTER OBJECT DETECTED
'RB4-INDICATION LED FOR RIGHT OBJECT DETECTED
'PIN1 OF TSOP-GND, PIN2-Vss

B0 VAR BYTE
LEFT_COUNT VAR BYTE
CENTER_COUNT VAR BYTE
RIGHT_COUNT VAR BYTE
IR_LEFT VAR BYTE
IR_RIGHT VAR BYTE
IR_CENTER VAR BYTE

TRISB=%00001110
PORTB=0

MAIN:
PAUSE 100
GOSUB SEE
IF IR_LEFT=1 THEN
PORTB.6=1
ELSE
PORTB.6=0
ENDIF
IF IR_CENTER=1 THEN
PORTB.5=1
ELSE
PORTB.5=0
ENDIF
IF IR_RIGHT=1 THEN
PORTB.4=1
ELSE
PORTB.4=0
ENDIF

SEE:
LEFT_COUNT=0
CENTER_COUNT=0
RIGHT_COUNT=0
IR_LEFT=0
IR_CENTER=0
IR_RIGHT=0

FOR B0=0 TO 30
PORTB.0=1 'Switch on the transistor connected to IR leds.
PAUSEUS 290 ' burst time as specified by data sheet
IF PORTB.1=0 THEN 'Read TOSP
LEFT_COUNT=LEFT_COUNT+1
ENDIF
IF PORTB.2=0 THEN
CENTER_COUNT=CENTER_COUNT+1
ENDIF
IF PORTB.3=0 THEN
RIGHT_COUNT=RIGHT_COUNT+1
ENDIF
PORTB.0=0 'Swith off transistor connected to IR leds.
PAUSEUS 390 'time gap between bursts as specified by data sheet.
NEXT B0

IF LEFT_COUNT>=15 THEN 'take average to get flicker free or schmitt trigger
IR_LEFT=1 'like clean output at the output pin RB6
ENDIF

IF CENTER_COUNT>=15 THEN
IR_CENTER=1
ENDIF

IF RIGHT_COUNT>=15 THEN
IR_RIGHT=1
ENDIF
RETURN

Bruce, when i compiled the above program it worked fine.
But if i change the pause 100 to any where less than 50 in the code just belo
label main the detector does not detect properly. It ony detects fast movements & not slow moving objects as i mentioned earlier.
Can you please let me if iam violating any of the data sheet conditions of TSOP.
Raghunathan.

Bruce
- 14th May 2006, 14:54
Hi Raghunathan,

Yor code looks fine for the IR detector, but when program execution reaches
the end of Main, it will fall-through to the lower sub routines, land on RETURN,
and eventually crash since no valid return address has been pushed on the
stack.

Place a GOTO Main at the end of Main.

ra68gi
- 14th May 2006, 15:59
Bruce,
sorry it was my mistake in copying the code here. my original code did have the goto main at the end. For the convenience of those interested in this code i shall rewrite it here.

Please answer my question as to what happens when the pause is reduced below 50ms.

'RB0 -Transistor base driving IR leds
'RB1-LEFT TSOP 3RD PIN
'RB2-CENTER TSOP 3RD PIN
'RB3-RIGHT TSOP 3RD PIN
'RB6-INDICATION LED FOR LEFT OBJECT DETECTED
'RB5-INDICATION LED FOR CENTER OBJECT DETECTED
'RB4-INDICATION LED FOR RIGHT OBJECT DETECTED
'PIN1 OF TSOP-GND, PIN2-Vss

B0 VAR BYTE
LEFT_COUNT VAR BYTE
CENTER_COUNT VAR BYTE
RIGHT_COUNT VAR BYTE
IR_LEFT VAR BYTE
IR_RIGHT VAR BYTE
IR_CENTER VAR BYTE

TRISB=%00001110
PORTB=0

MAIN:
PAUSE 100
GOSUB SEE
IF IR_LEFT=1 THEN
PORTB.6=1
ELSE
PORTB.6=0
ENDIF
IF IR_CENTER=1 THEN
PORTB.5=1
ELSE
PORTB.5=0
ENDIF
IF IR_RIGHT=1 THEN
PORTB.4=1
ELSE
PORTB.4=0
ENDIF
GOTO MAIN

SEE:
LEFT_COUNT=0
CENTER_COUNT=0
RIGHT_COUNT=0
IR_LEFT=0
IR_CENTER=0
IR_RIGHT=0

FOR B0=0 TO 30
PORTB.0=1 'Switch on the transistor connected to IR leds.
PAUSEUS 290 ' burst time as specified by data sheet
IF PORTB.1=0 THEN 'Read TOSP
LEFT_COUNT=LEFT_COUNT+1
ENDIF
IF PORTB.2=0 THEN
CENTER_COUNT=CENTER_COUNT+1
ENDIF
IF PORTB.3=0 THEN
RIGHT_COUNT=RIGHT_COUNT+1
ENDIF
PORTB.0=0 'Swith off transistor connected to IR leds.
PAUSEUS 390 'time gap between bursts as specified by data sheet.
NEXT B0

IF LEFT_COUNT>=15 THEN 'take average to get flicker free or schmitt trigger
IR_LEFT=1 'like clean output at the output pin RB6
ENDIF

IF CENTER_COUNT>=15 THEN
IR_CENTER=1
ENDIF

IF RIGHT_COUNT>=15 THEN
IR_RIGHT=1
ENDIF
RETURN
Raghunathan.

Bruce
- 14th May 2006, 17:15
Please answer my question as to what happens when the pause is reduced below 50ms.

My guess would be you're violating rule #5 you show above.

When you reduce the pause time between jumps to your carrier generation
routine below 50mS, how many bursts are you sending in 1 second period?

ra68gi
- 15th May 2006, 04:05
Bruce,
Let me do the math here.

Carrier frequency on time= 290us pause time+30us(roughly to read the pins)
That equals-320us
Gap time after each burst=390us

Total time period=320+390=710us
This data stream is looped 31 times using for next,so total time=710*31=22010us=22ms

Number of data burst is 31 bursts per 22ms
so for 1sec its (31/22)*1000 = 1409bursts

am i right Bruce?

That means i should use pause time of more than 22ms to make the circuit function properly.
Raghunathan.

Bruce
- 15th May 2006, 18:04
I would factor in the time from Main & back.

Run it through MPLAB sim with the stopwatch. Set a break point on Main. Single
step down to Main, clear the Stopwatch, and hit run. The time it takes from
Main & back is the time it takes to complete one full loop & emit 31 bursts.

If you're within the timing specs shown in the data sheet, and it's not working
as expected, then it's most likely something else like ambient lighting, circuit
noise, other components, etc, etc,.

A lot of things affect results with IR, and the data sheet is just a guide. Specs
shown in most data sheets are derived under optimum laboratory conditions for the
part under test.

You'll normally need to make adjustments based in your own particular operating
environment, parts used, final design, and a host of other factors.

With 3 IR LED's all being fired at once, and 3 IR detectors, it's possible that
you have enough bleed over to influence all 3 detectors at once. Even when an
object isn't in front of an LED/detector pair.

At any rate, I wouldn't try pushing it right up to the limits in a data sheet, and
expect it to work continuously. If my car can go 160mph max I'm not going to drive
everywhere I go at that speed...;o}

narendra
- 4th January 2009, 12:21
Hi Guys,
Ihave been constructing IR object detector for my robotic projects. Iam using
TSOP1738 IR receiver module to receive the reflected IR signal. Iam using a 555 IC to generate the 38Khz carrier signal. I first used the carrier signal to fire the IR LEDs directly without any modulating data. I did'nt receive any signal at the 3rd pin of the tsop1738. Later i modulated the carrier with data generated by the PIC16F84. I could immediately read the low output in pin3 of TSOP. I made a LED to light when it detected an object. It worked fine so far, but when i tried to move my hand very slowly in front of the detector it did not detect my hand. If i moved my hand fast or switch off & on the power supply it detected my hand.
I found that the TSOP does not respond to unmodulated carrier signal,also i found it to reject signals that has a constant periodicity or frequency.
I inserted a pause 250 in the program after every 30 counts of reading the TSOP and it worked fine.
My questions are
1) Is there a better way then to pause for such a long period. (my Robot is not expected to do anythig that fast so there is no problem).
2)can any one say if PNA4602M is better choice and is deviod of the above mentioned problems.
3)Will i also face the same problem if i tried serial ir communication(N2400 bauds) with out a pause.
It will be great if Bruce (Proprietor Rentron) can throw some light on this.
Thanks.
Raghunathan.

....

hi Raghunathan,
can u please help me how u people overcome those problems mentioned above.i am also getting same problems.
as i am working to get the same result.
thanks.
narendra