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 Arduino Uno
1 X Dual DC Motor Driver with 20 Ah, 18 V tolerance
1 X SPDT / SPST switch (not momentary)
4 X 900 RPM High Torque DC motors
4 X Crocodile pincer clips (2 red, 2 black)
1 X Android device (smartphone or tablet)
Step 2: Tools That Come in Handy
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 flag=0; //makes sure that the serial only prints once the state
Serial.begin(9600); // initialize serial communication at 9600 bits per second
//if some date is sent, reads it and saves in state
if(Serial.available() > 0)
state = Serial.read();
if (state == 'w' || state == 'f')
if(flag == 0)
if (state == 's' || state == 'b')
if(flag == 0)
if (state == 'a' || state == 'r')
if(flag == 0)
if (state == 'd' || state == 'l')
if(flag == 0)
if(flag == 0)
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
- Drill a hole on the top face of the chassis using the 1cm wide drill bit.
- Assemble the whole chassis except for the top face.
- 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.
- Fix the motors using screws 3mm in diameter. Preferably use 3 screws per motor.
- Attach the wheels.
- Put the batteries behind each set of motors. (refer to pictures)
- Connect the inputs of the motor driver to their corresponding pins on the Arduino using jumper wires.
- 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.
- Connect VCC and GND of HC-05 to 3.3v and GND on the Arduino.
- Connect TX from HC-05 to RX of Arduino, and RX from HC-05 to TX of Arduino.
- Strip off one end of each of the crocodile pincers.
- Solder the stripped ends of both the red wires to a single pin on the ON/OFF switch.
- Solder a normal single strand wire to the other pin of the switch. (about 4 to 5 cm in length)
- Connect this normal wire to the VCC or positive port on the motor driver.
- Connect the stripped ends of the black crocodile pincers to the GND or negative port on the motor driver.
- Lastly, stick both boards onto the base plate of the chassis using double sided tape or nuts and bolts.
- 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.
- 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)
- 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! :-)
We have a be nice policy.
Please be positive and constructive.