Introduction: Arduino Bluetooth RC Tank

I'm excited to share the details of my BT Arduino Tank project, which incorporates some impressive 3D-printed components. While the main chassis of the tank was not 3D-printed, I utilized this technology to create two crucial parts: the enclosure for the motor driver and the compartment housing the remaining electronics. Additionally, I 3D-printed a cannon for an added touch of customization.

The enclosure for the motor driver served as a protective housing, ensuring that the L298N motor driver module was securely mounted and shielded from external elements. By designing and 3D-printing this part, I could precisely fit it to the tank's specifications, providing a neat and organized arrangement of the electronics.

In the same vein, the compartment for the remaining electronics, such as the Arduino Nano Every and the HC-05 Bluetooth module, was also 3D-printed. This enclosure offered a clean and organized solution for housing these components, safeguarding them while maintaining easy access for maintenance or modifications.

Lastly, to enhance the tank's appearance and add a touch of personalization, I designed and 3D-printed a cannon. This custom-printed cannon perfectly complemented the overall design, making the tank even more visually appealing.

By strategically incorporating 3D printing into specific parts of the project, I achieved a balance between functionality and customization. The precision and versatility of 3D printing allowed me to create tailored enclosures and a unique cannon, elevating the overall aesthetic and practicality of my BT Arduino Tank project.

Supplies

For this project you will need:

Electronics:

  • Arduino Nano Every
  • On/Off button for at least 9v (link)
  • 9V battery and a connector (preferably I-Type)
  • HC-05 Bluetooth Module with a case (link)
  • SG90 Micro Servo (link)
  • L298N Motor Driver (link)
  • 2 12V DC Motors (and a chassis/base) (link)

Misc:

  • Wires
  • Soldering Equipment
  • Access to a 3D printer
  • pliers, tweezers
  • Super Glue
  • Arduino IDE
  • Android Device

Step 1: 3D Print the Case

The base and gun were designed by me. It can house the Nano and the battery, and it has an opening for the servo and BT Module. The cannon was also designed by me and I made it wide enough to fit my rubber duck. Adjust it as you wish. The case for the L298N was designed by Atom's Lab and the original can be found here.

 I use an Ender Envy 3 V2 and simple PLA, 0.2 mm. If you don't have a 3D printer, you can either order it online or find a local Fabrication Lab (many public libraries have one).

Step 2: Prepare the Arduino Nano

  1. Install the Arduino IDE (if not already installed) on your computer and connect the Arduino Nano via USB cable.
  2. Select the appropriate board (Arduino Nano Every) and port in the Arduino IDE
  3. Install any necessary libraries (if required).
  4. SoftwareSerial
  5. Servo
  6. Upload the code

NOTE: If you get an error when uploading the code, remove TX and RX and try again.

#include <SoftwareSerial.h>
#include <Servo.h>
Servo myservo;
int pos = 0;

SoftwareSerial bluetoothSerial(0, 1);  // RX, TX
char t;

int lb =5;
int lf = 6;
int rf = 7;
int rb = 8;

void setup() {
Serial.begin(9600);
bluetoothSerial.begin(9600);
pinMode(lf,OUTPUT);   //left motors  fwd
pinMode(lb,OUTPUT);  //left motors bwd
pinMode(rf,OUTPUT);   //right  motors fwd
pinMode(rb,OUTPUT);   //right motors bwd
myservo.attach(9);
for (pos = 0; pos <= 180; pos += 1)
myservo.write(0);
delay(1000);
myservo.write(180);
delay(1000);
myservo.write(90);
delay(1000);



}

