Project showcase

How to Build a Battlebot With Arduino and Cardboard © GPL3+

Build a battlebot from cardboard using Arduino.

  • 1,398 views
  • 0 comments
  • 8 respects

Components and supplies

About this project

I created battlebots using the Arduino UNO and cardboard was used to build the bodies. I tried to use affordable supplies and gave the kids creative freedom on how to design their battle bots. Battlebot receives commands from the wireless controller using joystick and nRF24L01 2.4GHz wireless module.

Step 1. Hardware and Materials

You will need the following materials to get started:

9v battery: https://amzn.to/2wPmnSP|| https://sea.banggood.com/custlink/KmKYdQw8Ii

Jumper wires: https://amzn.to/398mQhq || https://sea.banggood.com/custlink/vK3hds7SAZ

NRF24L01+ 2.4GHz Wireless RF Transceiver Module: https://amzn.to/30xQlp4 || https://sea.banggood.com/custlink/DmGEEnw9i4

9v Battery Clip Connector : https://amzn.to/32D4R0b || https://sea.banggood.com/custlink/mvDdYsw98s

Cardboard : https://amzn.to/39ufbKH

Natural Wood Craft Sticks : https://amzn.to/39rovPs || https://sea.banggood.com/custlink/3mKYdbw8je

Mini Breadboard : https://amzn.to/2JujS9e || https://sea.banggood.com/custlink/D3KhynuiIq

Dual Axis XY Joystick Module Arduino KY-023 : https://amzn.to/3gOcWFZ || https://sea.banggood.com/custlink/vGmyRQu98T

DC Motor 1:48 Gear Ratio Smart Car Robot + Wheel : https://amzn.to/3drHmvx || https://sea.banggood.com/custlink/GmDdYnfilm

L298N mini motor driver : https://amzn.to/2MoYeqI || https://sea.banggood.com/custlink/3m3dYbTIjV

Switch: https://amzn.to/2upTngE || https://sea.banggood.com/custlink/mG3yyNT8Oi

Male DC Barrel Jack Adapter for Arduino : https://amzn.to/2VwyKxx || https://sea.banggood.com/custlink/K3DhRNwSlL

Hot Glue Gun : https://amzn.to/31sIko3 || https://sea.banggood.com/custlink/GmvhYQ1ome

Soldering Iron Kit : https://amzn.to/3eHmp0i || https://sea.banggood.com/custlink/m3DYRAuL3k

Step 2. Build a BattleRobot

The idea behind this battlebot was to try to build a cheap as possible. I used cardboard for the body of robot instead of sheet metal, scissors instead of band saws, and hot glue instead of an ark of welder.

First, you need cardboard then cut out the shapes. If you dont like my design, you can design your own battlebot. Glue the pieces together except the top because we want to put the circuit into the body of battlebot.

Step 3. Programming the Battlebot and Controller

To program the arduino you will need the RF24 library installed. So download the files below and open arduino IDE. Go to Sketch -> Include Library -> Add.ZIP Library and import 'RF24.zip' into there.Next you'll have to connect the arduino UNO and upload 'Battle_Robot.ino' to the arduino. Now unplug the Arduino UNO and connect the Arduino Nano and upload 'Controller.ino' to the Arduino. Remember to change the 'board' and 'port' settings also.

Step 4. Wiring The Battlebot

In this project used 3 x 9 volt alkaline batteries for arduino uno, motors, and spinner. L298N mini motor driver was used for the control of the motors. It receives some 5V signals of the Arduino board, and provide higher voltages for the motors. It also allow the motors to run in both directions, depenting on the combination of those input signals. Each device was connected according to the wiring diagram.

After wiring the circuits, Then you simply glue them or double tape into the body of battlebot, along with your battery pack and arduino uno.

Step 5. Wiring The Controller

The following image shows the complete wiring diagram of transmitter using Arduino Nano.

After connecting all components then I inserted all these components into the enclosure and sealed it completely using hotglue. NRF24L01 2.4 GHz Transceiver Module can be used for wireless communications at up to 100 meters.

Step 6. Test The Battlebot

Now, if all goes well, you should be able to control the battlebot with the controller. If the battlebot doesn't work at all you should check the connections of the nRF24L01.

It was fun building these battlebots! I hope this article helped open your eyes to the possibilities buried in all those everyday items around your house. Those boxes you throw away could become your next big project if you think about it.

You can subscribe my channel for the support.

Thank You.

Battle Video


Code

BattlebotArduino
#include <SPI.h>      //SPI library for communication with the nRF24L01+
#include "RF24.h"  //The main library of the nRF24L01+
#include "Wire.h"


RF24 radio (8, 9); // CE,CSN

//Create a pipe addresses for  communication
const uint64_t pipe = 0xE8E8F0F0E1LL;

struct package
{
  int X = 1;
  int Y = 1;
};

typedef struct package Package;
Package pos;

int buttonState;
int spinnerState = false ;
int motora_1 = 3;
int motora_2 = 4;
int motorb_1 = 5;
int motorb_2 = 6;
int spinner = 2;



