Introduction: Arduino Autonomous Robot (Land Rover / Car) Stage1Model2

Mid August 2014 - I decided to pursue Robotics and build a large humanoid robot.
This robot would be built in several stages. Stage 1 is to build a Land Rover. Model1 in
Stage1 was the Land Rover without Microcontroller while Model2 is one with Microcontroller.
Attached are details of Microcontroller based Land Rover - I have made the rover from
scratch, including design the source code. The target to complete Model2 was mid October.
I'm glad this was completed earlier, thanks to the holidays in early October.

Step 1: Purchased the Chassis That Can Accommodate Either 4 Wheels or 2 Wheels and a Castor

I purchased most of the material, including this chassis from Vega Kit and Visha Electronics at Lamington Road, Mumbai, India

Step 2: Reverse of the Chassis

Step 3: Attached the 2 DC Motors to Chassis

Attached the 2 DC Motors (Geared 300 RPM BO motor) to both front clamps. I have
extended the wires from the motors through holes in the Chassis so can reuse the motors as I
deem fit, later, for other models

Step 4: Connected the Castor

Step 5: The Castor Wheel I Bought Had a Cover So Attached the Same

Step 6: L239D - Motor Driver Kit

L239D Motor Driver kit. Standard (and more expensive) motor driver shields for
Arduino are available on EBay and other Marketplaces. These are very easy to program with the readymade code available easily on Internet. I used the tougher route and got this kit from Electronic
Component Shop at Lamington Road, Mumbai, which is economical and will let me make my own
code as per my circuit design.

FYI, Motor Driver circuit is needed to control the power delivered to the motor as motors
take much more current and voltage than Microcontrollers and if we don't use Motor driver
circuit, Microcontroller would blow off in the process of trying to power the motors.

Step 7: One Pager Received With Motor Driver Kit

The one pager I received with the Motor driver kit. A lot of research on Google and
various forums on Motor Driver Shields and Kits and use of common sense made me realize that
there are 2 inputs for each motor. These inputs would come from Arduino

Step 8: Battery Holder

I got this from Simple Labs. You too can order it online.

Step 9: The Battery Holder Comes With ON-OFF Switch

This battery holder comes with ON-OFF switch, which is helpful in turning power ON
and OFF to the motor driver kit.

Step 10: Motor Driver Kit Has PWM to Control Motor Speed

Close up of the motor driver kit shows EN pins which are used for PWM (Pulse Width
Modulation) i.e. to control the voltage to the motors their by controlling the motor speed.

I wanted the enable to be high i.e. full voltage to be given to the motor to make my
program easy. I did not have a jumper and wanted to complete my Model2 robot today so made
one through the 2 yellow single strand wires which I soldered to the EN pins

Step 11: Enable Pins Shorted Through Homemade Jumper

Step 12: Arduino Compatiple (but Better) Board

Induino R3 board. This is Arduino compatible board with more components and better
control. I had bought this in January 2014 so decided to use the same for my robot. It is available from Simple Labs and you can order the same online like I did.

Step 13: Used Jumper Cables to Connect Motor Input to Arduino Board

I used jumper cables to connect the Motor Input connections so these can be easily connected to the Microcontroller board

Step 14: Motor Driver Kit Connected to Arduino

Motor inputs connected to Pin8 to Pin11 of the Microcontroller. I can control the
logic level of these Pins thus control the HIGH (Logic 1) or LOW (Logic 0) value being
shared with Motor Input connections thereby control not only the direction of current and
hence direction of the motor but also switch the current to motor ON or OFF thus start or
stop the motor

Step 15: The Motor Output Connections on the Motor Driver Kit Are Connected to Cables Connected to the Motors

Step 16: Both Boards Placed on the Chassis

Placed the 2 boards on the chassis with bubble wrap under it to ensure the metal chassis does not short the boards via the metallic underside of the board (metallic due to soldering.)

Step 17: Arduino IDE

Started the Arduino IDE - a place that enables us to write programs in English like language that are then transferred to the Microcontroller using USB cable.

Step 18: Program for Autonomous Bot

