Introduction: SUPER SIMPLE BEGINNERS ROBOT II (ARDUINO UNO VER.)

Picture of SUPER SIMPLE BEGINNERS ROBOT II (ARDUINO UNO VER.)

This 'ible is based on my pretty popular SUPER SIMPLE BEGINNERS ROBOT 'ible. After many, many requests to provide an updated Arduino version, here it is!

I created this Instructable, and its predecessor, for the absolute n00by robot wannabe. There seems to still be a large number of beginners getting into the hobby and the number of "how do I..." questions seem to be be about the same as always. Maybe this humble little Instructable will help one or two create their first robot. You will find basic source code at the end of this Instructable.

This little robot is nothing more than a simple plywood platform that carries a couple of modified model airplane servos as the main drive system, an Arduino UNO microcontroller and a IR sensor. You should be able to build it in about two hours if you have the parts on hand.

The microcontroller I chose is the Arduino UNO R2. The Arduino is by far the most popular and widely used microcontroller ever!

I picked this micro because the thousands of online projects and sample codes make it easy for the beginner to get up and running today. They can be found from any of the major robot parts suppliers for usually less than 25 bucks. Get a starter kit that has a programming cable and battery clip included.

My time to make 1.5 hours.

My cost 60 dollars. Unless you are frugal and a good shopper, expect 85 dollars or so.

Thanks for reading and SEND ME A PIC OF YOUR SSBR II, PLEASE.

Ted

Step 1: Gather Tools and Materials

Picture of Gather Tools and Materials

MATERIALS

To construct the SSBR II you will need the following items:

(All parts may be substituted with similar items...)

a) 1 Arduino UNO R2 or R3 with 9 volt battery cable. Approx $20 ea.

b) 1 Sensor shield or similar. There are several choices. Approx $15 ea.

c) 2 Continuous rotation hobby servos. Approx $12 ea.

d) 2 Servo wheels, 2-1/2" diameter. Approx $5 pr.

e) 1 Sharp GP2D12 (or similar GP2Y0A21YK0F) IR analog distance sensor. Approx $11.

f) 1 JST to female connector. Approx $1.25.

g) 1 Model Airplane Tail Wheel Assembly, Dubro. Approx $5.

h) 1 1/4" Plywood, any variety but quality pays off... I paid $8 for a 12" X 24" piece of birch. (Approx 16 robots, $.50 per)

i) 1 9 volt battery. Approx $2.

j) Misc hardware. 8 1/2" 4-40 screws, 4 5/8" 4-40 screws, 4 1-1/4" 4-40 female female standoffs. Approx $2

Total Cost

Approx $85.00.

TOOLS

You wont need much for tools to build the SSBR II but you will need a few things as follows:

Some sort of saw to cleanly cut the plywood. (Table saw, Chop saw, Skill Saw, Jig saw, Hand saw...)

A small drill or Dremel, with drill bits, to drill mounting holes.

A small screwdriver.

Super Glue.

Ruler.

Pencil.

RESOURCES

adafruit arduino (make sure to get a programming cable and battery clip)

parallax servos

parallax wheels

pololu jst cable

amazon sensor shield

Step 2: Cutting the Wood Chassis

Picture of Cutting the Wood Chassis

To get started building the SSBR II, you will need to cut out the two pieces of 1/4 inch plywood that make up the robot chassis.

For sizes, I used 2-15/16 inch wide by 3-1/2 inch long as the base and 2-15/16 inch wide by 1-1/2 inch long as the front sensor mount. There was a method to my madness in selecting these sizes... A mini sumo robot must fit in a 10 cm X 10 cm square (approx 4 inch X 4 inch). With a little reconfiguration and careful construction, I could have a passable mini sumo competition robot.

After measuring the width of my servos, with wheels mounted, I calculated that a base width of 2-15/16" would net a robot just a hair shy of 4 inches wide after assembly.

TOOLS

Ruler