void loop() {

if (bluetoothSerial.available()) {
    t = bluetoothSerial.read();
    Serial.print(t);
  }

  if (Serial.available()) {
    t = Serial.read();
    bluetoothSerial.print(t);
  }

if(t == 'W'){            //move  forward(all motors rotate in forward direction)
  digitalWrite(rf,HIGH);
  digitalWrite(lf,HIGH);
  digitalWrite(rb,LOW);
  digitalWrite(lb,LOW);

}

else if(t == 'S'){      //move reverse (all  motors rotate in reverse direction)
  digitalWrite(rf,LOW);
  digitalWrite(lf,LOW);
  digitalWrite(rb,HIGH);
  digitalWrite(lb,HIGH);
}

else if(t == 'A'){      //rotate left (right side motors rotate in forward direction, left  side motors bwd)
  digitalWrite(rb,LOW);
  digitalWrite(lf,LOW);
  digitalWrite(rf,HIGH);
  digitalWrite(lb,HIGH);
}

else if(t == 'D'){      //rotate right (left side motors rotate in forward direction,  right side motors bwd)
  digitalWrite(rf,LOW);
  digitalWrite(lb,LOW);
  digitalWrite(lf,HIGH);
  digitalWrite(rb,HIGH);
}

else if(t == 'X'){      //STOP (all motors stop)
  digitalWrite(rf,LOW);
  digitalWrite(rb,LOW);
  digitalWrite(lf,LOW);
  digitalWrite(lb,LOW);
}

else if(t == 'Q'){
   digitalWrite(rf,HIGH);
}

else if(t == 'E'){
   digitalWrite(lf,HIGH);
}

else if(t == 'Z'){
   digitalWrite(rb,HIGH);
}

else if(t == 'C'){
   digitalWrite(lb,HIGH);
}

else if(t == 'R'){
  myservo.write(90);
  digitalWrite(rf,LOW);
  digitalWrite(rb,LOW);
  digitalWrite(lf,LOW);
  digitalWrite(lb,LOW);
  delay(500);
  digitalWrite(rf,HIGH);
  digitalWrite(lf,HIGH);
  delay(100);
  myservo.write(80);
  delay(100);
  myservo.write(70);
  delay(100);
  myservo.write(60);
  delay(100);
  myservo.write(50);
  delay(100);
  myservo.write(40);
  delay(100);
  myservo.write(30);
  delay(100);
  digitalWrite(rf,LOW);
  myservo.write(90);
  delay(1000);
  digitalWrite(rf,LOW);
  digitalWrite(rb,LOW);
  digitalWrite(lf,LOW);
  digitalWrite(lb,LOW);
}

else if(t == 'F'){
  myservo.write(90);
  digitalWrite(rf,LOW);
  digitalWrite(rb,LOW);
  digitalWrite(lf,LOW);
  digitalWrite(lb,LOW);
  delay(500);
  digitalWrite(rb,HIGH);
  digitalWrite(lb,HIGH);
  delay(100);
  myservo.write(100);
  delay(100);
  myservo.write(110);
  delay(100);
  myservo.write(120);
  delay(100);
  myservo.write(130);
  delay(100);
  myservo.write(140);
  delay(100);
  myservo.write(150);
  delay(100);
  digitalWrite(rb,LOW);
  myservo.write(90);
  delay(1000);
  digitalWrite(rf,LOW);
  digitalWrite(rb,LOW);
  digitalWrite(lf,LOW);
  digitalWrite(lb,LOW);
}
else if(t == 'V'){
  myservo.write(90);
  digitalWrite(rf,LOW);
  digitalWrite(rb,LOW);
  digitalWrite(lf,LOW);
  digitalWrite(lb,LOW);
  delay(500);
  digitalWrite(rf,HIGH);
  digitalWrite(lb,HIGH);
  delay(100);
  myservo.write(80);
  delay(100);
  myservo.write(70);
  delay(100);
  myservo.write(60);
  delay(100);
  myservo.write(50);
  delay(100);
  myservo.write(40);
  delay(100);
  myservo.write(30);
  delay(100);
  digitalWrite(rf,LOW);
  myservo.write(90);
  delay(1000);
  digitalWrite(rf,LOW);
  digitalWrite(rb,LOW);
  digitalWrite(lf,LOW);
  digitalWrite(lb,LOW);
}

else if(t == 'j'){
  myservo.write(20);
}

else if(t == 'h'){
  myservo.write(29);
}

else if(t == 'g'){
  myservo.write(37);
}

else if(t == 'f'){
  myservo.write(46);
}

else if(t == 'd'){
  myservo.write(55);
}

else if(t == 's'){
  myservo.write(64);
}

else if(t == 'a'){
  myservo.write(73);
}

else if(t == 'p'){
  myservo.write(81);
}

else if(t == 'o'){
  myservo.write(90);
}

else if(t == 'i'){
  myservo.write(99);
}

else if(t == 'u'){
  myservo.write(108);
}

else if(t == 'y'){
  myservo.write(117);
}

else if(t == 't'){
  myservo.write(125);
}

else if(t == 'r'){
  myservo.write(138);
}

else if(t == 'e'){
  myservo.write(143);
}

else if(t == 'w'){
  myservo.write(152);
}

else if(t == 'q'){
  myservo.write(160);
}
//delay(10);
}

