Shop OBEX P1 Docs P2 Docs Learn Events
Needed some help for a robot — Parallax Forums

Needed some help for a robot

warock56warock56 Posts: 15
edited 2009-12-09 03:51 in BASIC Stamp
Hey guys my friend had an old robot and I have been reading it is called a bs2 board of education (its green) and he has a ping ultrasonic sensor on the white board(which are 2 circles on a plane), he showed it to me the other day and we wanted to get it up and running to just move forward and avoid things like walls, so we went online and downloaded a program to (Basic Stamp Editor -2.4.2 I think) and we tried putting something called "roamingwithping.bs2" on it which we found on some website (it was this one I think) and some other codes but so far we cant make it move, and sometimes it moves but just like it turns when its not supposed to and doesnt really work well.

I was wondering if there is a place where I can get a simple code for the robot to "just move forward and avoid things" (I dont know if theres a robotic way to say it). I have tried looking around around this website with no luck, but maybe I am just looking in the wrong place.

Me and my friend dont know how to program even though we have looked at a couple of tutorials with no luck.

If anybody could help us out or provide us with a code I would appreciate it, sorry if I am posting on the wrong part of the forums I just joined a couple of minutes ago to ask for some help

Thanks in advance. : D
«1

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-06 02:49
    There's a tutorial called "Robotics with the BoeBot" available on Parallax's website. In addition to teaching you about the BoeBot (Board of Education Robot), it includes other roaming programs with object avoidance. Other useful texts include "What's a Microcontroller?" and the "BASIC Stamp Syntax and Reference Manual". As you've found, there are sample programs available through links on the webstore pages for the PING and the BoeBot.

    www.parallax.com/tabid/535/Default.aspx
    www.parallax.com/tabid/440/Default.aspx
    www.parallax.com/Store/Robots/RollingRobots/tabid/128/CategoryID/3/List/0/SortField/0/Level/a/ProductID/302/Default.aspx
    www.parallax.com/StoreSearchResults/tabid/768/txtSearch/ping/List/0/SortField/4/ProductID/92/Default.aspx
  • $WMc%$WMc% Posts: 1,884
    edited 2009-12-06 04:23
    warock56

    I see that y'all have done your home work to get to this point. I know what its like getting redirected over and over again. Go look up this and that. Bla,bla,bla,

    Attach Your code and I'll help You with it.
    I'll help explain whats happen in the code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
  • warock56warock56 Posts: 15
    edited 2009-12-06 04:34
    Hey Mike thanks for the prompt reply and the last 2 links look pretty similar to what my friend has


    $WMc%, I dont have a code that I am doing myself, I just want a simple code to make the robot move around and avoid things (such as walls, and solid objects), I dont want to post the code since I just downloaded it from the internet and it is not my own, but I do not know how to make one, and I know 0% about programming, I am reading the "Robotics with the BoeBot" but having a hard time since I only heed to make it go forward detecting with ultrasonic sensor, and pretty much see something on right len (the ultrasonic eyes) and go left, see something on left len and go right, see on both go back and turn around or something. Those are the basics I was reading on some internet page there. Thats really all I would want it to do, but, so far nothings come along, Ima keep on reading.
  • FranklinFranklin Posts: 4,747
    edited 2009-12-06 04:42
    Go here...http://www.parallax.com/tabid/768/ProductID/92/Default.aspx

    Look down the page and get the "Roaming with Ping)))" files and while you're there look at the video.

    If you don't know what you are doing now it is better that you learn than if someone gives you all the code. (when you want to make it do something else you will have a better understanding of what you need to change)

    Good Luck, welcome and have fun.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • warock56warock56 Posts: 15
    edited 2009-12-06 04:44
    Dont know how/if you can edit a thread so typing here again, so far after scanning over the tutorials I find nothing on ultrasonic sensors, just infrared.
  • warock56warock56 Posts: 15
    edited 2009-12-06 04:49
    Hey Franklin, I think I have already tried installing that one but my friends robot does not have the thing that makes the sensor turn, it is just mounted on the white board.
  • FranklinFranklin Posts: 4,747
    edited 2009-12-06 04:56
    Then you take out the code that moves the servo and does multiple tests and just stop when you get close and turn then test again.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • $WMc%$WMc% Posts: 1,884
    edited 2009-12-06 04:57
    warock56

    It doesn't matter who made the code! Just post what your using.I will help you understand what the code is doing.Many other members will jump in to point out errors and find fault in the code at hand.In the end you will gain a whole new understanding of the BS2!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
  • warock56warock56 Posts: 15
    edited 2009-12-06 04:58
    So I guess I take out everything that says ping servo,

    anyways I have to go for now, thanks for all of your help till now I will read more about it later and give it a try.

    I am using the roaming with ping))) code from here
    http://www.parallax.com/tabid/768/ProductID/92/Default.aspx
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-06 05:54
    You said something about right lens and left lens. If so, you're misunderstanding how the PING works. Do look at the PING documentation. It has some pictures. Basically, you have two essentially identical transducers. One is hooked up to a transmitter and acts as a speaker. The other is hooked up to a receiver and acts as a microphone. When triggered by the Stamp, the PING sends out a pulse of sound like an ultrasonic "click" and times how long it takes to receive the "click". The pulse you get back from the PING stops when it receives the first echo. The width of the pulse tells you how long it took and, by inference, how far away the closest object is from the PING.
  • warock56warock56 Posts: 15
    edited 2009-12-06 15:50
    Guys, I am just a kid and I just wanted to see if anybody could help me out with a simple code for the robot, if nobody can help me out then its ok.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-12-06 16:42
    warock56,

    If you cannot move the Ping to the left/right then the robot will·have no way to determine·left from right, only what is ahead.

    Lots of kids work with the Boebot.

    Some members have tried to lead you in the right direction, but you're resisting.

    Do you want a hand or a hand-out?·

    If you do not want to learn, then say so.· "I am warock56 and I am not smarter than a 5th-grader" will suffice.
  • $WMc%$WMc% Posts: 1,884
    edited 2009-12-06 16:42
    warock56

    Hang in there.The code you posted is Huge, It has so many REM statements that its got Me confused. I'll have a much abbreviated code shortly.

    I was just a kid when I started out in elc. about 26 years ago!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-06 16:55
    The "Robotics with the BoeBot" does have a roaming program that just uses the IR sensors that come with the BoeBot. The "Roaming with PING)))" program is based on that one and substitutes the PING for the IR sensors.

    There's no ready-to-use program for the BoeBot that uses a PING without the servo and servo bracket that allows it to scan back and forth. You can easily modify the "Roaming with PING)))" program to turn the BoeBot instead of just the bracket. It won't work as well since the BoeBot will slip a little as it pivots and the program will not be able to keep track of its position as well as it would with the bracket. You'll have to learn enough programming to make the changes yourself.

    Remember that the BoeBot is not intended to be used as a toy with ready-to-go programs. It's intended for learning about microcontrollers and basic robotics and the programs that are provided are given as examples and you're expected to learn how they work, modify them for your own purposes, and perhaps improve them and share them with others.
  • warock56warock56 Posts: 15
    edited 2009-12-07 01:55
    $WMc%, I sent you a message get back to me if you can.
  • $WMc%$WMc% Posts: 1,884
    edited 2009-12-07 02:50
    Hang in there

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
  • P!-RoP!-Ro Posts: 1,189
    edited 2009-12-07 04:12
    Technically I'm just a kid too, but just for the next two years. I think part of your problem is you're starting with programs that are too complicated. Why don't you start by making the robot to just go forward for a couple seconds? Then you can add in turns, then work on up to working sensors like the ping and then put everything together to do what you want. I'm sorry I can't give you an example right now, it's kind of a bad time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PG
  • warock56warock56 Posts: 15
    edited 2009-12-08 02:44
    what is that circle guys, our robot doesnt have it. Do I need it for the infrared receiver to work?


    30107955.th.png

    also the green cable that connects to it we do not have green cables...

    Post Edited (warock56) : 12/8/2009 2:51:29 AM GMT
  • iDaveiDave Posts: 252
    edited 2009-12-08 03:14
    Nope. It's a piezo buzzer. Used to make sounds. Like Mike said , I very much recommend the "Robotics with Boe Bot" pdf manual. It lists and describes every component that comes with it. Good luck!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A complex design is the sign of an inferior designer."
  • warock56warock56 Posts: 15
    edited 2009-12-08 03:26
    It was wired to use the ultrasonic thing but I had to completely rewire it for the IR led's so I am not sure if I did it right I followed the diagram shown on my earlier post from one of the guides I read online.



    I sort of got it working, only have one ir led so when I put it on one side the robot turns one way, when I put it on the other the robot continuously turns the other way.

    My friend has the other led so I can not be sure it works until tomorrow, I read 3 different tutorials and came up with the code on the bottom, if it will work, I will let you guys know tomorrow.

    this is what I have so far:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    irDetectLeft VAR Bit
    irDetectRight VAR Bit
    pulseLeft VAR Word
    pulseRight VAR Word



    FREQOUT 4, 2000, 3000



    DO



    FREQOUT 8, 1, 38500
    irDetectLeft = IN9
    FREQOUT 2, 1, 38500
    irDetectRight = IN0



    IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
    pulseLeft = 650
    pulseRight = 850
    ELSEIF (irDetectLeft = 0) THEN
    pulseLeft = 850
    pulseRight = 850
    ELSEIF (irDetectRight = 0) THEN
    pulseLeft = 650
    pulseRight = 650
    ELSE
    pulseLeft = 850
    pulseRight = 650
    ENDIF

    PULSOUT 15,pulseLeft
    PULSOUT 14,pulseRight
    PAUSE 15

    LOOP





    Some pics of the Robot

    img46.imageshack.us/g/dsc02702b.jpg/

    dsc02702b.th.jpg dsc02703w.th.jpg

    If anyone can comment on anything that could be wrong...

    It would help me out.

    The first couple of lines of code

    "irDetectLeft VAR Bit
    irDetectRight VAR Bit
    pulseLeft VAR Word
    pulseRight VAR Word"

    were taken from some guide online. I dont know what they are but I know that it needs it so their there.

    Instead of 12,13 I used 14,15 on the servos because 12,13 dont work on our robot.

    Its probably not much code but it took me the afternoon...

    Post Edited (warock56) : 12/8/2009 3:42:36 AM GMT
  • warock56warock56 Posts: 15
    edited 2009-12-08 03:43
    Ok I got my hands on another LED, the robot now just moves backwards... anybody know why?

    I tried using a code that checks if your leds are detecting, should show a 1 if not detecting and a 0 if detecting, it is always on 0.


    Edit: I am thinking it may be I did not shield the led's, if this is the problem what could be a way to shield them with common household materials, like paper or something.

    Post Edited (warock56) : 12/8/2009 3:56:01 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-08 04:13
    For shielding the LEDs, you need something that's opaque to IR. Parallax uses little black plastic tubes. You could use duct tape and paper to make little tubes that would fit over the LEDs and only let light exit from the end away from the wires. You want the tube to extend a little past the end of the LED and you want somehow to prevent the light from coming out the end where the wires come out.
  • warock56warock56 Posts: 15
    edited 2009-12-08 04:15
    ok so you think my setup is right so far? I called a friend that has some he is going to give me 2, can you see any problems with the code? Anyways I am out for today, thanks for the prompt reply.
  • P!-RoP!-Ro Posts: 1,189
    edited 2009-12-08 04:16
    Electrical tape works fine. If it is going backwards and not forwards like you want you can either switch the servo connections or switch the 850 and 650 in your code. If you wish to check to make sure the emitter leds are working fine just use a digital camera and you can see them glow.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PG
  • warock56warock56 Posts: 15
    edited 2009-12-08 12:11
    But could it be going backwards because it has no shields maybe? and the detectors pick it up on both sides so it just goes back. Right?
  • warock56warock56 Posts: 15
    edited 2009-12-08 16:53
    works perfectly guys, ill post a video up soon, it crashes every now and then but for the most part it does a good job.
  • warock56warock56 Posts: 15
    edited 2009-12-08 17:14
    www.youtube.com/watch?v=Oe6mdtgUH_8

    Video of it moving around the table.
  • iDaveiDave Posts: 252
    edited 2009-12-09 00:00
    Good job warock56! Way to stick to it and solve the problem! And bonus points for the 180 degree backwards setup. The BOE (board of education) is usually pointed the other direction. A fresh look! Don't know if that was on purpose or a happy accident...but whatever.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A complex design is the sign of an inferior designer."
  • P!-RoP!-Ro Posts: 1,189
    edited 2009-12-09 00:58
    Wasn't as hard as you made it out to be, was it? And I think Dave found out why it was going backwards too! But good work, glad it's working. Now all you have to do is learn how sonar works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PG
  • warock56warock56 Posts: 15
    edited 2009-12-09 03:51
    yea, I saw all of them the other way but I just preferred to have the big wheels by the back, just made more sense to me, and I liked the way it looked more.

    Edit: Yea btw it stopped going backwards as soon as I put the shields on the LED's. That was the high point of my day today.
Sign In or Register to comment.