Pencil

Saw

MATERIAL

1/4 inch plywood. The better the quality, the better the end result.

CUTS

Base - 2-15/16" X 3-1/2"

Sensor Mount - 2-15/16" X 1-1/2"

Using whatever you have for a saw, cut the above pieces out of your plywood carefully. It is important that your cuts are square.

SAFETY - Always wear safety glasses when using tools. Always wear hearing protection when using power tools.

Step 3: Laying Out and Drilling the Screw Holes

Picture of Laying Out and Drilling the Screw Holes

In this step we are going to layout and drill all of the necessary mounting holes for the tail wheel, Arduino UNO and the Sharp sensor.

TOOLS

Ruler

Pencil

Drill w/bits

BASE PLYWOOD MARKING

Start by finding and marking a center line down the length on what will be the upper surface of the base plywood.

Next, lay the plastic tail wheel bracket over the rear of the base plywood, allowing it to hang over the end of the plywood just enough for the axle hole to clear the plywood. Mark the two holes in the bracket with a pencil.

Now, lay the Arduino on the plywood and mark all four screw holes.

SENSOR MOUNT PLYWOOD MARKING

Finally, mark the sensor mounting holes about 1/2" from the top edge of the sensor mount plywood.

DRILLING

Now that everything is laid out and marked you can begin drilling the holes.

Using a 0.125" (1/8") drill bit and your choice of drill, carefully drill all the holes. It is a good practice to use a backer board to prevent tear out when drilling through wood.

4-40 is sized at 0.1120" which is 0.013" smaller than the holes you have drilled. This allows minor adjustment of hardware in case your layout was not spot on.

SAFETY -Always wear safety glasses when using tools. Always wear hearing protection when using power tools.

Step 4: Attach Hardware

Picture of Attach Hardware

TOOLS

Screwdriver

STANDOFFS

Using four 1/2" 4-40 screws and the four standoffs, attach the standoffs to the upper surface of the plywood base by passing the screws through the bottom of the plywood base.

TAIL WHEEL ASSEMBLY

Using the tail wheel assembly and two 5/8" 4-40 screws and nuts, attach the tail wheel bracket to the plywood base as shown. The nuts should be on the bottom side of the plywood base.

Step 5: Attach IR Sensor

Picture of Attach  IR Sensor

TOOLS

Screwdriver

SHARP IR

Using the Sharp IR sensor and two 5/8" 4-40 screws and nuts, attach the sensor to the sensor mount plywood as shown.

Step 6: Glue Sensor Mount to Chassis

Picture of Glue Sensor Mount to Chassis

TOOLS

Super Glue

SENSOR MOUNT TO BASE

Using a small bead of super glue on the top edge of the sensor mount, attach it to the underside of the plywood base as shown. be careful to make the edges flush as your are aligning the pieces.

SAFETY - CA type super glues have been known to cause allergic reactions in some people. Use only in a well ventilated area.

TIP - Store super glue in the refrigerator to extend its life greatly.

Step 7: Attach Servos

Picture of Attach Servos

TOOLS

Super glue

ATTACH SERVOS TO BASE

Using the servos and now completed robot chassis, glue the servos to the bottom of the base as shown in the picture.

Use just a small circle of super glue as you may want to take this creation apart later.

Carefully locate each servo housing flush with the edge of the base. If your cuts are square and the servos are aligned exactly with the edge, you wont have tracking problems caused by wheels being out of alignment.

Locate the servos as far forward as possible while being sure not to cover the standoff mounting screws. The axles should be closest to the front of the chassis and the wires should exit the servos to the front.

There should be approximately 1/8" gap between the servos if your plywood measurements and cuts were accurate. This gap is used to route the wires to the rear of the robot.

SAFETY - CA type super glues have been known to cause allergic reactions in some people. Use only in a well ventilated area.
TIP - Store super glue in the refrigerator to extend its life greatly.

