Shop OBEX P1 Docs P2 Docs Learn Events
How to improve sensitivity? — Parallax Forums

How to improve sensitivity?

arien009arien009 Posts: 7
edited 2010-11-15 09:51 in BASIC Stamp
Hi,

Can I check how can I improve the sensitivity of my program execution of the Boe-bot?


'
[ Main Routine ]

DO
IF IN14 = 0 THEN
GOSUB Alarm
ELSE
GOSUB Test_Photoresistors
GOSUB Navigate
ENDIF
LOOP

'
[ Subroutine - Test_Photoresistors ]

Test_Photoresistors:
HIGH 7 ' Left RC time measurement.
PAUSE 3
RCTIME 7,1,timeLeft
HIGH 3 ' Right RC time measurement.
PAUSE 3
RCTIME 3,1,timeRight
RETURN

'
[ Subroutine - Navigate ]

counter VAR Word

Navigate:
IF (timeLeft < LeftThreshold) AND (timeRight < RightThreshold) THEN
PULSOUT 13, 850 ' Both detect flashlight beam,
PULSOUT 12, 706 ' full speed forward.
ELSEIF (timeLeft < LeftThreshold) THEN ' Left detects flashlight beam,
PULSOUT 13, 700 ' pivot left.
PULSOUT 12, 700

FOR counter = 1 TO 220
PULSOUT 15, 850
NEXT

ELSEIF (timeRight < RightThreshold) THEN ' Right detects flashlight beam,
PULSOUT 13, 800 ' pivot right.
PULSOUT 12, 800

FOR counter = 1 TO 220
PULSOUT 15, 650
NEXT

ELSE
PULSOUT 13, 750 ' No flashlight beam, sit still.
PULSOUT 12, 750
ENDIF
PAUSE 10 ' Pause between pulses.
RETURN

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-11-15 09:06
    You probably need to change the value of the capacitor attached to the photoresistor in the resistance measurement circuit. There's a discussion in the chapter on the RCTIME statement in the Basic Stamp Syntax and Reference Manual (also in the Stamp Editor's help files) and how to choose a capacitor value. You need to have an idea of the range of resistance you want to measure. With a photoresistor, this range is very wide. You may want to check the value of the photoresistor under different light levels using an Ohmmeter.
  • ercoerco Posts: 20,256
    edited 2010-11-15 09:51
    Make sure you use a word variable for your RCtime statement, since your returned value can get large.

    Re: adding sensitivity on the cheap, you could use 2 similar photocells in series on each side. Doubles your resistance value range.
Sign In or Register to comment.