Let's Make Robots!

My first robot

Drives around and navigates via ultra sound sensors mounted on a servo. Also shoots "laser" and make sounds :)


Your browser is not able to display this multimedia content.

UPDATED: Code on how to make this sort of navigation inserted below.


My first robot!

I did not have a clue to all the stuff you can buy, and so I thought I was the only one in the world making Robots, and was inventing eveything from scratch..




But.. I actually managed to make some pretty cool code, quite nice navigational system that I have been using in many projects afterwards:


Basics of the code:

Main routine:

Drive ahead!
Pan head from left to right, and back
Constantly return sonar range

When facing green areas:
if sonar range > “interesting” (if there is no obstacles even faaaaar away, an open door or similar to make us curious) and if we did not just do this several times already without seeing anything close, then stop turning head, and start to turn body till head faces an obstacle, or just something far away, or body-turning has ben done for a while. Then continue in main routine

When facing red areas:
if sonar range < “danger” (if something is close in front of us), and head is turned more left than right (in this example):
Turn body a little to the right (away from danger) while turning head a little to the left (towards the danger) - Keep this up until head is in green area, and then continue in main routine




1.000 pics, sorry if this is too much, but I was so much in love ;)





Thanks for asking about the code. i have made a simplified version (without all the extras of this particular robot), just the navigation.


Hardware setup needed for this to turn into something:
1 "Picaxe robot":
2 motors on a motor-driver
1 servo, on which is mounted 1 SRF05

The code below will make this setup navigate like my first robot, featured in video above - you can use belt-track or just a robot on 2 wheels - same code.

Feel free to ask or comment & have fun :)



EEEH! EEEH! EEEH! ALERT: Since this code is now slowly becoming a "standard" base for quite many projects, I am only updating it one place, you can find the latest version here from now on :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
how do you tell whether it is left or right?

You keep track of its position when you do an obstacle check. If an obstacle isn`t detected you can move on to the rest of the code. If an obstacle IS detected you recall what the last position you assigned to the servo is. It`s very basic stuff benbo. If you tell the servo where to go, then of course you know what position it is.

Heavily loaded servos may not be in the exact position you want though.


pulsout is all i know. is there a pbasic servo command?
On Picaxe it's just Servo and Servopos - I know no other variants, sorry.

Hey, I'm new and i'm trying to build a robot for a school project. I would like to build a robot that acts like this first robot of yours. I don't care how it looks i just want it to navigate around objects instead of running from them. My  question is, will the "How to build your first robot" project act like this one? Or will it simply turn away and run rather than turning just enough to move past an obstacle? If not then are the differences in coding or in physical design? Thanks A TON

Kadaj :) 

Hi Kadaj!

The physical design would be the same.

Depending on the code you make, you will get a different acting robot.

The code for this one is atached the "Start here"-series.

when u say "sound" is it from a speaker?(duh?) or the motor? and the one that really puzzles me is the LED how did u make the code so that it only lights up on obstacles?


Gosub RightSpin

if head > ForwardLeft and head < 150 then
head = head - 15
pause 50
servo Servopin,head
end if
gosub puls
if range < Danger then goto ForwardLeft_middle
gosub afterturn
If MayTurn < MaxNumberTurns then
MayTurn = MayTurn + 1
end if

Gosub Leftspin

if head > 150 and head < ForwardRight then
head = head + 15
pause 50
servo Servopin,head
end if
gosub puls
if range < Danger then goto ForwardRight_middle
gosub afterturn
If MayTurn < MaxNumberTurns then
MayTurn = MayTurn + 1
end if


iknow that i should add 

servo 1,head  

but how can i make it pause and light?



I am not sure I follow you 100%?!?

The robot navigates via Ultra Sound (The SRF05) - and makes sounds through a speaker.

It has multiple LED's, I am not sure which you wonder about..? However, switching on an LED is just about as simple as it can get. It has to be conected to the output port (see the "start here-project, top menu" for more & links to more) - and then you just write high 2 to make the LED on pin 2 high.

I think perhaps you shouldtry and follow the "start here" - project, and simply just try some more stuff yourself: Make an LED blink, make a speaker say beep etc :)

The navigation is surprisingly good, especially for your first robot.

One thing I noticed -- did you make those tank treads yourself out of tape? That's awesome :)


The navigation is what I am trying to push out everywhere;


It IS surprinsingly good - not because I made it, but it always amazes me, sorry if I sound too happy for my own work :) It is free for download, try it!


Tape is only on tracks to make them skid easier - They where rubber, and the robot suffered. Adding tape made it move MUCH more smooth, and still with plenty of grip.


/ Fritsl