Introduction: Arduino Rc Tank

This is a phone controlled(via Bluetooth) Arduino Rc tank. Runs without much difficulty on most of the terrains.

Step 1: Get the Parts:-

Hardware required:-
Arduino Uno R3
Arduino motor driver shield
Geared motors x4
Hc-05 Bluetooth module
Battery tray(8x1.5v)
Jumper wires
Chassis and wheels with tracks
Arduino enclosure(optional for safety)
wires
Batteries
Smartphone
Power jacks(optional)
Tools required:-(makes everything easier because you won't be going to do every single thing by your BareHands)
Soldering iron
Solder wire
Flathead screwdriver
others as per your convenience

Step 2: Prepare Everything:-

Build the chassis completely.
Prepare your shield(if you have to assemble it)

Step 3: Building It:-

Insert the motor shield on the Arduino.
Insert jumper wires into the Hc-05.

Connect the Gnd pin into the Gnd port on the shield and the Vcc port on the 5v(Vcc) on the shield. The Txd pin on arduino's 0pin and the Rxd on 1 pin(you may have to flip the position of those two if it doesn't work because my works in this way. every module has different configuration). I soldered the wires into the pins directly because i didn't have ports and to make it more secure.

Add the power cable to the EXT_PWR on the shield.

Join each motor to its respected ports 1,2,3 and 4 with correct polarity for all

I used power jacks to make connections easier.

Step 4: The Code:-

Connect your Arduino to your preferred device and upload the code.
pls modify the code as per your convenience and your parts because you will not find the exact parts.


Code:-

#include
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);

char command;

void setup()

{
Serial.begin(9600); // Set the baud rate to your Bluetooth module
}

void loop(){
if(Serial.available(),>0){
command=Serial.read();
Stop(); // initialize with motors stopped
//Change pin mode only if new command is different from previous.
//Serial.printIn(command);
switch(command) {
case 'F':
forward();
break;
case 'B':
back();
break;
case 'L':
left();
break;
case 'R':
right();
break;
case 'G':
forwardleft();
break;
case 'I':
forward right();
break;
case 'H':
:backleft();
break;
case 'J':
:backright();
break;
}
}
}

void forward()
{
motor1.setSpeed(255);
motor1.run(FORWARD);
motor2.setSpeed(255);
motor2.run(FORWARD);
motor3.setSpeed(255);
motor3.run(FORWARD);
motor4.setSpeed(255);
motor4.run(FORWARD);
}

void back()
{
motor1.setSpeed(255);
motor1.run(BACKWARD);
motor2.setSpeed(255);
motor2.run(BACKWARD);
motor3.setSpeed(255);
motor3.run(BACKWARD);
motor4.setSpeed(255);
motor4.run(BACKWARD);
}

void left()
{
motor1.setSpeed(0);
motor1.run(RELEASE);
motor2.setSpeed(0);
motor2.run(RELEASE);
motor3.setSpeed(255);
motor3.run(FORWARD);
motor4.setSpeed(255);
motor4.run(FORWARD);
}

void right()
{
motor1.setSpeed(255);
motor1.run(FORWARD);
motor2.setSpeed(255);
motor2.run(FORWARD);
motor3.setSpeed(0);
motor3.run(RELEASE);
motor4.setSpeed(0);
motor4.run(RELEASE);
}

void forwardleft()
{
motor1.setSpeed(240);
motor1.run(FORWARD);
motor2.setSpeed(240);
motor2.run(FORWARD);
motor3.setSpeed(255);
motor3.run(FORWARD);
motor4.setSpeed(255);
motor4.run(FORWARD);
}

void forwardright()
{
motor1.setSpeed(255);
motor1.run(FORWARD);
motor2.setSpeed(255);
motor2.run(FORWARD);
motor3.setSpeed(240);
motor3.run(FORWARD);
motor4.setSpeed(240);
motor4.run(FORWARD);
}

void backleft()
{
motor1.setSpeed(240);
motor1.run(BACKWARD);
motor2.setSpeed(240);
motor2.run(BACKWARD);
motor3.setSpeed(255);
motor3.run(BACKWARD);
motor4.setSpeed(255);
motor4.run(BACKWARD);
}

void backright()
{
motor1.setSpeed(255);
motor1.run(BACKWARD);
motor2.setSpeed(255);
motor2.run(BACKWARD);
motor3.setSpeed(240);
motor3.run(BACKWARD);
motor4.setSpeed(240);
motor4.run(BACKWARD);
}

void Stop()
{
motor1.setSpeed(0);
motor1.run(RELEASE);
motor2.setSpeed(0);
motor2.run(RELEASE);
motor3.setSpeed(0);
motor3.run(RELEASE);
motor4.setSpeed(0);
motor4.run(RELEASE);
}





pls change the motor values as per your convenience and motors

Step 5: App for Your Phone:-

Download Bluetooth rc car
other will also work but you will have to set the commands accordingly

Step 6: Have Fun

I apologize for any mistakes as this is my first instructable
If you find any difficulty then feel free to ask. i will try to make its upgraded version soon.
Pls vote for my project as i am entering it in the robotics contest.
Thank you

Comments

author
spyq made it!(author)2016-05-10

Where did you find the chassis and wheels that you used?

author
Tanmaysrivastava made it!(author)2016-05-11

Sorry for the inconvenience but the library is the Adafruit motor library.
Yes, as i live in india, so foind this chassis only here in india. The chassis and wheels and tracks are made by Robosoft systems here in india. If you want to buy the complete thing then it is for sale. Its just for 45$ that excludes shipping.I now sell this to people so if you want to but one contact me in the comments. The version 2 is in progress. So wait for it. Thx

author
WaqasF made it!(author)2017-02-12

you have to download the adafruit motor driver shield libraryand extract it to folder where its install library folder

author
WaqasF made it!(author)2017-02-12

i have made it but motor driver shield has two servo connection i want to control servos also give me the code addition to it

author
wold630 made it!(author)2016-04-26

I'm looking forward to the upgraded version! ;)

About This Instructable

1,794views

34favorites

License:

Bio: I am just a 16yr old teen who likes to make cool stuff and try new things. I am into gaming a lot but making ... More »
More by Tanmaysrivastava:Arduino Rc Tank
Add instructable to: