How to make your first robot

Programming problem

Hi.

I’ve finished building my Start here robot. However, the problem shows up after progamming the robot. My robot just keeps going forward and backward. The code I wrote was copied from the website and I used Picaxe programming editor.

It would be great if somebody can help me with my problem.

Does your servo move at all?

Does your servo move at all? Which code did you use?

My servo moves normally.

My servo moves normally. Also, I want to tell you that my IR Sharp wires’ positions are different from ones in the picture so I swapped to make it work.  The code I used is this:

 

 

Symbol dangerlevel = 70 

symbol turn = 300 

symbol servo_turn = 700 

 

main: 

readadc 0, b1 

if b1 < dangerlevel then

gosub nodanger 

else 

gosub whichway 

end if

goto main 

 

 

nodanger:

high 5 : high 6 : low 4 : low 7

return

 

 

whichway:

gosub totalhalt 

 

 

gosub lturn 

pause servo_turn 

readadc 0, b1

gosub totalhalt

 

 

 

gosub rturn 

pause servo_turn 

readadc 0, b2

gosub totalhalt

 

 

if b1<b2 then

gosub body_lturn

else

gosub body_rturn

end if

return

 

body_lturn:

high 6 : low 5 : low 7 : high 4 

pause turn : gosub totalhalt

return

 

body_rturn:

high 5 : low 6 : low 4 : high 7 

pause turn : gosub totalhalt

return

 

rturn:

servo 0, 100 

return

 

lturn:

servo 0, 200 

return

 

totalhalt:

low 4 : low 5 : low 6 : low 7 

Servo 0,150 

wait 1 

return

 

 

You say the bot goes

You say the bot goes forwards and backwards but the code doesn’t indicate it should ever go in reverse. More information on its behavior might help the diagnosis.
The first thing I’d check is the IR sensor is working ok. Plop in this code:

main:

readadc 0, b1
debug
goto main


A window should pop up after you load the program. Variable b1 will give you a range value from the IR sensor. Does it change accordingly or is it stuck at zero or some other number? 

I did what you said and I

I did what you said and I saw the variable b1 changes all the time. 

Here is the video of the robot working you might want to see:

http://www.youtube.com/watch?v=XAA65pRRI5s&feature=youtu.be

Judging from the video there

Judging from the video there seems to be a couple things amiss.

For starters your motor pins need to be sorted out. It should turn left or right, not go backwards or forwards. A very small thing to adjust. Frits talks about it in the write-up.

I would say the values returned by the IR sensor never below the “danger” threshold and that’s why it’s acting the way it does. Does the debug value from the sensor ever get larger than 70? If not I’d check the batteries for full voltage. It’s behaving sort of like it’s low on power.

edit -

The test code from above should result in the value changing with the distance from the sensor. I forgot to ask if it does that or not.

 

First, when I test the

First, when I test the motors with the low 4 : high 5 : high 6 : low 7 code they all work normally. However, when I programme everything, they just go mad.

The debug value just keeps increasing and never stops and of course, it gets larger than 70.

The closer the objects gets to the sensor,  the larger the b1 is.

Hi Jax. I hope you can give

Hi Jax. I hope you can give me some further advices on my robot.

 

Sorry, my notifications

Sorry, my notifications didn’t alert me to the update.

I don’t suppose you tried to use the sensor without doing the wire-cut-and-switch that Frits describes in the walkthrough? It’s hard to see in the vid but it looks ok now. I’m just wondering if it always was. These sensors are easy to fry with bad wiring.

Robot does not go anywhere

All it does is go a few inches backwards, then it spins around alot, then it might go forward or a tiny biy backwards and so on.

Actually, at the beginning,

Actually, at the beginning, I didn’t do the wire-cut-and-switch and i found the robot didn’t work so I fixed it by doing the wire-cut-and-switch. So if my sensor fry, does that mean I have to buy a new one?

Building a robot that follows me
Hello,

First, I am new here. And I would like to tell you that I am a big fan of your website! It’s so amazing, thanks :slight_smile: 2nd thing, I want to build my first robot, I don’t really know anything about building robots. So I will start with the basic robot that you put here. I’m just wondering what is the greatest thing a home-built robot can do? Sorry, if this is a silly question. But can I make a robot that follows me? I’m buying the materials online from the Solarbotics Shop for now. What do I need to make a robot that follows me if it is possible? Thank you.

Such a robot mostly relies

Such a robot mostly relies on correct programming and the robot shown above could be adapted to follow you, i’m no expert but that’s what i’ve gathered so far.

Buying parts?

Does anyone have a website that I can buy the parts in the UK. Or at least a way to get cheaper shipping option from the North American websites above? Cheers.

Right one here

http://www.hobbytronics.co.uk/index.php?route=common/home

 

Help! I am completely new at

Help! I am completely new at this. The construction was fine but I am encountering issues with programming. When I put in:

main:

readadc 0, b0

debug

goto main

I get an error message: Compilation for PICAXE-08M Failed
   Readadc 0, b0
   Error: Pin 0 cannot be used with this command

Sounds like you have the wrong PICAXE selected

Find the “Options…” button in the program editor toolbar or under the “View” menu. Use the dropdown menu on the “Mode” tab (it should default there) and select the “PICAXE28X1/40X1.” Click on "OK "and give the upload another try.

New Kid on the block

Hey guys I was doubting to make this a new post on the forum, but here it is:

 

I was told to buy myself directly a Raspberry Pi beceause I would outgrow the Arduino or other simpel controllers too fast. It would pay off more if I would start to play with some basics on the PI and immediately learn to work with a more powerfull platform.

Can somebody suggest me some posts on the website or forum that would be a great startingpoint for me and a Raspberry PI?

I hope in the end to get a small car running which brakes if it detects a wall or other larger object. This would be a great platform to start a dreambot :slight_smile:

Thank you for your help.

 

In the meanwhile i’ll keep browsing the forum :slight_smile:

 

Introduction !! Hi Guys

Hey all,

I am married and hav 2 kidz, working as a BDM in an insurance company. Also a part time Author. My book will be releasing soon early next year.

Y my interest has gone into robotics, becoz always wanted to built one of my own. I do stuff and part times after all at home go to sleep. Lol, currently pretty much in a garage or the laundry or store room so can work in peace.

I am here to build a robot who can cook for me, clean the home do some local stuff and some easy command.

Imagine a microwave like machine - with couple of flunnel like stuff on the top where you can feed raw vegetables which gathers into some vessel, this is wired through internet. While i am going home, i download the program from the menu for dollar 1 and its actually takes the process and makes it by the time i am home - food is ready.

Well its complicated design but surely will build it one day. Have many such innovative machines which are money making. Imagine the number of dollars paid for different stuff from the menu.

2nd machine will like my personal assistant who can take commands from me only and judge the emotions of the person in front and try to joke or something to cheer people up.

still many more to go…lets build this first.

See u and god bless !!

 

Upgrade The Processor

As soon as I had the kit a year or so ago I bought the Picaxe 28x2 processor($10). It is faster and you can change all of the ports to whatever you need. You get Shifout and ShiftIn too. I love your site.