Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • BSA Robotics Merit Badge with the Boe-Bot

BSA Robotics Merit Badge with the Boe-Bot

Controlling the Speed of your Boe-Bot

Let’s take a moment and look at the program that we used before to center the servos:

DO
  speedLeft = 0
  speedRight = 0
  time = 30000
  GOSUB Wheel_Speeds
LOOP

First we have the command “DO”…

…and then five lines below that we see another command …”LOOP”.

This tells us that the program is going to “DO” something (whatever that is), and then it’s going to “LOOP” back up and DO “it” again.  In short, it looks that this program will continue to loop forever unless something interrupts it.

In between the DO and LOOP commands we have:

  speedLeft = 0
  speedRight = 0

This appears as though the speed of the Left and Right servos are set to a speed of “0” …fully stopped?  So what happened when we first ran this program and the servos were perhaps moving?  That’s why we adjusted the screw — we calibrated the mechanical device (the servo) to the program that is going to be controlling it.   Now when any program wants to turn the servos off, all it needs to do give the servo motor a control value of “0” and it’s stopped.

So what do you suppose happens if you change “speedleft = 0” to “speedleft = 100”?

  • Try it and see if you’re right.
  • How about changing the value from “100” to “27”?  Try it.
  • Try different values between 0 and 100 for both the speedLeft and speedRight parameters. Do you see a pattern?
  • Write your observations in your Engineering Notebook.

So what did you discover?  Can you control the speed of both motors independently and simultaneously? 

 

Challenge #1

  • Change the speed values so that the Boe-Bot rolls in a circle (causing both servos to turn) to the right. 
  • Next, fine tune your program, so that the Boe-Bot’s circle is approximately three feet in diameter. 
  • Now, alter your programs such that your robot is going in the opposite direction. 
  • Document these program changes and their results in your Engineering Notebook.

 

Challenge #2

There’s a critical safety issue when baby chickens escape from the protection of the hen house.  But, as luck would have it, you are part of the Chicken Protection Engineering Team (C-PET). Other team members are addressing such challenges as how to detect when a baby chick has “escaped”, and how to get Little Chicken safely back home. Your mission, should you decide to accept it, is to give your Boe-Bot the ability to temporarily “corral” the baby chick within an 18” diameter “safety zone”.  Once your Boe-Bot has established this zone, a suction hose (developed by another engineering team) will deploy, and whisk the baby chick away to safety.  For some inexplicable reason, your Project Manager informs you that part of your design specification requires your Boe-Bot to run in reverse.  Please be advised that no baby chicks shall be injured during this Design Challenge.

  • Change the values such that the Boe-Bot rolls backwards in a circle to the left that’s about eighteen inches in diameter, as quickly as it can go.
  • Write your Code for this Challenge in your Engineering Notebook.  Be sure to use comments throughout your programs.

(Hint: Chapter 4 in Robotics with the Boe-Bot)

 

Collaborative Design Challenge A

Discuss (with your Counselor) and define a Challenge that you’ll need to accomplish.  At a minimum, it should include making the Boe-Bot navigate some pre-determined path.

  • Document what the Challenge is that you’ve agreed upon.  Then, as you try different programs to accomplish the task(s), keep good notes on what works, what doesn’t, and what other observations and ideas that you encountered or came up with.  
  • Once you have a working version of the Code (that accomplishes the Challenge) be sure to give your program “comments” as well.  This will help you in the future when you’re trying to figure out what the program is doing (or supposed to be doing!) as each command is executed.

Servo motors are controlled devices.  They are “told” (electronically) what to do.  We call that type of connection “Output”.  That is to say that the servo is controlled by an output coming from the microcontroller.

In almost every microcontroller system however, it’s a two-way street.  There’s both Output (making something happen), and Input (being notified that something happened).

In the same way that we connected I/O lines (like P12 and P13) to the servos, we can also connect sensing circuitry to an I/O line as well.  That’s why they’re called “I/O lines” – each one (of the 16 available on the BASIC Stamp2), can be used either as an Input or an Output. 


Printer-friendly version
Build a Beeper Circuit
Prev
Input Gives your Robot a Sense of Touch
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress