TestFrequencyResponse.bs2
overlordx
Posts: 3
I am consistantly getting fewer "yes" readings from the left sensor (p11)·than the right sensor (p14).· I have run the porgram on 2 different SumoBots, moved the bots, changed the sensors and transmitters from one side to the other, and tried using different ir sensors and transmitters in the p4, p11, p15 and p14 locations.· Why are my bots getting consistently fewer detections on the left (p4/p11) side?
Comments
Post Edited (Mike Green) : 4/16/2008 3:48:04 AM GMT
Here is my code. It is a variation of the code on pp. 93 - 94 in Applied Robotics with the SumoBot.
' {$STAMP BS2}
' {$PBASIC 2.5}
'Constants
IR_R_Beam PIN 15
IR_R_Det PIN 14
IR_L_Beam PIN 4
IR_L_Det PIN 11
IRFREQ CON 20000
INCREMENT CON 500
'Vaiarbles
frequency VAR Word
irLF VAR Bit
irRF VAR Bit
'Program code
Main:
DO
DEBUG HOME
DEBUG CLS
DEBUG "Front IR Detectors", CR, CR
DEBUG "Frequency Left Right", CR
DEBUG "
----
", CR
FOR frequency = IRFREQ TO (IRFREQ + (INCREMENT * 20)) STEP INCREMENT
FREQOUT IR_L_Beam, 1, frequency
irLF = ~IR_L_Det
FREQOUT IR_R_Beam, 1, frequency
irRF = ~IR_R_Det
GOSUB Debug_Output
NEXT
PAUSE 2500
LOOP
END
'Subroutines
Debug_Output:
DEBUG CR, DEC frequency, CRSRX, 13
IF irLF = 1 THEN DEBUG "yes" ELSE DEBUG "no"
DEBUG CRSRX, 20
IF irRF = 1 THEN DEBUG "yes" ELSE DEBUG "no"
RETURN
The right is consistently more sensitive. For example, the right will detect 23khz to 29khz and left will only begin at 25khz. These frequency differences exist at other ranges as well. For example, at 37khz both get a signal. However, the left drops off at 40.5khz and the right at 42.5khz. I do not know if this is significant, but there is a 2khz difference in sensitivity at both ranges.
Figure 3-2, Applied Robotics with the SumoBot, does not show any resistors or other components on the IR Detector circuit, and I removed everything from the breadboard.
I'm stumped!