void setup()
{
  Serial.begin(9600);
  radio.begin();                    //Start the nRF24 communicate
  radio.openReadingPipe(1, pipe);   //Sets the address of the transmitter to which the program will receive data.
  radio.startListening();
  pinMode(motora_1, OUTPUT);
  pinMode(motora_2, OUTPUT);
  pinMode(motorb_1, OUTPUT);
  pinMode(motorb_2, OUTPUT);
  pinMode(spinner, OUTPUT);
  digitalWrite(spinner, LOW);
  delay(100);
}

void loop()
{

  if (radio.available()) {
    radio.read(&pos, sizeof(pos));
    radio.read(&buttonState, sizeof(buttonState));
    Serial.print("X:");
    Serial.print(pos.X);
    Serial.print("      Y");
    Serial.print(pos.Y);
    Serial.print("      buttonState");
    Serial.println(buttonState);
  }

  int xAxis = pos.X;
  int yAxis = pos.Y;
  int forward = map(yAxis, 570, 1024, 0, 255);
  int backward = map(yAxis, 480, 0, 0, 255);
  int right = map(xAxis, 570, 1024, 0, 255);
  int left = map(xAxis, 480, 0, 0, 255);

  if (yAxis > 570) {          // Move Forward
    // Set Motor A forward
    analogWrite(motora_1, forward);
    analogWrite(motora_2, 0);
    // Set Motor B forward
    analogWrite(motorb_1, forward);
    analogWrite(motorb_2, 0);
  } else if (yAxis < 480) {                     //Move Backward
    // Set Motor A backward
    analogWrite(motora_1, 0);
    analogWrite(motora_2, backward);
    // Set Motor B backward
    analogWrite(motorb_1, 0);
    analogWrite(motorb_2, backward);
  } else if (xAxis > 570) {                     // Move Right
    // Set Motor A forward
    analogWrite(motora_1, right);
    analogWrite(motora_2, 0);
    // Set Motor B stop
    analogWrite(motorb_1, 0);
    analogWrite(motorb_2, 0);
  } else if (xAxis < 480) {                     // Move Left
    // Set Motor A stop
    analogWrite(motora_1, 0);
    analogWrite(motora_2, 0);
    // Set Motor B foward
    analogWrite(motorb_1, left);
    analogWrite(motorb_2, 0);
  } else  {     //stop
    // Set Motor A stop
    analogWrite(motora_1, 0);
    analogWrite(motora_2, 0);
    // Set Motor B stop
    analogWrite(motorb_1, 0);
    analogWrite(motorb_2, 0);
  }

  if (buttonState == 0 ) {
    spinnerState = ! spinnerState;
    delay(50);
  }

  if (spinnerState == true) {
    digitalWrite(spinner, HIGH);    //turn On spinner
    delay(100);
  } else {
    digitalWrite(spinner, LOW);      //turn Off spinner
    delay(100);
  }


}
ControllerArduino
/* YOU HAVE TO INSTALL THE RF24 LIBRARY BEFORE UPLOADING THE CODE
   https://github.com/tmrh20/RF24/      
*/

#include <SPI.h>        //SPI library for communicate with the nRF24L01+
#include "RF24.h"       //The main library of the nRF24L01+

RF24 radio(7, 8);

//Create a pipe addresses for  communication
const uint64_t pipe = 0xE8E8F0F0E1LL;


struct package
{
  int X=1;
  int Y=1;
};

typedef struct package Package;
Package pos;


int xPin = A0;
int yPin = A1;

int buttonPin = 3;
int buttonState;

void setup() {
  Serial.begin(9600);
  radio.begin();                 //Start the nRF24 communicate
  radio.openWritingPipe(pipe);   //Sets the address of the receiver to which the program will send data.
  pinMode(buttonPin, INPUT_PULLUP); // Activate pull-up resistor on the push button pin
  
}

void loop() {

  pos.X = analogRead(xPin); // Read Joysticks X-axis
  pos.Y = analogRead(yPin); // Read Joysticks Y-axis
  buttonState = digitalRead(buttonPin);
  // X value
  Serial.print("X:");
  Serial.print(pos.X);
  Serial.print("    Y");
  Serial.print(pos.Y);
  Serial.print("    button");
  Serial.println(buttonState);
 
  radio.write(&pos, sizeof(pos)); // Send data  to the other NRF24L01 module
  radio.write(&buttonState, sizeof(buttonState));
  delay(300);
  
}

Schematics

controller_jZZRZOzlfA.jpg
Controller jzzrzozlfa
Battlebot
Battlebot i9f0vnosbw

Comments

Similar projects you might like

Super Easy to Build 1Sheeld 2 Wheel Drive Robot

Project tutorial by Ahmed Hamdy and Garry Gerwer

  • 23,243 views
  • 3 comments
  • 37 respects

Build a Pinball Machine

Project showcase by grahamasker

  • 4,867 views
  • 11 comments
  • 13 respects

Littlearm 2C: Build a 3D Printed Arduino Robot Arm

Project tutorial by Slant Concepts

  • 8,092 views
  • 1 comment
  • 45 respects

Relativty Is a Low-Cost VR Headset You Can Build Yourself

Project showcase by Maxime-coutte and Hugo Garritsen

  • 7,021 views
  • 9 comments
  • 41 respects

Build A Tripod Using Arduino and Servo Motors

Project tutorial by Greenterminal

  • 4,611 views
  • 0 comments
  • 8 respects
Add projectSign up / Login