Another First Robot based on fritsl design
Here's my first robot :) It's based on fritsl design. The differences are that it doesn't have a servo (it always looks forward) and has 2 touch sensors just in front of the weels so that if it bumps on something, it goes a little back and turn away.
Also, it's not held together by tape, but with a solid structure based on nuts and bolts (as you can see from the pictures) and CD plates. A wooden cube is the main attachment for all parts. I like this design becouse it's completely disassemblable, nothing is permanently attached. Also, it's quite strong.
Now i'm gonna add an ultraluminous led to act as a spotlight :)
UPDATE: I added the ultraluminous led! It make a very bright light cone, give great effect when the robot turns :) The led is mounted on the head near the IR sensor, along with it's resistor. It's actually connected to G and V, since i don't have a transistor lying around, so it's always on then the robot is on.
I added a couple of pictures, a video with the LED on, and the complete source code (nothing fancy there).
Source Code
pause 2000 ' wait to put the robot down :)
main:
' full forward
gosub fwd_right
gosub fwd_left
gosub read_dist
if w1 > 200 then
sertxd("Dist is ",#w1,", switching to evade", 13,10)
random w0 ' choose which side, randomly
if b0>120 then
gosub evade
else
gosub evade2
endif
endif
if pin0 = 1 then
gosub hit_right 'right bumper hit
elseif pin3 = 1 then
gosub hit_left 'left bumper hit
endif
goto main
hit_left:
'left bumper hit!
sertxd("hit left", 13,10)
gosub bck_right ' go very little backward
gosub bck_left
pause 250
gosub bck_right ' turn very little to the opposite direction
gosub fwd_left
pause 250
return
hit_right:
'right bumper hit!
sertxd("hit right", 13,10)
gosub bck_right
gosub bck_left
pause 250
gosub fwd_right
gosub bck_left
pause 250
return
evade:
gosub fwd_right ' turn one side
gosub bck_left
gosub read_dist
if w1 > 140 then
goto evade ' if still close to something, keep turning
endif
sertxd("Dist is ",#w1,", switching to main", 13,10)
return
evade2:
gosub bck_right
gosub fwd_left
gosub read_dist
if w1 > 140 then
goto evade2
endif
sertxd("Dist is ",#w1,", switching to main", 13,10)
return
read_dist:
' make average of two reads
' hoping to remove some disturbance
readadc10 4, w2
readadc10 4, w3
let w1 = w2+w3
let w1 = w1 / 2
sertxd("#A:",#w1,";", 13,10)
return
fwd_left:
low 4
high 5
return
fwd_right:
low 6
high 7
return
bck_left:
high 4
low 5
return
bck_right:
high 6
low 7
return
stop_left:
low 4
low 5
return
stop_right:
low 6
low 7
return
navigate via IR sensor and touch sensors
- Actuators / output devices: SBGM9
- CPU: Picaxe 28x1
- Power source: 4x1, 2 AA battery
- Programming language: Basic
- Sensors / input devices: Sharp IR, microswitch touch sensors
- Target environment: indoor flat surfaces