Arduino Rc Tank

About: 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 stuff is my passion. Hoping to create a thing one day that can change the world.

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

Share

    Recommendations

    • Pocket Sized Contest

      Pocket Sized Contest
    • Tape Contest

      Tape Contest
    • Epilog X Contest

      Epilog X Contest

    10 Discussions

    0
    None
    THUNDERF430

    Question 4 weeks ago on Step 2

    How hard is it to control this with a transmitter/receiver instead of a phone? I keep looking for something that's controller controlled (like normal) and doesn't require bluetooth (or a standard bluetooth transmitter controller). Problem is too many people want their phone. Unfortunately I'll figure it out eventually because I don't have the money to spend $200.

    4 answers
    0
    None
    TanmayS14THUNDERF430

    Answer 4 days ago

    Sorry for the late response I had almost left all this due to school. But now as I have finally completed school I will get back to my interests. I haven't gained much knowledge about coding but if you give me sometime I can post a new version of this tank with a separate controller made by using a 2nd Arduino. I wanted to this but couldn't find the drive to do it. Thanks to you I will get started again.
    About using a separate controller I don't think it should be much of a issue given that you find a comfortable casing to encase your controller in.
    Again I am not sure if I will be able to make it but I will try my best to make it without spending much. I already do have the required materials.

    0
    None
    THUNDERF430TanmayS14

    Reply 4 days ago

    Thx for the reply, I’m one step away from using Bluetooth instead of RC cause there doesn’t seem to be any truly non-remote controller projects, it’s all on a phone, which is stupid especially if you don’t design apps so you can’t modify it. I’m waiting on money (it’ll be a while) for a 3D printer so I can start prototyping. All my designs are done and I just need the parts and the code, but can’t get a printer yet so decided to work backward. Half the coding will be custom because it’s not going to function like anything before it, but it’s the RC function that I need. I’ll be glad if you can figure it out. No worry’s.

    0
    None
    TanmayS14THUNDERF430

    Reply 4 days ago

    On view of that I will try to make the code flexible enough that anyone can add extra functions as per their convenience simply by adding a separate code module in the main code. Once you make your custom RC vehicle please upload it I would love to see that. I wanted to buy a 3d printer as well but same issue as yours that is money. Just a suggestion if you don't mind, why don't you try making your RC vehicle without 3d printed parts and only hand crafted parts even though 3d prints are a lot more sturdy and easier to print once the final design is free of errors. That would reduce the costs greatly and people who can't have access to a 3d printer can also make it as well.

    0
    None
    THUNDERF430TanmayS14

    Reply 3 days ago

    I thought about that but the custom parts are impossible to create without a printer and even then it’ll be a very interesting experience (possible, just unique). Thx for the possible additions.

    0
    None
    spyq

    2 years ago

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

    2 replies
    0
    None
    Tanmaysrivastavaspyq

    Reply 2 years ago

    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

    0
    None
    WaqasFTanmaysrivastava

    Reply 2 years ago

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

    0
    None
    WaqasF

    2 years ago

    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

    0
    None
    wold630

    2 years ago

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