Step 8: Attach Arduino UNO & Wheels

Picture of Attach Arduino UNO & Wheels

TOOLS

Screwdriver

WHEELS

If your wheels came with rubber traction bands, attach them.

Using the provided servo screws, attach a wheel to each servo.

Do not over tighten the servo screw and do not rotate the servo by hand. This can damage the internal gears.

ARDUINO UNO

Using four 1/2" 4-40 screws, loosely attach the Arduino UNO to the four standoffs as shown. Only tighten the screws after all four are started. It may be necessary to slightly loosen the standoffs from the bottom of the chassis if you cannot get the holes to line up. Once lined up, tighten all screws.

Step 9: Add Sensor Shield

Picture of Add Sensor Shield

TOOLS

N/A

SENSOR SHIELD

Attach your choice of sensor shield to the Arduino UNO by carefully lining up all of the pins and holes and pressing together.

NOTE - The sensor shield shown is my own creation and is not longer commercially available. There are many sensor shields to choose from that have the similar functionality of allowing direct plug in of various electronic components and standard wiring. See RESOURCES in Step 1.

Step 10: Wire It Up

Picture of Wire It Up

TOOLS

N/A

SERVOS

Plug the servo leads into the sensor shield at ports 5 and 6. These two ports just happen to be the ones I chose. You can use different ports as long as you alter the source code in the PROGRAMMING & CODE step.

Servo wires - Power P is Red, Ground G is Black and Signal S is White. Signal wires may also be orange or yellow depending on servo manufacturer. Make sure to orient the plug correctly on the sensor shield.

IR SENSOR

Plug the sensor leads into analog port A0 on your sensor shield. Again, you can use a different analog port as long as you alter the code later.

Sensor wires - Power P is Red, Ground G is Black and Signal S is White. Make sure to orient the plug correctly on the sensor shield.

BATTERY

On robots this small it can be a bit tricky trying to find a good location for the battery. On the SSBR II, there are a couple of suitable locations. One is to double sided tape or velcro the battery to the bottom of the servos and two would be to tape or velcro the battery under the Arduino UNO. Whichever location you choose, make sure your battery cable is long enough before you affix the battery.

I should point out that 9 volt batteries are a little under powered for a servo driven robot, but they will work. As you learn more about robotics, take the time to discover other power sources like lithium polymer batteries etc..

Although outside the scope of this 'ible, it is not only possible but recommended to use a separate power supply for the electronics and the servos. This could be accomplished by independently powering each servo with its own battery and the Arduino UNO with its own battery. Regardless of battery voltage, the grounds must all be tied together.

TIP - Always check wire connections at least three times... it prevents the release of the "Magic Smoke", trust me!

PS - If you don't know what the "Magic Smoke" is, just build robots for awhile and never check your connections, you will find it... or it will find you.

HINT - Look like a pro and tame your wires. No rats nests please.

Step 11: Programming & Code

Picture of Programming & Code

TOOLS

Arduino IDE

Programming Cable

THE CODE

If you haven't already done so, download and install the Arduino IDE from ARDUINO.

Copy and paste my source code below in to the Arduino IDE. There is also an SSBR II.ino file attached.

Plug the programming cable in to your PC and the Arduino UNO programming port.

Compile and send the program to the SSBR II.

This is very basic source code that allows the robot to move forward and miss obstacles to the left. It will be very easy to add to the robots behaviors as you progress.

SERVOS

Here is an absolute dummies guide to how continuous rotation servos work in our robots.

Servos work using PWM, Pulse Width Modulation. The below tables shows you what a pulse of X corresponds to in a standard 180 degree servo. Change the pulse and you change to stop location.

Pulse of 500 microseconds = 0.5 milliseconds and corresponds to about 0 degrees.
Pulse of 1500 microseconds = 1.5 milliseconds and corresponds to about 90 degrees.
Pulse of 2500 microseconds = 2.5 milliseconds and corresponds to about 180 degrees.

