# Creeper Rover Robot

423

6

4

Published

## Introduction: Creeper Rover Robot

Hi, guys I'm back with this instructable as I said In my previous instructable about the minecraft challenge

## Step 1: Materials

For this instructable you will need...

1. Cardboard
2. 3 Servos
3. Some wires
4. Arduino Uno board(Or any other)
5. Ultrasonic sensor
6. 9v Battery and connector
7. Some wheels
9.Hardwork ;D

## Step 2: Body

Take your cardboard and cut it according the templates given above.
After cutting it glue the parts and paint the cardboard using a reference pic of a creeper.......

## Step 3: Arduino Schematic

This is the arduino schematic I used. I am using 2 continuous servos for the wheels and 1 normal servo for head.

## Step 4: Arduino Sketch

This is the arduino sketch...........

// Creeper Rover Bot
#include  //include Servo library
const int RForward = 0;
const int RBackward = 180;
const int LForward = RBackward;
const int LBackward = RForward;
const int RNeutral = 90;
const int LNeutral = 90; //constants for motor speed
const int pingPin = 7;
const int irPin = 0;  //Sharp infrared sensor pin
const int dangerThresh = 10; //threshold for obstacles (in cm)
int leftDistance, rightDistance; //distances on either side
Servo panMotor;
Servo leftMotor;
Servo rightMotor; //declare motors
long duration; //time it takes to recieve PING))) signal

void setup()
{
rightMotor.attach(11);
leftMotor.attach(10);
panMotor.attach(6); //attach motors to proper pins
panMotor.write(90); //set PING))) pan to center
}

void loop()
{
int distanceFwd = ping();
if (distanceFwd>dangerThresh) //if path is clear
{
leftMotor.write(LForward);
rightMotor.write(RForward); //move forward
}
else //if path is blocked
{
leftMotor.write(LNeutral);
rightMotor.write(RNeutral);
panMotor.write(0);
delay(500);
rightDistance = ping(); //scan to the right
delay(500);
panMotor.write(180);
delay(700);
leftDistance = ping(); //scan to the left
delay(500);
delay(100);
compareDistance();
}
}

void compareDistance()
{
if (leftDistance>rightDistance) //if left is less obstructed
{
leftMotor.write(LBackward);
rightMotor.write(RForward); //turn left
delay(2000);
}
else if (rightDistance>leftDistance) //if right is less obstructed
{
leftMotor.write(LForward);
rightMotor.write(RBackward); //turn right
delay(2000);
}
else //if they are equally obstructed
{
leftMotor.write(LForward);
rightMotor.write(RBackward); //turn 180 degrees
delay(2000);
}
}

long ping()
{
// Send out PING))) signal pulse
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);

//Get duration it takes to receive echo
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);

//Convert duration into distance
return duration / 29 / 2;
}

## Step 5: Combine

Mix up your body and the electronics together and extend the wires of the ultrasonic sensor so it can make up to the face.

Make 2 holes at the eyes of the creepers face for the sensor....
Take the normal servo and glue it on its neck and attach creepers head to the servo shaft.

If you are getting any problem to fit your arduino inside the body you can use an attiny chip or you can prototype the arduino on a protoboard, there are many instructables on "how to prototype an arduino?"

## Step 6: HISSS ......BOOM....

Place it down and let it rover around your house...........

## Step 7: Thankings

Thank you for seeing this instructable and if you like it pls pls pls vote it in the Minecraft Challenge.....

## Recommendations

• ### Minecraft Class

4,591 Enrolled