This was built about 7 years ago, the idea for the chassis came from the BOE-BOT, the controller is an Out of production Stampbug 2 board, from Milford Instruments Ltd, in the UK. it contains a OEM Basic Stamp 2, small proto area, the only problem is it contains no voltage regulator, so i had to build my own.
I also build a board to power the servos, this provided the pins for the servo plugs, logic from the stamp and a seperate power supply.
It uses a Daventech SRF-04 ultrasonic sensor, for collision avoidence.
This is the code that the stamp is running, feel free to copy and use it if you wish.
' MO-bot roaming with Devantech SRF04'
counter VAR Word
Dist VAR Word
INIT CON 6
ECHO CON 7
' CONVERSION FACTORS: '
' The PULSIN command returns the round-trip echo time in 2us units
' which is equivalent to the one-way trip time in 1us units. '
' Filename: srf04-1.bs2 ' distance = (echo time) / (conversion factor) '
' use 74 for inches (73.746us per 1 in) ' use 29 for centimeters (29.033us per 1 cm) '
convfac CON 74 ' use inches '
PULSOUT INIT,5 ' 10us init pulse
PULSIN ECHO,1,Dist ' measure echo time
Dist=Dist/convfac ' convert to inches
IF Dist > 6 THEN forward
IF dist < 6 THEN left
FOR counter = 1 TO 10
PULSOUT 15, 500
PULSOUT 14, 737
FOR counter = 1 TO 24 'adjust this number till robot turns 90
PULSOUT 15, 750
PULSOUT 14, 750