Using a continuous rotation servo, the above chart translates to. Change the pulse and you change the speed.

Pulse of 500 microseconds = 0.5 milliseconds and corresponds to about full reverse (or forward).
Pulse of 1500 microseconds = 1.5 milliseconds and corresponds to about all stop.
Pulse of 2500 microseconds = 2.5 milliseconds and corresponds to about full forward (or reverse).
Forward and reverse are dependent on the orientation you have mounted the servo, including which side of the robot.

Not all servos are equal and a pulse of 1500 does not always mean STOP. You need to play with the minimum, maximum and stop values, in code, for each and every servo.

IR DISTANCE SENSOR

The analog (uses voltage as opposed to 0-1) distance sensor used in this article responds with a digital number representing voltage relative to the distance to an obstacle.

You will find a lot of forum topics relating to converting this to an actual measurement, either in inches or centimeters... Don't worry about it. Unless you need to know the distance to some object it is not important. A simple GO-NO GO is more than sufficient to tell you if there is something needing to be avoided.

Hint - the smaller the reading, the further the object.

//CREATED BY TED MACY
//Dec. 5, 2014
//Free to all to use, share and change
//SUPER SIMPLE BEGINNERS ROBOT VERSION II

#include // Include servo library
Servo servoLeft; // Declare left servo
Servo servoRight; // Declare right servo
int IRpin = 0; // analog pin for reading the IR sensor
float IRread; // Floating point number to hold converted voltage as distance

void setup() {
Serial.begin(9600); // start the serial port
servoLeft.attach(5); // Attach left signal to P5
servoRight.attach(6); // Attach right signal to P6
}

void loop() {
GetDistance();
Serial.println(distance); // print the distance

if (IRread < 299) // NO OBSTACLE
{
forward();
}

if (IRread > 300) // OBSTACLE
{
lturn();
}

}
void GetDistance(){
IRread = analogRead(IRpin); // reads the value of the sharp sensor
Serial.println(IRread); // prints the value of the sensor to the serial monitor
delay(50); // delay to get stable readings
}

void lturn(){ // Create a left turn subroutine
servoLeft.write(1503);
servoRight.write(1000);
Serial.println("LEFT TURN");
}

void forward(){ // Create a forward subroutine
servoLeft.write(1995);
servoRight.write(1000);
Serial.println("FORWARD");

}

//BELOW NOT USED
void rturn(){ // Create a right turn subroutine
servoLeft.write(1995);
servoRight.write(1502);
}

void nogo(){ // Create a stop subroutine
servoLeft.write(1503);
servoRight.write(1502);
}

Step 12: Conclusion... (maybe)

Picture of Conclusion... (maybe)

So, what did we do?

Well, if you are a beginner, you cut some wood, drilled some holes, fastened a few parts together and created your first robot. Don't stop here! Add to it. Research a few different sensors and plug them in. Make it your own.

You could remove the tail wheel assembly, add a dozer blade and have a respectable mini sumo robot with a couple more sensors and a tweak of the code...

I hope you learned something from this little 'ible and that you think enough of it to favorite and follow it.

Please, feel free to ask questions and leave comments.

Thank you!

Ted, BIGBUG, CowboyCoder

Comments

MonkeyMania121 (author)2016-05-04

very nice tutorial. very descriptive, nice work

gogcoding (author)2014-12-28

I have tried the code, but it is not working. Help please.

BIGBUG (author)gogcoding2014-12-30

I just tested the code and it is working 10 X 10.

Are you using the exact same electronics and connections as the 'ible?

Ted

LeaneC (author)BIGBUG2015-12-01

sir can you post the circuit/schematic diagram for this project ?

mike1682 (author)2015-11-11

Question!? Would you happen to know if its possible to get one of those spy tanks that creates it own network to access your home network so you can have the bot go anywhere even if ur not near it! Also great video . Thanks!!

