Sponsored By Tormach

TSN BasicBot Part 5: The Eyes Have It

December 1st, 2013 by

Students who are given the opportunity to work on long term, multidisciplinary STEM projects are the best hope for the US to fill the ranks of qualified job seekers in high demand STEM fields. The development of critical thinking skills that push students to integrate cross cutting concepts are an fundamental tenet of robotics in the classroom, making the concept of robotics an appealing one for teachers. Kids who work in teams toward a common, well-defined goal where everyone can contribute feel good about being a part of your STEM classroom.  The TSN BasicBot project makes it easy, taking students from start to finish with Computer Aided Manufacturing, electrical component wiring and testing, to assembly and now programming for autonomous navigation with sonar. This is the fifth part of the TSN BasicBot series and links to prior segments will be found within the text. There are several design and programming files available for download as well to give your students a starting point before moving off on their own.

This version of the BasicBot requires a few changes from the prior iteration, which could be programmed to navigate a set course but had no way of independently responding to its environment. We divide this fifth part of the lesson into the following segments:

Chassis Updates

Machining The Sonar Mount



Parts that are required in addition to the original version of the BasicBot  include:

9G micro servo motor

HC-SR04 ultrasonic sensor

12 jumper wires

Revised Upper Chassis

Sonar Mount



Let’s Begin.

The sonar sensor in the BasicBot has been designed to scan back and forth to give its better picture of the surrounding environment. The scanning is done by a small servo motor attached to the sonar mount. In order to accommodate the sonar and its servo motor, the upper section of the chassis has been revised to permit a clean low profile attachment of the servo to the robot. Thanks to the versatility of the BasicBot design, students can mix and match chassis components or add more levels to fit their own engineering requirements. The two chassis pieces are compared below, with the revised piece shown on the right.


Original BasicBot and Sonar Enhanced Top Levels

The new upper segment has proper hole spacing for an Arduino Uno R3 microcontroller as does the original. It will probably also work for similar controllers and clones as well due to the large number of holes and slots on the chassis. The chassis can be machined from aluminum or plastic, even cut on a laser engraver. Students can mix and match to learn different manufacturing techniques as shown below.  A machining tutorial for the chassis is found in part one.


Acrylic, Aluminum or Plastic, Take Your Pick

Machining the Sonar Mount

There are many inexpensive sonar sensors on the market today available at a low price. The HC-SRO4 sensor fits the bill with a low price(well under ten dollars shipped), accurate tracking and available arduino library files for testing. The sonar mount needs to be made from a non-conductive material or coated with one to avoid short circuits on the open pcb. We have had students make the mounts from aluminum after applying powder coating with success as well. The part is also easily made with a 3D printer. The video below shows how to use SprutCAM Computer Aided Machining software to prepare for machining the mount on a CNC mill. SprutCAM America offers teachers a very sophisticated, easy to use program at a very affordable price with free evaluations.


Machining from plastic. Coolant clears the chips and keeps the finish smooth.


3D printed from ABS


Insert sonar directly and fasten with double sided tape or #2 screws

Now that the parts are all machined and gathered together, we can begin wiring up the robot. Let’s start with our wiring diagram. Students need to study and discuss the function of each wire. If they have already created a basicbot, they should be prepared to point out differences between what they have and what will need to be changed. Can they explain the purpose of the 5 volt regulator? Why don’t we pull 5V directly from the arduino to power the servos and sonar? And so on.


The complete wiring diagram. We have added a servo and sonar sensor compared to the standard basicbot.


Details showing pinouts. Note the sharing of a common ground rail among the 5V accessories.


Take care to note the orientation of the breadboard in the schematic is flipped 180 degrees from the one on the robot photos. Use the 5V and 12V labels in the diagram.


Use size 2-56 bolts and nuts to attach the servo upside down to the upper chassis section.


Make note of the pin locations before attaching the sonar to the mount.


The ‘horn’ that came with the 9G servo is used to connect the motor to the sonar mount with a small screw that is driven through the plastic.


There are four wires on the sonar: VCC and GND will go the the 5V rail, while TRIG and ECHO are fed through to the arduino pins.


The sonar should turn freely without binding any of the wires.


Use tie wraps to keep things tidy and prevent wires from coming loose.

It always helps to have photos of a project from as many angles as possible, so here are a few to help with any wire routing questions.

20131202_172620  20131201_190331  20131201_190304

20131201_190331 20131201_190320  20131202_172558

Programming For Success

After you have checked wiring carefully, power up the robot and raise the wheels onto a platform. Open the arduino IDE and connect the robot to your computer via usb cable. If you have not already calibrated the servos, do so now. The sketch below will allow the BasicBot to navigate autonomously around obstacles within 1 meter or more. It can and should be altered by students to make the robot behave the way they wish. The comments written in the code itself are designed to be read by students as part of this lesson. Teachers should spend time going over these comments and the code with students to discuss alterations that can be made, and how they can  be expected to affect robot behavior. This technique can allow students to ‘reverse engineer’ how the code works by testing various parameters even if they have little programming experience. Take a look at the sample window below from the sketch. Student programmers should get in the habit of writing their own comments on all code they write.



Downloading the code from the link below will provide more comments to look over. Loading it on to the robot should result in behavior similar to that in the video:

This concludes the TeachSTEMNow BasicBot series. Students have had the opportunity for high-level STEM skill development, and this simple project should serve as a springboard for others to come. Be sure and visit prior and future STEM lessons on TeachSTEMNow for more hands-on, manufacturing-focused STEM projects for your classroom.


TSN BasicBotSonarCode
TSN BasicBotSonarCode
Version: 1.0
6.0 KiB
Version: 1.0
208.8 KiB
Version: 1.1
2.0 MiB

Post a Comment

You must be logged in to post a comment.