In this tutorial, we will learn how to make an Arduino Tracked Robot. It is controlled by an Android mobile app. Android mobile app and Tracked Robot are connected through Bluetooth. The specialty of this is that it uses a tracked chassis kit. So it can be easily controlled on any surface.
You can watch the following video or read the written tutorial below.
Overview
This robot, made of YP100 Metal Tracked Robot Tank Chassis, can be controlled by Bluetooth up to a distance of 15 meters. This is controlled by an Android mobile APP. Instead of wheels, it has a track like a war tank, so it can travel in any terrain. Tracked robots can handle rough and uneven surfaces, including gravel, grass, or rocky terrain. This off-road capability is valuable in outdoor applications.
Components Needed
Before we begin, make sure you have gathered all the necessary components. The purchase links are in the description of my YouTube video.
- YP100 Metal Tracked Robot Tank Chassis
- Arduino Uno
- L298N Motor Driver
- HC-05 or HC-06 Bluetooth module
- Two 18650 Rechargeable Battery 3.7V
- 18650 Li-ion Battery Holder 2-Way
- Jumper wires
- Glue Gun
- Mobile device with the Arduino app installed
- DC Switch
Assemble the Robot Chassis
The first video shows how to assemble the YP100 Metal Tracked Robot Tank Chassis kit.
Tracked Robot Circuit Diagram
The next stage is connecting the electronics. The circuit diagram of this project is actually quite simple. As depicted in the circuit diagram, the procedure for connecting the module wires is further explained below. You can download this circuit diagram. For that, click on the download button below and download it. Small jumpers should be connected to ENA and ENB on the L298N motor driver you are using. It is connected by default when you buy it. Use two 3.7V 18659 li-ion batteries to provide power. Do not use more than two batteries. It cannot use 9V battery. If a 9V battery is used motors not working. The reason for that is that the 9V battery does not have enough amperage.
Connect the Motors to the L298N Motor Driver
In the tracked chassis kit, the tracks are connected to the 12V gear motor. Therefore, it requires more amperage to operate. Afterward, I used an L298N Motor Driver for this.
In this way, connect the wires of the gear motors to the motor power connectors of the l298N motor driver.
- Connect the right motor Red wire to the “OUT1” terminals on the L298N motor driver.
- Connect the right motor Black wire to the “OUT2” terminals on the motor driver.
- Connect the left motor Black wire to the “OUT3” terminals on the motor driver.
- Connect the left motor Red wire to the “OUT4” terminals on the motor driver.
Connect the Battery Power Connection
Use two 3.7V 18659 li-ion batteries to provide power. Do not use more than two batteries. It cannot use 9V battery. If a 9V battery is used, only the ultrasonic sensor and servo motor will work. Gear motor not working. The reason for that is that the 9V battery does not have enough amperage.
First solder the switch to the battery holder. Solder the red wire of the battery holder to one end of the switch and solder a red wire to the other end of the switch. Stick the switch to the battery holder with the glue gun.
- Connect the Red wire (+) of the battery holder to the 12V In of the L298N Motor Driver.
- Connect the Black wire (-) of the battery holder to the GND In of the L298N Motor Driver.
Connect the Arduino UNO to the L298N Driver
In this way, connect the digital pins of the Arduino board and the inputs of the L298N motor driver by jumper wires.
- Connect the IN1 pin of the motor driver to digital pin D5 on the Arduino.
- Connect the IN2 pin of the motor driver to digital pin D6 on the Arduino.
- Connect the IN3 pin of the motor driver to digital pin D10 on the Arduino.
- Connect the IN4 pin of the motor driver to digital pin D11 on the Arduino.
The Arduino board is powered by the L298N Motor driver.
- Connect the 12V Out connecter of the motor driver to VIN pin on the Arduino.
- Connect the GND connecter of the motor driver to GND pin on the Arduino.
Connecting the Bluetooth module ( HC-05 or HC-06 ) to the Arduino board
In this way, connect the Arduino board and the Bluetooth module by jumper wires.
- Connect the VIN (power) pin of the Bluetooth module to the 5V pin on the Arduino.
- Connect the GND (ground) pin of the Bluetooth module to the GND pin on the Arduino.
- Connect the TXD pin of the Bluetooth module to RX pin on the Arduino.
- Connect the RXD pin of the Bluetooth module TX pin on the Arduino.
When uploading the code to the Arduino board, the TX and RX wires of the Arduino board that are connected to the Bluetooth Module’s RXD and TXD should be temporarily disconnected. After the code is successfully uploaded, connect the wires again.
Upload the Arduino Sketch
- Before uploading the code, disconnect the RX and TX pins of the HC-05 Bluetooth module.
- After uploading the code, connect them again
Arduino Bluetooth RC car can be made without front light, backlight and horn. No need to modify Arduino code. Copy the following Arduino code and paste it into the new sketch in the Arduino IDE. Select the board and port and upload the code. If this is difficult to do, watch a tutorial video.
You can download the Arduino code and open it directly through the Arduino IDE. Click the Download button below to download the Arduino code
#define in1 5 //L298n Motor Driver pins.
#define in2 6
#define in3 10
#define in4 11
#define light_FR 14 //LED Front Right pin A0 for Arduino Uno
#define light_FL 15 //LED Front Left pin A1 for Arduino Uno
#define light_BR 16 //LED Back Right pin A2 for Arduino Uno
#define light_BL 17 //LED Back Left pin A3 for Arduino Uno
#define horn_Buzz 18 //Horn Buzzer pin A4 for Arduino Uno
int command; //Int to store app command state.
int Speed = 204; // 0 - 255.
int Speedsec;
int buttonState = 0;
int lastButtonState = 0;
int Turnradius = 0; //Set the radius of a turn, 0 - 255 Note:the robot will malfunction if this is higher than int Speed.
int brakeTime = 45;
int brkonoff = 1; //1 for the electronic braking system, 0 for normal.
boolean lightFront = false;
boolean lightBack = false;
boolean horn = false;
void setup() {
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(light_FR, OUTPUT);
pinMode(light_FL, OUTPUT);
pinMode(light_BR, OUTPUT);
pinMode(light_BL, OUTPUT);
pinMode(horn_Buzz, OUTPUT);
Serial.begin(115200); //Set the baud rate to your Bluetooth module.
}
void loop() {
if (Serial.available() > 0) {
command = Serial.read();
Stop(); //Initialize with motors stoped.
if (lightFront) {digitalWrite(light_FR, HIGH); digitalWrite(light_FL, HIGH);}
if (!lightFront) {digitalWrite(light_FR, LOW); digitalWrite(light_FL, LOW);}
if (lightBack) {digitalWrite(light_BR, HIGH); digitalWrite(light_BL, HIGH);}
if (!lightBack) {digitalWrite(light_BR, LOW); digitalWrite(light_BL, LOW);}
if (horn) {digitalWrite(horn_Buzz, HIGH);}
if (!horn) {digitalWrite(horn_Buzz, LOW);}
switch (command) {
case 'F':
forward();
break;
case 'B':
back();
break;
case 'L':
left();
break;
case 'R':
right();
break;
case 'G':
forwardleft();
break;
case 'I':
forwardright();
break;
case 'H':
backleft();
break;
case 'J':
backright();
break;
case '0':
Speed = 100;
break;
case '1':
Speed = 140;
break;
case '2':
Speed = 153;
break;
case '3':
Speed = 165;
break;
case '4':
Speed = 178;
break;
case '5':
Speed = 191;
break;
case '6':
Speed = 204;
break;
case '7':
Speed = 216;
break;
case '8':
Speed = 229;
break;
case '9':
Speed = 242;
break;
case 'q':
Speed = 255;
break;
case 'W':lightFront = true;break;
case 'w':lightFront = false;break;
case 'U':lightBack = true;break;
case 'u':lightBack = false;break;
case 'V':horn = true;break;
case 'v':horn = false;break;
}
Speedsec = Turnradius;
if (brkonoff == 1) {
brakeOn();
} else {
brakeOff();
}
}
}
void forward() {
analogWrite(in1, Speed);
analogWrite(in3, Speed);
}
void back() {
analogWrite(in2, Speed);
analogWrite(in4, Speed);
}
void left() {
analogWrite(in4, Speed);
analogWrite(in1, Speed);
}
void right() {
analogWrite(in3, Speed);
analogWrite(in2, Speed);
}
void forwardleft() {
analogWrite(in1, Speed);
analogWrite(in3, Speedsec);
}
void forwardright() {
analogWrite(in1, Speedsec);
analogWrite(in3, Speed);
}
void backright() {
analogWrite(in2, Speedsec);
analogWrite(in4, Speed);
}
void backleft() {
analogWrite(in2, Speed);
analogWrite(in4, Speedsec);
}
void Stop() {
analogWrite(in1, 0);
analogWrite(in2, 0);
analogWrite(in3, 0);
analogWrite(in4, 0);
}
void brakeOn() {
//Here's the future use: an electronic braking system!
// read the pushbutton input pin:
buttonState = command;
// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == 'S') {
if (lastButtonState != buttonState) {
digitalWrite(in1, HIGH);
digitalWrite(in2, HIGH);
digitalWrite(in3, HIGH);
digitalWrite(in4, HIGH);
delay(brakeTime);
Stop();
}
}
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;
}
}
void brakeOff() {
}
Code language: PHP (php)
Control Your Tracked Robot
Pair your mobile device with the HC-05 Bluetooth module and open the Bluetooth RC Control app. Connect to the module and start controlling your Tracked Robot wirelessly. You can use the app’s interface to send commands to your Tracked Robot and watch it move, turn, and speed control. If you find it difficult to connect Bluetooth properly, watch my YouTube video. The link of the Android app is given below.
Mobile App Link: https://play.google.com/store/apps/de…
- If the above link does not work, download the app from this Button
Conclusion
In conclusion, this comprehensive tutorial guides enthusiasts through the creation of a versatile Arduino Tracked Robot, featuring the YP100 Metal Tracked Robot Tank Chassis. The incorporation of a tracked chassis kit ensures adaptability to various terrains, offering robust performance in outdoor applications. The integration of a Bluetooth module enables wireless control through an Android mobile app, providing an engaging and interactive experience. Detailed instructions cover the connection of motors, power sources, and electronic components, enhancing the understanding of the assembly process. The inclusion of precautionary steps during Arduino code upload and troubleshooting tips, such as video tutorials, adds accessibility to the project. With the culmination of these steps, users can confidently control their Tracked Robot, witnessing its seamless movements and responsiveness to commands, showcasing the successful convergence of robotics, electronics, and mobile technology.