Step 3: Prepare the Chassis

Solder wires on the DC motors and then put everything together. Follow the instructions included and tight everything very well.

Step 4: Prepare the On/Off Button

First place the 9v battery in the case, and the solder the positive end (RED) to one of the button's pins. On the other pin, solder a red wire.

Step 5: Prepare L298N

First place the driver in its case. Then add some glue on the chassis and stick the case. Then:

  • Use F-F wires for the IN 1-4 pins.
  • Left Motor: (+) -> OUT2 and (-) -> OUT1
  • Right Motor: (+) -> OUT4 and (-) -> OUT3
  • Put the wire coming from the button in the 12V
  • Put a wire in 5V with F on the other side. That will power our Nano
  • In the GND we need 3 wires
  • One coming from the battery
  • One with F goes to the Nano
  • One with M that goes to the Servo

Use the schematic for reference


Step 6: Fit Servo and HC-05 to the Lid

The lid of the big base has two openings. Fit the servo and the Bluetooth module in them. They are both a bit tight so they hold for a long time no matter the terrain the tank is at.

Step 7: Connect Everything

First, put some glue on the chassis and stick the main base. Place the Nano and the battery in. Time to connect everything according to the diagram.

  1. Connect 9V Battery and Button
  2. Place the button in the side opening. Use glue to secure it.
  3. Connect the RED wire from the button to 12V on L298N.
  4. Connect the GND from the battery to GND on L298N
  5. Connect L298N (if you don't follow the instruction the code will not work)
  6. IN1 to D5
  7. IN2 to D6
  8. IN3 to D7
  9. IN4 to D8
  10. 5V from L298N to VIN pin on the Arduino Nano.
  11. GND with F to GND pin on the Nano
  12. GND with M to servos GND wire
  13. Connect Micro Servo
  14. GND should already be connected
  15. Connect the RED power wire to Nano's 5V pin
  16. Connect the yellow signal wire to D9 on Nano
  17. Connect HC-05 Bluetooth Module
  18. VCC to 3.3V
  19. GND to GND
  20. TXD to RX
  21. RXD to TX

When you're finished, push the button to make sure everything is wired up correctly. The L298N should have a red light on, the servo will rotate 3 times, and the HC-05 will have a red light blinking.


Step 8: Assemble the Base and Cannon

Carefully place everything in the case and close the lid. Use some glue to stick the cannon on the servo. Place a rubber duck or anything you want on it.

Step 9: Get the App

You need an app to operate the tank. The app isn't available on Play Store yet. You can download it from MIT App Inventor. I will update this post once the app is available on PlayStore.

Before you start using it, you need to pair your device with the HC-05. Once you open the app, turn your phone to the side for optimal view. Click on the BT icon and select the HC-05 (make sure the tank is turned on). You're all set. Enjoy!

Step 10: Conclusion

I enjoyed designing and building this tank. If you have any comments or feedback please share them with me. Also, if you make it yourself, I would love to see how it came out