Shop OBEX P1 Docs P2 Docs Learn Events
Problems with Boe-Bot — Parallax Forums

Problems with Boe-Bot

Link_ShinigamiLink_Shinigami Posts: 8
edited 2006-05-19 01:27 in Robotics
Hello everyone, I would like some help and would be greatful if anyone could provide even the slightest bit. And I apologize in advance if this has been answered before.

Last year another classmate and I were given a stamp and told to do some basic programming (Motor control, 7-segment LED display, LED Binary counter, etc). This year we (With our teacher) are working with the Boe-Bot.· We have been having slight problems and have not been able to solve problems or get around them.

I'll start with the problem (If our code is needed I can post it when I get into class).· We have been attempting to make the boe-bot do a simple line of movements, we try to make it (for example) go forward, reverse, turn left (90 degrees), turn left, go forward, turn right (90 degrees) then do a right forward arc.· We have tried using gosub but it does not work. It will execute the first routine but after that it seems to 'stutter' as it attempts to do the next routine (i.e. forward then turn right, the servo motors will -try- to do it but they seem to do it quickly then go right back to forward). We also attempted the same line of commands by (I believe the command is) 'data ("frllfr")' after giving them labels. As well, goto does the same as gosub.

Any help would be wonderful. All I remember is that we are using pins 12 and 13 and we·arn't using the boe-bot board, we are using a standard bread board my teacher had in class (Well, one of the several. It is a electronic engineering class, lol).

