Shop OBEX P1 Docs P2 Docs Learn Events
Arduino Boe Bot Kit problem with reverse — Parallax Forums

Arduino Boe Bot Kit problem with reverse

Cubuntu28Cubuntu28 Posts: 7
edited 2012-04-12 16:21 in Robotics
Hi all, I am new to robotics, and I am having a slight issue with Boe Bot Kit/Arduino. I have "centered the servos" and have no issue getting the bot to move forward. (but) I cannot get the Bot to go backwards only the right servo goes in reverse while the left stays still.

Forward Sketch http://learn.parallax.com/node/220

the reverse sketch is the same as above except swtiching

// Full speed reverse servo
Left.writeMicroseconds(1300); // Left wheel clockwise servo
Right.writeMicroseconds(1700); // Right wheel counterclockwise
delay(10000); // ...for 10 secondsAny advice will be appreciated!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-04-12 15:01
    The servos on the BoeBot go in one direction when the pulse width of the servo control pulse is shorter than 1.5ms (or 1500us) and the other direction when the servo control pulse is longer than 1.5ms. The further away the control pulse is from the stopped position (1.5ms), the faster the servo will go up to the limits of about 0.5ms to 2.5ms.

    Keep in mind that the servos need to see the pulse repeated about every 20ms or they'll stop. Your little program fragment sends just one pulse. If you want the servos to continue moving, you need to put the .writeMicroseconds call into a loop with a 20ms pause also in the loop. The number of times in the loop defines how long the servos will move. 50 times through a for statement will come to about one second.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-04-12 15:26
    As this isn't code from the Boe-Shield Bot page, first try the example exactly as printed. That would be more useful as a reference because what you posted is only a fragment and not possible to know what else is in your sketch that could be affecting things.

    Use the full ForwardLeftRightBackward example on this page for your test:

    http://learn.parallax.com/node/219

    Mike's response, while well intended, is not applicable to the Arduino. You're already using the Arduino Servo library, which does all the pulse timing. He's referring to when using a controller like the BASIC Stamp.

    -- Gordon
  • Cubuntu28Cubuntu28 Posts: 7
    edited 2012-04-12 15:47
    Thank you both, here is a sketch from the guide.http://learn.parallax.com/node/219 The bot will not go backwards using this sketch either. This is due to the left servo not working, (To clarify the bot has no problem moving forward.)

    EDIT Sketch titled "Robotics with the BOE Shield - ForwardLeftRightBackward"
  • Martin_HMartin_H Posts: 4,051
    edited 2012-04-12 16:07
    Out of curiosity. Try sending the left servo a center setting and see what happens. Does it stay still or does it creep forward? I've had servos I thought were centered get misaligned and then they will only turn one way.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-04-12 16:07
    Sorry, Gordon and Cubuntu28. Actually, I had based my comments on the Arduino, but using some simple library routines for pauses and single pulses like the equivalents for the Stamps. The example sketches you referenced should indeed work. Try re-centering the servos again, particularly the problematic left one. The whole purpose of this operation is to have the servo stop with a pulse width of exactly 1500us. It should rotate in one direction with a pulse width of 1300us and about the same speed in the other direction with a pulse width of 1700us as shown in the 2nd sketch you referenced.
  • Cubuntu28Cubuntu28 Posts: 7
    edited 2012-04-12 16:21
    Thank you everyone! My mistake, the sketch I was using to center the left servo was incorrect :blank: , and once I fixed that everything else is working fine. :)
Sign In or Register to comment.