mike1682 (author)2015-11-11

Question!? Would you happen to know if its possible to get one of those spy tanks that creates it own network to access your home network so you can have the bot go anywhere even if ur not near it! Also great video . Thanks!!

RteyT (author)2015-08-13

Where exactly do you use the female to JST connector? I'm looking over the instructions and not finding where it's used and what it looks like, and I need to know before ordering parts so that I can order the right wire.

ChristopherP9 (author)2015-07-03

Hi there, Since i liked this tut so much (good to start with servos that have presetup gearing) I wanted to make the code a bit clearer for the servos and correct the routine a bit.

Even for continuous servos its still based on degrees for the servo library. So its as simple as this.

Range is from 0 > x >180.

0 = full speed clockwise

90 = neutral (stop)

180 = full speed counter.

So for foward at full speed, change the left and right to 0

Also for left, you need to do something called skid steering, (one wheel goes counter the other clockwise) so left goes counter (180) and right goes clock (0) to do a left turn.

ChristopherP9 (author)2015-07-02

hey bigbug, I tested your code and you didnt declare "distance" as a variable in the code or the file. I found this library.

http://playground.arduino.cc/Main/SharpIR

then I added this code to yours, this makes the measurements more accurate, and once i get a middle wheel of sorts tomorrow, ill test it out, however on the serial monitor it displays distance correctly and executes either foward or left.

//CREATED BY TED MACY
//Dec. 5, 2014

// Jul 3 2015 - IR values added by Chris Pieper
//Free to all to use, share and change
//SUPER SIMPLE BEGINNERS ROBOT VERSION II

#include <Servo.h> // Include servo library
#include <SharpIR.h>
#define ir A0
#define model 1080

boolean done=false;
SharpIR sharp(ir, 25, 93, model);

Servo servoLeft; // Declare left servo
Servo servoRight; // Declare right servo
int IRpin = 0; // analog pin for reading the IR sensor
float IRread; // Floating point number to hold converted voltage as distance

void setup() {
Serial.begin(9600); // start the serial port

servoLeft.attach(5); // Attach left signal to P5
servoRight.attach(6); // Attach right signal to P6
pinMode (ir, INPUT);
}

void loop() {
int dis=sharp.distance(); // this returns the distance to the object you're measuring

GetDistance();
Serial.println(dis); // print the distance

if (IRread < 299) // NO OBSTACLE
{
forward();
}

if (IRread > 300) // OBSTACLE
{
lturn();
}
}

void GetDistance(){
IRread = analogRead(IRpin); // reads the value of the sharp sensor
Serial.println(IRread); // prints the value of the sensor to the serial monitor
delay(50); // delay to get stable readings
}

void lturn(){ // Create a left turn subroutine
servoLeft.write(1503);
servoRight.write(1000);
Serial.println("LEFT TURN");
}

void forward(){ // Create a forward subroutine
servoLeft.write(1995);
servoRight.write(1000);
Serial.println("FORWARD");
}

gogcoding (author)2014-12-28

Great job, So I would like to have more details about the coding part. The previous one that you have seems more simple than that one. Because I do not see the robot moving. If you could help me that would be great, know that I am a beginner and want to build my first robot. Thank you for your help.

BIGBUG (author)gogcoding2014-12-30

Thank you.

There are no further code details... The provided source is extremely simple, even for a total beginner. What is the confusion you are having?

This code is much easier than the first robot, just a different language.

Ted

gogcoding (author)BIGBUG2015-01-13

Thank for getting back to me,

I copy and paste the code, but it says error. Could you please tell me how you make it work. You can inbox me since i inbox u.

About This Instructable

7,528views

46favorites

License:

Bio: Evil, Mad, Nerdy Robotics Experimenter!
More by BIGBUG:SUPER SIMPLE BEGINNERS ROBOT II (ARDUINO UNO VER.)Super Simple Beginners Robot!
Add instructable to: