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.




Bookmarks