Sponsored By Tormach

TSN BasicBot Part Four: Assembly and Tuning

November 14th, 2013 by

In the fourth part of the TSN BasicBot series, we will complete the assembly of  the CNC machined chassis, adding in the arduino microcontroller, breadboard, battery, and wire everything up. Next we will locate the center (zero) position of the modified servos using a simple arduino program.  Instructions for this STEM lesson are in order of assembly priority.

Getting Wired 

Now we will discuss the details of wiring up the various components so that your BasicBot functions as it should. As with any set of instructions, read through the entire procedure before proceeding. The BasicBot requires no special  knowledge in terms of wiring. An overall wiring diagram is shown below. Let’s find out how to make it work.



WARNING: Despite what you see in the illustration above, DO NOT use a 9 volt  rectangular battery for this project. It is incapable of providing enough current to run the robot. You can use a AA battery pack (6-12v) or lipoly battery of at least 1800 mah. For example, the pack pictured below has 8 AA batteries for a total of 12Volts.


Switch Harness

A switch is essential to power cycle the robot.It connects the battery to the robot. Here is how you build the switch wiring harness. You will need the following materials for this procedure:

12 inches each of 22 awg stranded wire

20 jumper wires

A reliable connector (we use Deans-style connectors)

A SPDT switch with two terminals

Heat Shrink Tube

Soldering Iron and Solder

Solder Fan (follow the link to learn how to make one)




Start by soldering a positive and negative (preferably red and black) wire to the MALE half of the plug. The FEMALE half goes on the battery. This should be remembered as a general rule for students to keep in mind whenever wiring connectors.


Cover the terminals completely with heat shrink tube to eliminate any chance of a short circuit.

2013-10-27 11.54.21 (2)

Solder two (+) red wires to the switch terminals and  cover with heat shrink tube. You will be left with two open ends. One will be joined to the red wire from the plug connector, the other will be pushed into the terminal of the breadboard to power up the ‘Bot. The dangling black wire from the connector will also go to the breadboard. Here is how it should look when finished.


The switch will be clipped securely between the middle and upper levels of the chassis as shown.


Secure the battery on the middle level of the chassis. Exact placement is not critical but use double sided tape, velcro or zip ties to ensure its stability during maneuvers. Pull the servo cables through and plug jumper wires into the plugs as shown.


Next attach the Arduino Uno to the upper level using nylon nuts and bolts. If you are bolting the arduino to a metal chassis piece use an extra nut directly underneath the board to keep it electrically isolated. Once the arduino is mounted, attach it along with the chassis to the standoffs to complete the third level.


Standoffs are used to elevate and secure the different platforms to one another. There are two types that we use in classroom projects. The first, and most versatile is simply a  bolt with a couple of extra nuts as shown below. This type of standoff can be fashioned easily and adjusted to any size at low cost. It is a bit more labor intensive to set up initially but works quite well overall.


The second type of standoff is purchased in specific lengths and hole sizes. Having an assortment of sizes handy will avoid unnecessary trips to the hardware store.  They are available with and without studs and in nearly any hole size. We use hex-shaped 4-40 standoffs on the BasicBot.


Both type of standoffs are shown side by side below for comparison.


Breadboard and VR

Behind the arduino the solderless breadboard will be attached. This is particularly easy because breadboards generally come with an adhesive back. Just peel it off and you are done. A 8.2cm x 5.5cm x .85cm board fits the BasicBot perfectly. Along with the breadboard a 5 volt regulator is needed. This is required because it is best practice NOT to power accessories from the pinouts on the arduino. We want to avoid glitches caused by excess power draw that can cause intermittent resets on the arduino, possibly damaging it. The regulator will permit us to pull a steady 5 volts from the breadboard for the servos (and sensors we will add later), while providing the arduino with reliable power. WARNING: The regular will get warm, possibly very hot during use as it changes excess voltage to heat. Do not touch it.


In these days of inexpensive electronic components, you may elect to add an LED voltmeter to the BasicBot. Available for less than ten dollars shipped, these provide an instantaneous readout of the current (no pun intended) state of your battery. They add some ‘bling’ as well. A standard digital multimeter is still essential for any robotics project. The two are devices are shown below.


Pull the jumper wires from the servos and run the signal wires (yellow or white) to pins 9 and 11. Twist the red and black(orange/brown) together and run them to the ground and 5V power rail on the breadboard.


The battery wires go the opposite rail as shown in the wiring diagram. This forms two separate power rails, a 12V for arduino power and 5V for accessories. If you are using one, the LED voltmeter is connected to the 5V rail as shown below. Remember to  refer to the diagram at the top of the article for reference on the complete BasicBot wiring details.


Here is another look at the complete schematic (LED voltmeter not shown) for your convenience.


Double check that there are no loose or dangling wires, and switch on the power. If all is well, it should look like this:


On to programming!

Zeroing Out Your Servos


Modifying hobby servos generally means that the potentiometer is no longer able to provide positional feedback, so we must relocate the center point in its travel. This way we can consistently program servo direction and stop on a dime.

Open arduino IDE on your computer and create a blank sketch. Elevate the rear of the robot on a block and turn on the power. Plug the usb programming cable into the robot, then your computer. Download the ‘ServoCenterCalibrate‘ code below into the blank sketch and name it ‘servocenter’.

Run this program on one servo at a time.  The critical value is the angle of the servo, generally around 90 degrees. You will change the servo_left.write() value, starting at 90. You should start there and run the program, observing which direction the servo turns each time. The idea is to find the point where the servo reverses direction. Gradually you will get closer to the zero value, most likely going past it as you see the wheel reverse direction. Once this has occurred, you are very close. Slowly ratchet the number higher or lower, and then the servo will stop. This is the zero value for that servo. Take a piece of tape and write this number down, placing the tape near the servo. Proceed in the same way with the other motor. Remember to change the servo.attach() value for the other arduino pin.


The entire procedure is summarized in the video below.


The Box Test

Now we can put the servo calibration to good use with the Box Test. This is simply a program consisting of a series of straight lines and turns resulting in a box pattern. It indicates that the servos are running at the same speed and verifies that they can be stopped consistently. The code is found below with the rest of the downloads. Obviously you will need to incorporate values that work for your servos, but the numbers in the program should be close. Comments are contained in the program to describe the functions of each line of code for students to easily learn their way around programming arduino. See the video below for an example of a successful box test.


In creating the TSN BasicBot, your students have demonstrated many of the proficiencies in the Common Core and Next Generation Science standards. They have used advanced manufacturing to build robot components, learned arduino microcontroller programming, experimented with and refined their robot with genuine engineering practices. Next we will raise the bar by making the robot able to respond independently to its environment with sensors. Keep STEM alive in your school with TeachSTEM Now!




























Version: 1.0
1.2 KiB
Version: 1.0
809.0 B

One Trackback

  1. […] Read More… […]

Post a Comment

You must be logged in to post a comment.