Shop OBEX P1 Docs P2 Docs Learn Events
Vacuum cleaner project — Parallax Forums

Vacuum cleaner project

Vladimir059Vladimir059 Posts: 9
edited 2006-04-26 06:55 in Robotics
Hello everybody! I posted a few weeks ago questions about my project – robot vacuum cleaner. Now I have made prototype and began to test it. I use Basic Stamp controller and L298 H-bridge driver. For sensing I use two Lynxmotion IR proximity detectors. IR detector· has internal 38kHz generator and doesn't required Stamp 38 kHz output. In a lab conditions (even color of floor, few objects) my vac-robot works great. It avoids obstacles and randomly “cleans” all area (at this moment there isn’t cleaning head). But in real apartment my monster-vac became confused quickly. Most difficult problem I have experienced, and I don’t know how to solve it now –cyclic motion. For example the robot detects an object on the left side, then it starts moving to the right side. A few seconds later it detects an object on the right side and accordingly begin to move to the left. Finally, the robot is flouncing between left and right without any progress. ·If anyone knows how to solve this problem, please let me know. Maybe a solution is using a counter and after a few similar cycles subroutine will change variable or add random value. Please help me as I never being a good programmer.
Vladimir
PS This is my program:·
' {$STAMP BS2}
' {$PBASIC 2.5}

irDetectLeft VAR Bit······· 'IR detector left
irDetectRight VAR Bit······ 'IR detector right
Left VAR Bit··············· 'left forward
Right VAR Bit·············· 'right forward
LeftBack VAR Bit··········· 'left back
RightBack VAR Bit·········· 'right back
OUTPUT 15················· 'L298 left forward pin
OUTPUT 10················· 'L298 left back pin
OUTPUT 14················· 'L298 right forward pin
OUTPUT 13················· 'L298 right back pin
INPUT 12·················· 'Lynxmotion IR proximity detector left
INPUT 11·················· 'Lynxmotion IR proximity detector right

DO
irDetectLeft = IN12
irDetectRight = IN11
left = 0
right = 0
leftback = 0
rightback = 0

IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN 'no barrier left and right motors on
Left = 1
Right = 1
ELSEIF (irDetectRight = 0) THEN·· 'barrier on the left, left motor on, right-back on
Right = 0
LeftBack = 0
PAUSE 100
Left = 1
RightBack = 1
ELSEIF (irDetectLeft = 0) THEN·· 'barrier on the right, right motor on, left-back motor on
Left = 0
RightBack = 0
PAUSE 100
Right = 1
LeftBack = 1
ELSE··················· 'barrier on the front, right-back and left-back motors on
Left = 0
Right = 0
PAUSE 100
LeftBack = 1
RightBack = 1
ENDIF

OUT15 = Left
OUT10 = LeftBack
OUT14 = Right
OUT13 = RightBack
PAUSE 500
LOOP
'Lynxmotion IR proximity detector has internal 38kHz generator and doesn't required
'Stamp 38 kHz output.
Sign In or Register to comment.