Thanks in advance! And if the code is needed, I can post it when I get into class (In about 4hours).

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-05-18 13:45
    Link_Shinigami -

    Posting the program code would be an excellent idea, since as you say there is more than one problem you're encountering.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-05-18 15:26
    Typical things that cause this:

    1. Missing ground wire between what's powering the servo's and what's powering the BS2 board.

    2. Insufficient power to the servo and BS2 is causing BS2 reset.

    3. Forgetting to 'refresh' the servo's every 20 mSec.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-18 15:50
    Low batteries are a common source of problems like this.· Can you test the voltage at the 9V connector (even if you're not using it) to see what the Vin is?· If it's less than 5.8V you're probably experiencing brownout.· GOSUB and GOTO are not interchangeable so that could also be a problem but we can't verify that without the code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Link_ShinigamiLink_Shinigami Posts: 8
    edited 2006-05-18 16:13
    We are going to try using the reset command in the meantime, but as of now this is our code. Thanks for everyones replies.

    ·' {$STAMP BS2sx}
    ' {$PBASIC 2.5}

    DO UNTIL (instruction = "Q")
    READ address, instruction
    address = address +1

    SELECT instruction
    CASE "F": GOSUB forward
    CASE "B": GOSUB backward
    CASE "L": GOSUB left_turn
    CASE "R": GOSUB right_turn
    ENDSELECT
    LOOP
    END

    DEBUG "Program Running"
    Pulsecount VAR Word
    address VAR Byte
    instruction VAR Byte
    DATA "flffrblbbq"

    forward:
    FOR pulsecount = 1 TO 64
    PULSOUT 0,850
    PULSOUT 1, 650
    PAUSE 20
    NEXT
    RETURN

    backward:
    FOR pulsecount =· 1 TO 64
    PULSOUT 0, 650
    PULSOUT 1, 850
    PAUSE 20
    NEXT
    RETURN

    left_turn:
    FOR pulsecount = 1 TO 24
    PULSOUT 0, 650
    PULSOUT 1, 650
    PAUSE 20
    NEXT
    RETURN

    right_turn:
    FOR pulsecount = 1 TO 24
    PULSOUT 0,850
    PULSOUT 1,850
    PAUSE 20
    NEXT
    RETURN



    thanks a bunch (Slight problem. This is an older version of the current code due to save errors and such, I apologize for this)

    Post Edited (Link_Shinigami) : 5/18/2006 4:20:30 PM GMT
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-05-18 16:19
    Link_Shinigami -

    It appeaars as though the first part of the program is missing, if that's supposed to represent the entire program.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Link_ShinigamiLink_Shinigami Posts: 8
    edited 2006-05-18 16:21
    I know, I just edited it. There was a small problem when my partener saved over the previous version with something we were trialing. Sorry about that, the code has been edited, thanks a bunch.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-05-18 16:24
    Ok, you have a few things going on here.

    Please see attached code:

    You have your subroutines up in the body of your code. The return statements will not know where to 'return' to...

    You have the pulsouts based on a BS2sx- in the code I attached I made the code BS2 - if you need BS2sx, you should alter your pulsout statements accordingly.

    *edit* I responded based on the code you had originally posted - I'll have to check again...


    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com

    Post Edited (Ryan Clarke (Parallax)) : 5/18/2006 5:25:08 PM GMT
  • Link_ShinigamiLink_Shinigami Posts: 8
    edited 2006-05-18 16:35
    Ok. I had already tried the code you gave and couldn't find a differnce. Thank you again and we are very greatful for the time you are taking out of your schedule. Thank you!
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-05-18 16:38
    Ok, looking at the code you now have listed:

    * You are using a BS2sx? Change your pulseout values accordingly
    * You have your servos on Pins 0 and 1 ? (Just verifying this)
    * Changed your pulsecount variable to a byte (no need for a word, your value never goes above 64)
    * Restructured the code (moved variable declarations to the top, etc)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com

    Post Edited (Ryan Clarke (Parallax)) : 5/18/2006 5:26:07 PM GMT
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-05-18 16:44
    For clarification:

    The PULSOUT instruction-

    Syntax: PULSOUT Pin, Duration

    The units in Duration are as follows:

    BS1: 10 µs
    BS2, BS2e, and BS2pe: 2 µs
    BS2sx, BS2p, and BS2px: 0.8 µs



    So a pulsout statement on the BS2 such as:

    PULSOUT 1, 650

    Sends a pulse of (650 * 2 µs) = 1.3 mS

    to get the same value on a BS2sx:

    PULSOUT 1, 1625

    because (1625 * 0.8 µs) = 1.3 mS


    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Link_ShinigamiLink_Shinigami Posts: 8
    edited 2006-05-18 16:54
    We are attempting to use a BS2, edit will have our results...
  • SSteveSSteve Posts: 808
    edited 2006-05-18 16:59
    Instead of editing the code in your original post, you should attach it to a new post. Otherwise, there will be replies to code that's no longer on the thread and that gets very confusing. Also, you should try to attach your code instead of pasting it into the message. It's much easier to read that way.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-05-18 17:02
    The code you keep posting has the directive for a BS2SX. With the directive you have in your code, this will not load into a BS2. Please verify what stamp you are using. Please verify what pins your servos are on (a BOE Bot does not have a header for Pin 0 or Pin 1)-
    Please verify your power source. (Check your batteries with a meter, not just the LED on the BOE)...

    The code I changed moved things - you have versions (depending on when you look at the message)- where things will never get executed because of how the code was organized.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com

    Post Edited (Ryan Clarke (Parallax)) : 5/18/2006 5:06:48 PM GMT
  • Link_ShinigamiLink_Shinigami Posts: 8
    edited 2006-05-18 17:06
    Well, we just tried a BS2 chip and there is a marginal increase. It now stops but it does not go through the other data string (Data "flffrblbbq"). It spins in place and then stops after it goes through and then it quits and resets. Thank you everyone.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-05-18 17:08
    Have you followed the BOE bot book?

    Did you center your servos?

    Also, check the case of the letters in your DATA vs. your case statement.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Link_ShinigamiLink_Shinigami Posts: 8
    edited 2006-05-18 17:11
    Yes, we have been using the BOE bot book almost as if it were a bible, I don't know why we hadn't tried to centre the servos.

    We changed the case statement and the servos are something we havn't tried. We'll have to try that tomorow since class is over (lol). Thanks everyone for your· help, I just hope the end result isn't us getting taken off this project (He said it today but there is a good chance he just said that to see our responses...).· THanks again everyone, your help has been greatly appreciated.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-05-18 17:22
    Well, sorry to hear that. I'm sure we could have got you up and running.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Link_ShinigamiLink_Shinigami Posts: 8
    edited 2006-05-19 01:08
    Well after talking with my teacher after class, it appears we are still working on it (Or just me, I'm a little confused as to the way he worded it because he seemed interested in what I had to say about the servo motors and your advice after class). I'll have to readjust the servo's because they were set up to work with the BS2 pulsouts but through BS2sx which means they aren't calibrated. I'll post tomorow after I recalibrate them. Hopefully this will fix things and we can be on our way and start having problems with whiskers and other sensors, lol.

    Thanks again for everyones help!
  • edited 2006-05-19 01:27
    Keep in mind that the calibration is primarily adjusting numbers in the programs. You will first have to center the servos. The instructions in Robotics with the Boe-Bot will tell you to run a program with a loop that looks like this:

    DO
    · PULSOUT 13, 750
    · PULSOUT 12, 750
    · PAUSE 20
    LOOP

    However, your BS2sx runs 2.5 times faster than a BS2. This means you will have to modify some of the command arguments to get the timing to be the same as it would have been with a BASIC Stamp 2. The rule of thumb is multiply all duration arguments by 2.5, and divide all frequency arguments by 2.5. The exception here is the PAUSE command, whose duration argument stays the same.

    So your program must use PULSOUT commands with these modified Duration arguments (1875 instead of 750):

    DO
    · PULSOUT 13, 1875
    · PULSOUT 12, 1875
    · PAUSE 20
    LOOP

    With FREQOUT commands, you are dealing with both a duration and a frequency.

    For example, FREQOUT 4, 2000, 3000 will have to be changed to FREQOUT 4, 5000, 1200.

    You will have to make these updates to the frequency and duration arguments in every program in the book before you run it, otherwise they won't work right.

    Post Edited (Andy Lindsay (Parallax)) : 5/19/2006 1:33:36 AM GMT
Sign In or Register to comment.