The program - it is a simple program that allows the bot to move forward for 3 seconds, halt then move backwards for 3 seconds, turn right for 3 seconds and then turn left for 3 seconds. I developed this program after about 15 hours of R&D. The great advantage of this program is that all my subroutines for moving forward, backward, turning, stopping, etc. are ready which would help me immensely in upcoming Models.

I have attached the program:

void setup() {
pinMode(8, OUTPUT); // Input1 of Motor1 set on Pin 8 of Arduino
pinMode(9, OUTPUT); // Input2 of Motor1 set on Pin 9 of Arduino

pinMode(10, OUTPUT); // Input1 of Motor2 set on Pin 10 of Arduino
pinMode(11, OUTPUT); // Input2 of Motor2 set on Pin 11 of Arduino

}
void loop() {
Halt(); // Stop both motors. This gives smooth motion by avoiding jumping of the motor while changing rotation immediately
Forward(); // Calling Forward Function which in turn calls Forward1 & Forward2 functions

delay(3000); // Delay of 3 seconds
Halt(); // Stop the Robot

delay(250); // Delay of 0.1 Seconds before starting any motor again to ensure smooth motion (no kick)

Reverse(); // Calling Reverse Function which in turn calls Reverse1 & Reverse2 functions

delay(3000); // Delay of 3 seconds
}
void Forward() { // Move Robot Forward i.e. both Motors moves Forward
Forward1(); // Motor1 moves Forward
delay(150); // Delay of 0.15 Seconds before second motor starts to avoid loading the batteries
Forward2(); // Motor2 moves Forward

}
void Reverse() { // Move Robot backwards i.e. both Motors moves Reverse
Reverse1(); // Motor1 moves backwards
delay(150); // Delay of 0.15 Seconds before second motor starts to avoid loading the batteries
Reverse2(); // Motor2 moves backwards

}
void Halt() { // Both Motors Stop (Not Break which is abrupt halt)
Halt1();
Halt2(); // Stop both motors. This gives smooth motion by avoiding jumping of the motor while changing rotation immediately

}

void Forward1() { // Motor1 moves Forward (Clockwise direction)
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
void Forward2() { // Motor2 moves Forward (Clockwise direction)
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
}
void Reverse1() { // Motor1 moves Reverse (Anti Clockwise)
digitalWrite(8, LOW);
digitalWrite(9, HIGH);

}
void Reverse2() { // Motor2 moves Reverse (Anti Clockwise)
digitalWrite(10, LOW);
digitalWrite(11, HIGH);

}
void Halt1() { // Motor1 Stop (Not Break which is abrupt halt)
digitalWrite(8, LOW);
digitalWrite(9, LOW);

}
void Halt2() { // Motor2 Stop (Not Break which is abrupt halt)
digitalWrite(10, LOW);
digitalWrite(11, LOW);

}
void Stop1() { // Motor1 Break i.e. abrupt halt
digitalWrite(8, LOW);
digitalWrite(9, LOW);

}
void Stop2() { // Motor2 Break i.e. abrupt halt
digitalWrite(10, LOW);
digitalWrite(11, LOW);

}

Step 19: Spacers - Professional Feel and Helps Route Wires Easily

Spacers - It is best to use these to separate the PCB from the metal chassis. These not only give a professional feel to the final product but also help in routing of the wires in the spaces between the board and chassis.

Step 20: PCB (in This Case Microcontroller) With Spacers

Step 21: Downloading the Program From Laptop to Arduino Board

Downloading the program from Laptop (remember the program we developed in the Arduino IDE?)

Step 22: The Autonomous Bot

Independent unit without laptop or USB cable. The Microcontroller board is powered by a 9v battery while the Motor Driver is powered by the Batteries in the Battery holder - this is because the Microcontroller board takes up a few tens of mA of current while the Motor Driver board and the DC Motors connected to the driver board take up 100's of mA of current which cannot be provided by the Power OUT Pin of the Microcontroller.

I have kept the power supplies separate in this model. In future models there would be one power supply.

Step 23: Video of the Bot