Introduction: Android App Controlled ATR (all Terrrain Racer)

The Bluetooth Controlled All Terrain Racer (BCATR) is a smooth blend of intelligence and ruggedness.

It is a 4 wheel drive powered by a pair of 12v 2200 mAh Li-Po batteries. 4 High Torque DC Motors give it a top speed of 900 RPM and 12 Kg/cm torque. The IR7843 MOSFET based dual DC motor driver can handle up to 20 amps and 18 volts.

Step 1: Gather the Components

1 X Multi-purpose PVC chassis

1 X Arduino Uno

2 X Lithium Polymer 11.1 V Rechargeable Battery 2200 mAh

1 X Dual DC Motor Driver with 20 Ah, 18 V tolerance

1 X SPDT / SPST switch (not momentary)

1 X HC-05 Bluetooth Module

4 X 11cm diameter wheels with rubber tread

4 X 900 RPM High Torque DC motors

4 X Crocodile pincer clips (2 red, 2 black)

1 pin Male to Female jumper wires

1 X Android device (smartphone or tablet)

Step 2: Tools That Come in Handy

Screwdriver set

Hot glue gun

Drill with 1 cm diameter bit

Soldering Iron (and lead)

Step 3: Arduino Code

int ldir = 2; // left direction pin

int lpwm = 5; // right PWM pin

int rdir = 3; // left direction pin

int rpwm = 6; // right PWM pin

int rs = 255; // right main speed

int ls = 255; // left main speed

int rts = 200; // right turn speed

int lts = 200; // left turn speed

#define f digitalWrite(ldir, HIGH); analogWrite(lpwm, ls); digitalWrite(rdir, HIGH); analogWrite(rpwm, rs); // forward #define b digitalWrite(ldir, LOW); analogWrite(lpwm, ls); digitalWrite(rdir, LOW); analogWrite(rpwm, rs); // backward

#define l digitalWrite(ldir, LOW); analogWrite(lpwm, lts); digitalWrite(rdir, HIGH); analogWrite(rpwm, rts); // left #define r digitalWrite(ldir, HIGH); analogWrite(lpwm, lts); digitalWrite(rdir, LOW); analogWrite(rpwm, rts); // right #define s analogWrite(lpwm, 0); analogWrite(rpwm, 0); // stop

#define d delay(50);

int state;

int flag=0; //makes sure that the serial only prints once the state

void setup()

{

pinMode(ldir, OUTPUT);

pinMode(lpwm, OUTPUT);

pinMode(rdir, OUTPUT);

pinMode(rpwm, OUTPUT);

Serial.begin(9600); // initialize serial communication at 9600 bits per second

}

void loop()

{

//if some date is sent, reads it and saves in state

if(Serial.available() > 0)

{

state = Serial.read();

flag=0;

}

if (state == 'w' || state == 'f')

{

f;d;

if(flag == 0)

{

Serial.println("Forward");

flag=1;

}

}

if (state == 's' || state == 'b')

{

b;d;

if(flag == 0)

{

Serial.println("Reverse");

flag=1;

}

}

if (state == 'a' || state == 'r')

{

l;d;

if(flag == 0)

{

Serial.println("Left");

flag=1;

}

}

if (state == 'd' || state == 'l')

{

r;d;

if(flag == 0)

{

Serial.println("Right");

flag=1;

}

}

else

{

s;

if(flag == 0)

{

Serial.println("");

flag=1;

}

}

}

Step 4: Android Code

I made the Android app on MIT App Inventor, so the code is in the form of screenshots. Once you've written the code, go to:

Build > Save .apk to my computer

Now transfer the file to you're Android device and install it.

Step 5: Hardware Assembly

  1. Drill a hole on the top face of the chassis using the 1cm wide drill bit.
  2. Assemble the whole chassis except for the top face.
  3. Attach 4 double spacers onto 4 points of the chassis in such a way so that the shocks from bounces don't make the other plates fall apart.
  4. Fix the motors using screws 3mm in diameter. Preferably use 3 screws per motor.
  5. Attach the wheels.
  6. Put the batteries behind each set of motors. (refer to pictures)
  7. Connect the inputs of the motor driver to their corresponding pins on the Arduino using jumper wires.
  8. Connect the wires of the motors to the corresponding ports on the motor driver. You may have to try different combinations before you get them in the right order.
  9. Connect VCC and GND of HC-05 to 3.3v and GND on the Arduino.
  10. Connect TX from HC-05 to RX of Arduino, and RX from HC-05 to TX of Arduino.
  11. Strip off one end of each of the crocodile pincers.
  12. Solder the stripped ends of both the red wires to a single pin on the ON/OFF switch.
  13. Solder a normal single strand wire to the other pin of the switch. (about 4 to 5 cm in length)
  14. Connect this normal wire to the VCC or positive port on the motor driver.
  15. Connect the stripped ends of the black crocodile pincers to the GND or negative port on the motor driver.
  16. Lastly, stick both boards onto the base plate of the chassis using double sided tape or nuts and bolts.
  17. It is also very important to secure all battery connections with hot glue. Failure to do so could result in a very dramatic and fatal short circuit.
  18. Once all this is done, unscrew one nut and washer from the SPST/SPDT switch and use it to attach the switch onto the top plate. (refer to pictures)
  19. Push only the small part of gold coloured circuitry of HC-05 through any slit in the top plate, and put a spot of hot glue to hold it in place. This way, the major circuitry is not directly exposed.

Step 6: Finishing Touches

Important note: Before uploading any code to the Arduino, unplug the TX and RX wires from HC-05. If you get an error while uploading, this is the most likely problem.

Now upload the code to the Arduino UNO.

Plug the wires back into their respective places and do a final check for any loose components.

Lastly, fix the top plate and put the screws.

Just to err on the side of caution, I also hot glued the corners of the front and rear plates.

Step 7: Test It!

My backyard, which has gravel and wood planks, was an ideal testing ground for BCATR. Watch the video below to see how 'Bots can fly!

Step 8: Alternatives

The components used in this project were the ones I thought most suitable. You could try substituting parts like wheels, switches, and even the chassis.

Batteries, development boards and motor drivers have to be chosen carefully with all circuitry in mind. I myself had to try 4 different motor drivers, 2 boards and batteries before achieving the desired result.

Heavy duty batteries like the ones used in this project are very costly and have to be handled with care. All precautions must be taken to prevent them from shorting.

I hope this tutorial helps you choose your project's components wisely, without wasting too much money.

Note: This project has been registered for the 'Make It Move' contest. Don't forget to vote! :-)

Hot Glue Challenge

Participated in the
Hot Glue Challenge

Move It

Participated in the
Move It