This mini-course will assist you in completing the “hands on” requirements of the BSA Robotics Merit Badge entitled “Section 4: Design, build, program, test”.
Download the BSA Robotics Merit Badge Requirements Workbook [1]
This course uses the Boe-Bot Robot from Parallax Inc., a recommended robotics kit for this Merit Badge.
The Parallax Boe-bot robot kit is a comprehensive program that includes all the hardware, software, documentation, and support necessary to understand many aspects of engineering, mechatronics, and software development. Included with the Boe-bot kit is a comprehensive book entitled Robotics with the Boe-Bot. This book is available in hard-copy as well as free downloadable .pdf.
Robotics with the Boe-Bot contains much more technical information than what the Robotics Merit Badge requires.
This abbreviated series of lessons (gleaned from Robotics with the Boe-Bot) was created to encourage Scouts who are interested enough in robotics to obtain their Merit Badge, but not enough to go “too deep, too quickly”. For some of you, this may be the extent of your robotics adventure.
However, for the rest of you who get “hooked” after achieving the Badge, go ahead and dive right into Robotics with the Boe-Bot — a much larger and amazing world awaits!
This mini-course includes “Challenges” which are scenarios where you must come up with solutions, based on what you’ve learned while studying robotics. You’re encouraged to use Robotics with the Boe-Bot as a reference guide, should you want a more comprehensive explanation of the mini-course concepts.
You should complete at least Challenges #1 and #3.
Challenges #2 and #4 are “real-world” Challenges. You are highly encouraged to do these, as they demonstrate real-world issues that may/can be solved through the application of mobile, autonomous robotics technology.
You and your Counselor may wish to define two or more “Collaborative Design Challenges” that can be variations or extensions of the ”standard” Challenges. This is HIGHLY recommended and encouraged, as it involves “working as a team” between you, other Scouts and your Counselor.
And of course, another significant tenet of the Badge’s requirements is to document everything you do. That is what your Engineering Notebook is for - Use it liberally!
This mini-course is a set of web pages. You can browse through them using the menu at left, or using the links at the bottom of each page. If you want to save this mini-course on your local computer, or if you want to simply print it out, click on the "Printer-friendly version" link in the lower right corner of the page. Then, in your browser, choose File > Print or File > Save as to print or store the entire mini-course.
There are three main "environments" within your Robotics Laboratory. Each of these must be kept organized - otherwise you’ll have chaos. Chaos and robots do not go well together.
Building robots usually entails working with a wide variety of tools and components. Many problems can be avoided by simply keeping your work area clean and orderly. Among the items that you may be working with are:
Safety First!
In dealing with hardware, there is one primary safety rule:
ALWAYS WEAR SAFETY GLASSES!
You never know when one little part may pop up and get you. Don’t take the risk. Safety glasses are cheap insurance – invest in them!
You’ll be installing some software into your computer which will provide a method of getting computer code (that you will be writing or editing) deep down inside the “electronic brain” known as a microcontroller.
Think clearly about what you’re asking the code to do. Remember, when computer code is loaded into the microcontroller, the microcontroller will do exactly what you told it to do. And, with your microcontroller connected to hardware devices (like motors, etc), sometimes your programs may cause un-intended results — perhaps like driving your robot off the table. Don’t let that happen!
Keep your mind on what you’re doing at all times. Safety cannot be overemphasized! Something as simple as clipping component leads may result in injury. It’s possible to wire up a circuit that looks just fine, until power is applied. Then…poof!... you’ve let the “magic smoke” out.
Today you may be building a table-top robot. You may write a program that causes it to roll off the table and plummet to the floor. That’s bad enough. However, tomorrow you may be creating a control system for an automated airplane landing system. Failure on that scale is not an option. Think things through. And then think them through, again.
Follow the steps below to build your Boe-Bot robot chassis.
(1) robot chassis
(4) 1″ standoffs
(4) pan-head screws, 1/4″ 4-40
(1) rubber grommet, 13/32″
(2) Parallax continuous rotation servos.
(1) Boe-Bot Chassis, partially assembled.
(2) Parallax continuous rotation servos
(8) pan Head Screws, 3/8″ 4-40
(8) nuts, 4-40
masking tape
pen
(2) flat-head Phillips screws, 3/8″ 4-40
(2) nuts, 4-40
(1) 4-cell battery pack with 2.1 mm center-positive plug
(1) 1/16″ cotter pin
(1) tail wheel ball
(2) rubber band tires
(2) plastic machined wheels
(2) screws saved when removing the servo horns
The brain of your robot is a tiny computer called the BASIC Stamp microcontroller.
The BASIC Stamp plugs into the Board of Education development board. It lets you easily connect the BASIC Stamp to:
Mount the Board of Education to the Boe-Bot's standoffs as shown, using (4) 4-40 pan head screws.
Servos are a special type of motor. They come in two different types: standard and continuous rotation. Standard servos rotate to a specific point (and stay there) based on the input signal. These types are widely used in radio controlled (RC) applications. For the Boe-Bot drive wheels, we’re using the continuous type.
Continuous rotation servos need be calibrated or “centered”. If a servo has not yet been centered, it may turn, vibrate, or make a humming noise when it receives the “stay-still” signal from the microcontroller.
You will use a small Phillips screwdriver to adjust the servos so that they actually stay still while receiving the “stay-still” signal from the BASIC Stamp microcontroller. We call this centering the servos.
You’ll need the Phillips screwdriver that came with your Boe-Bot kit (Phillips with a 1/8 inch (3.18 mm) or smaller shaft).
DO speedLeft = 0 speedRight = 0 time = 30000 GOSUB Wheel_Speeds LOOP
Your Boe-Bot may start spinning one or both wheels, in either direction.
This short program is sending the “center off” command to each of the servos, and by fine-tuning both of them, they will be completely stopped when this command is received by the servos.
Your Boe-Bot’s servos should now be calibrated and "centered".
Building Circuits on a Breadboard
The white grid on the Board of Education is called a "breadboard." You will use this board to plug in little wires and electronic components to build circuits. How does a breadboard work, and why is it called a breadboard, anyway?
In a moment, you will get to build a circuit on your Boe-Bot's breadboard. Circuits are described with line drawings called "schematics." This video shows you how to look at a schematic and build that circuit on a breadboard.
Ok, now it's your turn. This is about as simple a hardware circuit as we can get.
On the left is the schematic symbol for a small "beeper" - a device that will emit a tone when given a series of pulses from an electronic circuit. The right image is what the beeper physically looks like.
This is the schematic diagram of the circuit that we're going to build. It shows the inter-connections of the circuit components. In this case, the "+" side of the beeper is connected to a signal line called "P4" (whose connection is available alongside the breadboard area of the Board of Education)
This is a pictorial diagram of what your completed circuit should look like when you're done...
This completes the "hardware" portion of this circuit. However, for anything to happen, we need to introduce some "intelligence" (a program) to cause it to do something...
' {$STAMP BS2} x VAR Byte FOR x = 0 TO 20 HIGH 4 LOW 4 NEXT STOP
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”?
So what did you discover? Can you control the speed of both motors independently and simultaneously?
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.
(Hint: Chapter 4 in Robotics with the Boe-Bot)
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.
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.
Have you ever stumbled around in complete darkness, to the point where you stretch your hands out in front of you to avoid tripping over something you can’t see? Well, right now your Boe-Bot is completely blind. We can’t give him eyes just yet, but we can give him a simple form of touch with what we call “whiskers”.
This is a schematic diagram of the circuit that we’re going to build. It shows the electrical connections between the individual components. Don’t panic! It’s not as difficult as it looks.
It would be good practice to draw this schematic in your Notebook because you may wish to alter some of the connections later. Note that the dots indicate that there is an electrical connection at that juncture. If two lines cross — with no dot — they are not electrically connected.
Here are the components that we’ll be using to build it:
The resistors (the components with the color bands on them) are as follows:
Each of those wires extending out past the Boe-Bot's body act as the contact switches (labeled Right Whisker and Left Whisker).
A Debug Terminal should open up, like this:
You’ve downloaded a program into the microcontroller. The program (inside the microcontroller) is constantly checking to see if the whiskers have touched anything. If not, the display simply shows “zeros”. If they do touch something then the microcontroller sends a signal from the robot, through the cable, and into the window showing us (on the screen) a “1” signal from either of the two whisker “sensors”.
This simple exercise shows how a “real world” collision can be detected by your robot.
The trick now is to give your Boe-Bot the ability to not only detect the whisker’s touch, but to also give it the ability to take “evasive” action.
This is simple intelligence. You’re giving your robot the ability to make a decision.
What happens just after you press Run?
What happens when you press the whisker enough to cause it to touch the 3-pin connector on the breadboard?
Let’s take look at the program:
DO GOSUB Check_Whiskers IF whiskerLeft = 1 THEN speedLeft = -30 ELSE speedLeft = 0 IF whiskerRight = 1 THEN speedRight = -30 ELSE speedRight = 0 time = 20 GOSUB Wheel_Speeds LOOP
Here we have another “DO…LOOP”, so the program is going to DO something and then it’s going to LOOP back and DO it again.
“GOSUB Check_Whiskers” is where the program jumps to another part of the code (not shown on our screen) to check whether either one of the whiskers is touching something. If one of the whiskers detects a collision, then it will show up as a “1”. Conversely, if there is no contact, it will show up as a “0”.
Therefore, the line of code…
IF whiskerLeft = 1 THEN speedLeft = -30 ELSE speedLeft = 0
…is executed as follows:
“If the Left whisker touches something then the speed of the left wheel will be turned on (backward), at a speed of -30. Else (otherwise), if the Left whisker doesn’t touch anything, the servo remains off”.
And then of course, “whiskerRight” should react the same for the right wheel.
Your Boe-Bot is sitting there, waiting for something to touch its whiskers. When something (or someone) does, the Boe-Bot backs away from the offender.
Right now, your Boe-Bot is just sitting there waiting to have one of its whiskers touched. And once a whisker is touched, the machine wants to back away from whatever is touching it.
This is a classic "detect and avoid" application where the robot can roam freely about, and hopefully! never get stuck!
Thankfully, all three librarians are safe after their grueling, seven hour ordeal.
Early reports reveal that they were in the process of re-stocking shelves, when they inadvertently wandered into the Reference Section. It seems that the day shift was unable to finish re-shelving their books and left some on the floor. Oddly, each of the books was stood on edge. This presented a navigational challenge for the librarians – they got disoriented and were stuck in that aisle until help arrived, many hours later.
You’ve been hired to prevent this from ever happening again. The Librarians must have a “rescue bot” that can be deployed to show them the way out, should this situation ever happen again.
Keep track of things that didn’t work too. Sometimes there’s a “happy accident” — a solution that happens by virtue of a mistake. At the very least, you’ll be able to keep track of methods that don’t work, but sometimes mistakes can end up “shining the light” on a whole new solution.
How about trying to see how straight you can make the robot go. What can you do to the program that would make it go completely straight?
We've only scratched the surface of what robots are capable of. You are encouraged to “dive deeper” by going through Robotics with the Boe-Bot in its entirety. Doing so will open you mind to what is possible in the world of robots. Also, don’t think that a “little robot” is just a “toy”. The only thing different between a Boe-Bot and a human-sized robot (like in the movies) is the scale.
The Hardware, Software, and programming concepts are the same. What you've learned on a small scale is directly applicable to a large scale.
As always, document everything you do - Use your Engineering Notebook! From the idea stage, through the design, prototype, and testing stages - you never know when an unintended "accident" may become a "really cool feature" for you robot's capabilities.
Links
[1] http://meritbadge.org/wiki/images/7/7a/Robotics.pdf
[2] https://learn.parallax.com/programs/robotics-merit-badge-counselor-info
[3] https://www.parallax.com/product/boe-bot-robot-kit-usb/
[4] http://www.parallax.com/go/boe-bot
[5] http://www.parallax.com/basicstampsoftware
[6] https://learn.parallax.com/sites/default/files/content/sic_mini/BSA-Boe-Bot/Center%20Servos.zip
[7] https://learn.parallax.com/sites/default/files/content/sic_mini/BSA-Boe-Bot/Test%20Whiskers%20%2802%29.zip
[8] https://learn.parallax.com/sites/default/files/content/sic_mini/BSA-Boe-Bot/Whisker%20Press%20Bot%20%2802%29.zip