Introduction: Simple Arduino Robot

This is an easy to make robot that i made on a course with HackBergen (the local hackerspace in Bergen, Norway. instagram: HackBergen)
Sorry for the bad english. I'm only 14 years old and from Norway.
Please like and vote, that would helped a lot!!

Step 1: Materials and Tools

The materials you need is:

1 Solderless breadboard (http://www.robotmesh.com/microcontrollers/components/400-tie-point-interlocking-solderless-breadboard

1 Arduino Uno (https://www.sparkfun.com/products/11021)

2 Parallax continus servo https://www.parallax.com/product/900-00008

1 plate of MDF

1 2.1mm dc Plug (https://solarbotics.com/product/17442/)

1 6v aa battery holder (http://bentronics.com/index.php?main_page=product_info&cPath=16_85_145_151&products_id=636)


2 3d printed servo wheels (http://www.thingiverse.com/thing:19940) you can also use this (https://www.adafruit.com/products/167)

and some breadboard wiring.


Tools:

soldering iron

hotglue gun

screwdriver




Step 2: MDF:

Cut two 9x12 cm pieces of the MDF plate

Step 3: Monting Arduino and Breadboard

Use a drop of hotglue to mount the arduino and breadboard in place.

Step 4: Soldering

Solder your battery holder and your 2.1 mm DC plug

Step 5: Mounting the Servos

Before you mount the servo use the servo calibration code (


#include
Servo myservoLeft;
Servo myservoRight;
int pos = 90;
const int LeftCalibrate = 90;
const int RightCalibrate =90;
void setup() {
myservoLeft.attach(9); // attaches the servo on pin 9 to the servo object myservoRight.attach(6);
}
void loop() {
Calibrate();
delay(25);
}
void Calibrate();
{
myservoRight.write(RightCalibrate); myservoLeft.write(LeftCalibrate); delay(15);
}



and a screwdriver to get the servos to 90 degrees. Use some wire to connect power and ground frome the servo to the arduino and then the left servo signal pin to pin 9 and the right servo signal to pin 6. Then use the calibration code to calibrate the servos. Use hotglue to mount your servos like you can see on the pictures. Add the battery power to the breadboard and take the dc plug from the power on the breadboard. To hold the battery holder can you use some rubberbands to get a nice fit. When your servo is calibrated and mounted then you can mount the wheels and take a rubberband arround the wheel to get grip.

Step 6: Code

here is a example code i wrote myself (with a little bit of help)


#include
Servo myservoLeft;
Servo myservoRight;
const int LeftForward = 180;
const int RightForward = 0;
const int LeftBackwards = 0;
const int RightBackwards = 180;
int pos = 90; // variable to store the servo position
void setup() {
myservoLeft.attach(9); // attaches the servo on pin 9 to the servo object myservoRight.attach(6);
}
void loop() {
DriveForward();
delay(1000);
DriveForward();
delay(1000);
DriveLeft();
delay(650); //you may need to change this to get the robot to turn 90 degrees
BackUp();
delay(1000);
DriveRight();
delay(1000);
DriveLeft();
delay(650);
}
}
void DriveForward(){
myservoRight.write(RightForward); myservoLeft.write(LeftForward); delay(15);
}
void BackUp(){
myservoLeft.write(LeftBackwards); myservoRight.write(RightBackwards); delay(15);
}
void DriveLeft(){
myservoRight.write(RightForward); myservoLeft.write(RightForward); delay(15);
}
void DriveRight(){
myservoRight.write(LeftForward); myservoLeft.write(LeftForward); delay(15);
}





for future improvements you can add switches to detect when you bump into things