Shop OBEX P1 Docs P2 Docs Learn Events
following boe-bot problem — Parallax Forums

following boe-bot problem

sushiandmorihikosushiandmorihiko Posts: 40
edited 2007-10-13 05:28 in BASIC Stamp
hello guys,i was trying this following boe-bot from boe-bot book from page 282 for later to be used in my pan and tilt project to detect my hand.

however right now i dont know if this is working well--it really did detect my hand or book,however i dont think it is that accurate---is there anyway i can make the sensors more accurate in reacting to its obstacle in front and why is my boe-bot backing up when she detects nothing-always---why is this so?

here is the codes that i used[noparse]:([/noparse]exactly like in the boe-bot book page 282).

DEBUG "Program Running!"
'
[noparse][[/noparse] Constants ]
Kpl CON -35
Kpr CON 35
SetPoint CON 2
CenterPulse CON 750
'
[noparse][[/noparse] Variables ]
freqSelect VAR Nib
irFrequency VAR Word
irDetectLeft VAR Bit
irDetectRight VAR Bit
distanceLeft VAR Nib
distanceRight VAR Nib
pulseLeft VAR Word
pulseRight VAR Word


'
[noparse][[/noparse] Initialization ]
FREQOUT 4, 2000, 3000



'
[noparse][[/noparse] Main Routine ]
DO

GOSUB Get_Ir_Distances

pulseLeft = SetPoint - distanceLeft * Kpl + CenterPulse
pulseRight = SetPoint - distanceRight * Kpr + CenterPulse

GOSUB Send_Pulse

LOOP


'
[noparse][[/noparse] Subroutine - Get IR Distances ]

Get_Ir_Distances:
distanceLeft = 0
distanceRight = 0

FOR freqSelect = 0 TO 4
LOOKUP freqSelect,[noparse][[/noparse]37500,38250,39500,40500,41500], irFrequency

FREQOUT 8,1,irFrequency
irDetectLeft = IN9

distanceLeft = distanceLeft + irDetectLeft

FREQOUT 1,1,irFrequency
irDetectRight = IN0

distanceRight = distanceRight + irDetectRight
NEXT

RETURN



'
[noparse][[/noparse] Subroutine – Get Pulse ]
Send_Pulse:
PULSOUT 14,pulseLeft
PULSOUT 15,pulseRight
PAUSE 5

RETURN

is there anyway i can modify these codes to make it more sensitive and react better?

thank you in advance

Comments

  • ZootZoot Posts: 2,227
    edited 2007-10-09 23:45
    First thing to try is to get the position (the direction they "point") of your IR LEDs in a good position and then find a good value for the series resistor that goes from your IR FREQOUT pin to the LED. If you are LED is too bright or too dim, you won't get results as good. There are some experiments and exercises in the Boe-bot manual for tuning IR frequencies and the resistor value.

    Andy Lindsay also has some additional material regarding IR detection and better PID control for things like IR following:

    IR detection: http://forums.parallax.com/showthread.php?p=561496

    Basic PID control: http://forums.parallax.com/showthread.php?p=529609

    Excellent Boe-bot Dual PID discussion: http://forums.parallax.com/showthread.php?p=649354

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • D FaustD Faust Posts: 608
    edited 2007-10-10 01:16
    It looks to me that you are detecting not the distance but the number of ditances that the object is detected at. This isn't very reliable because an object could only be detected in the first two zones and another could be detected in the last 3 or vice versa. What you should do is something like this: http://forums.parallax.com/forums/default.aspx?tabid=&f=5&m=204811&p=1

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
  • sushiandmorihikosushiandmorihiko Posts: 40
    edited 2007-10-13 05:28
    thanks for the advice ,D faust and zoot, i ll shall try them
Sign In or Register to comment.