TCPL Robotics Club: Wrestling Robots

318

1

4

Introduction: TCPL Robotics Club: Wrestling Robots

About: Tompkins County Public Library (Ithaca, New York), founded in 1864 by Ezra Cornell, serves the 104,926 residents of Tompkins County and is the Central Library for the Finger Lakes Library System, serving lib...

Welcome to the Tompkins County Public Library's guide to making Wrestling Robots! The robots made in this tutorial are used at the TCPL Robotics Club. For more information on the club check out our events page: https://www.tcpl.org/events/tcpl-robotics-club-rob...

The goal of these robots are to give a fun and creative gateway into coding and making. The robots are designed for anyone ages 7+. This guide will be updated as the program grows.

Happy Tinkering!

Step 1: Materials and Tools

Materials:

  • Arduino UNO or Arduino Nano
  • L298N Motor Drive Dual H Bridge
  • HC-05
  • Small Breadboard
  • Breadboard Wire
  • 2x Geared DC Motors with Wheels
  • 9volt Battery Case with a Switch
  • USB adapter for chosen Arduino
  • Re-chargeable 9volt Battery
  • AA battery
  • Ductape
  • Electric Tape
  • Double Sided Tape
  • Hot Glue Stick
  • Cardboard
  • Foam Board

Tools:

  • Hot Glue Gun
  • Hobby Knife
  • Scissors
  • Straight Edge
  • Wire Cutter
  • Small Screwdriver
  • Pen/Marker

Devices:

  • PC/MAC laptop or desktop
  • Android/Kindle tablet or phone with Bluetooth

Software:

Step 2: Preparing the Chassis

Take a recycled sheet of cardboard. Measure and trace an 8"x 8" inch square. Using scissors or a hobby knife cut out square. Take three strips of Ductape and adhere them to the left edge, right edge, and center of the cutout. Take two strips of Ductape that are 8" inches long and adhere them to the top and bottom edges of the cardboard square. Your chassis is complete. All the components for this robot will be taped onto the chassis. The Ductape on the chassis prevents tearing when you have to remove or fix a component. Your chassis should look similar to the bottom right photo of this step.

Step 3: Wiring the Motors Without Solder

If you are confident with soldering you may skip this step and solder a wire with a breadboard pin to each motor lead. If you would rather not use solder take two breadboard wires with pins at each end. Cut the wires in half and strip each end that do not contain a pin. Twist each of the exposed wire ends and thread them through each motor lead. Gently twist the exposed wire around the motor lead. Once all the wire have been attached to the motors test to make sure they receive electrical current. WARNING! When testing motors do not use a 9v battery, it will burn out the component! Use AA battery instead. If the motor does not rotate when you touch each ends of the AA to the wires check to make sure they are securely twisted around each lead. Once you are satisfied with the connections its time to secure the wires with hot glue. Apply the hot glue along the back on the motor being careful not glue the motor leads or the center of the motor. The motors we use have a black plastic casing in the back. Place each wire in the glue. Once the glue dries take some electrical tape and tightly wrap it around each motor covering the leads.

Step 4: Placing the Components

Cut several strips of double sided tape to the length of your H-Bridge. H-Bridge sizing varies from company to company. If you have an H-Bridge unit with solder connection points sticking out you may want to lightly press a piece of foam/cardboard to the bottom of the unit. Tape the unit to the top of the chassis approximately an 1.5" inches from the top edge. The H-Bridge unit designates the rear of the chassis. Attach the Arduino Nano to the Breadboard making sure to have at least three rows of inputs on the side with pins starting with the letter D. Adhere the Arduino and breadboard to the center of the chassis. If you are using the Arduino UNO you will not need a bread board, instead adhere the micro-controller to the center of the chassis. Adhere the 9v battery approximately 3" inches below the Arduino unit. Depending on the size of the 9v battery pack you may have to adjust its location. Both wires coming from the 9v battery pack should be able to plug in to the 12v and GND inputs on the H-bridge. Adhere the two DC motors to the rear of the chassis. Make sure to align the motors with the side edges of the chassis. Check that both the wires on each motor can be inserted into OUT inputs on the H-bridge. If necessary trim the side of the chassis until the wire reach the inputs.

Step 5: Wiring the Components

You will need the following bread board wires. Note: you do not need to use the same color pattern of wires. If this is your first time assembling a project requiring breadboards and wires we suggest you use the same colors in this Instructable to make it easier to follow along!

Wires with a pin on each end:

1x red

1x black

Wires with a pin and an input

1x red

1x black

1x orange

1x yellow

1x white

1x blue

1x purple

1x green

1x grey

1x brown

Note: to attach a wire to an Arduino Nano set in a breadboard insert the pin of the wire next to the desired input. Example, to attach a wire to the GND input insert the wire's pin into a breadboard port next to the GND on the Arduino. To insert a wire into a Arduino Uno without a breadboard insert the wires pin into the desired input. Example, to attach a wire to the GND input insert the wire's pin into the input marked GND.

Attach the black wire with a pin on each end to a GND input on the Arduino. Take the other end of the black wire and the black wire from the 9v battery case and insert them into the GND input on the H-bridge. Tighten the screw on the GND input, do not tighten the input to the point it severs the wires. Take the red wire with pins on both sides and attach one of the pins to VIN on the Arduino. Take the other end of the red wire and the red wire from the 9v battery case and insert them into the 12v input on the H-bridge. Tighten the screw on the 12v input. Take the HC-05 chip and attach the following wires with a pin and an input:

red wire -> 5v, VCC, or +5v depending on the company you bought it from.

black wire -> GND

orange wire -> TX

yellow wire -> RX

To attach a wire to the HC-05 take the input side of the wire and slide it over the protruding pins of the chip.

Attach the wire connected to the HC-05 to the Arduino

red wire -> 5v

black wire -> GND

orange wire -> D11

yellow wire -> D12

Once the HC-05 is attached to the Arduino adhere it to the chassis between the Arduino and the H-Bridge.

Attach the motor wires to the H-Bridge:

left motor black wire -> OUT1

left motor red wire -> OUT2

right motor red wire -> OUT3

right motor black wire -> OUT4

Attach the Arduino to the H-Bridge. Use the remaining wires with a pin and and an input.

white wire: H-Bridge ENA -> Arduino D3

blue wire: H-Bridge IN1 -> Arduino D2

purple wire: H-Bridge IN2 -> Arduino D4

green wire: H-Bridge IN3 -> Arduino D5

grey wire: H-Bridge IN4 -> Arduino D6

brown wire: H-Bridge ENB -> Arduino D9



Step 6: Upload the Code

Download the free Arduino IDE to your Mac or PC. If you haven't used the Arduino IDE before read this link (the article in this link uses an Arduino UNO if you are using the Nano select Nano instead of the UNO option when uploading code). If you are using an Arduino Nano that is not from the Arduino company you will need to download the driver on this link. Copy the following code into a text editor. Copy the code from the text editor into an Arduino Sketch. Upload code to the Arduino.

#include <SoftwareSerial.h>

#define enA 3                                                                                                                                         
#define in1 2
#define in2 4
#define in3 5
#define in4 6
#define enB 9
#define bluetoothTx 11
#define bluetoothRx 12
int bytes=0;
SoftwareSerial bluetooth(bluetoothRx, bluetoothTx);

void setup() {
  // put your setup code here, to run once:
  void forward();
  void right();
  void left();
  void back();
  void stopped();
  void gear_1();
  void gear_2();
  void gear_3();
  
  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);

  bluetooth.begin(9600);
  Serial.begin(9600);
  gear_1();
}

void loop() {
  // put your main code here, to run repeatedly:
 while(bluetooth.available())
  {
    bytes=int(bluetooth.read());
    Serial.println(bytes);

   switch(bytes)
    {
      case 102 :
      {
       forward();
        break;
      }
      case 98 :
      {
        back();
        break;
      }
      case 108 :
      {
        left();
        break;
      }
      case 114 :
      {
        right();
        break;
      }
      case 115 :
      {
        stopped();
        break;
      }
      case 49 :
      {
        gear_1();
        break;
      }
      case 50 :
      {
        gear_2();
        break;
      }
      
      case 51 : 
      {
        gear_3();
        break;
      }
     
      default :
      {
        continue;
        break;
      }
    }
  }
}

void forward()
{
  //right
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  //left
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
}


void right()
{
  //right
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  //left
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
}


void left()
{
  //right
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  //left
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
}


void back()
{
  //right
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  //left
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
}


 void stopped()
{
  //right
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  //left
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
}

void gear_1()
{ 
 analogWrite(enA, 120);
 analogWrite(enB, 120);
}

void gear_2()
{
  analogWrite(enA, 170);
  analogWrite(enB, 170);
}

void gear_3()
{
  analogWrite(enA, 250);
  analogWrite(enB, 250);
}

Step 7: Set Up APP and Test Drive

Android App

Kindle App

Open the Bluetooth Electronics App. The app will open to the home screen showing several preset control panels. Slide over to an empty panel and select it. Tap on edit and the control panel editor will open up. Along right hand side of the editor you can select different buttons and switches. Select the button option and slide over to find the large buttons. Select and drag out four large green buttons. Place two buttons on the left vertically and two on the right horizontally. Find the buttons with numbers on them and vertically stack them 1, 2, and 3 next to the large green buttons on the left. Select a button and press edit and a text box will appear that will allow you to enter the characters it will send to the robot.

Left side top green button: Press Text f and Release Text s

Left side bottom green button: Press Text b and Release Text s

Right side left green button: Press Text l and Release Text s

Right side right green button: Press Text r and Release Text s

Button 1: Press Text 1 and Release Text 1

Button 2: Press Text 2 and Release Text 2

Button 3: Press Text 3 and Release Text 3

Attach the wheels to your robot and switch it on. Go back to the home screen and select Connect. A new screen will appear select Bluetooth Classic and Next. A screen will appear with available Bluetooth devices select the HC-05/06 and press connect. A text box will appear type 1234 and press done. Once connected you should see the devices name at the top of the screen. On the home screen navigate to the controller you made, select it and press run. Test the robot to make sure the it moves forward when you press the top left button. If it moves backwards or spins note the direction and switch the robot off. Undo the motor and its wires that was rotating in the wrong direction. Attach the wires to the H-bridge opposite to the original connections. For example, if the red wire was in OUT3 and the black wire was in OUT4 put the red one into OUT4 and the black one into OUT3. This is called reversing polarity.

Step 8: Add Armor and Battle!

When you are satisfied with the way your robot drives around its time to armor it up. Take some recycled cardboard and design some awesome armor then tape it onto the chassis. Happy battling!

Step 9: Creating a Community Program

The robotics club we setup at the Tompkins County Public Library was separated into eight weekly meetings. Meetings ran between one to two hours long. Throughout the program participants were placed into teams of two or three. Individual teams worked on a single robot. Each session concentrated on a topic of robot battling or Arduino coding. We used the following format:

Available seats: 6 -10

Waitlist: 5

Age groups: 7 – 12 and 13 – 18

Length of program: 8 weekly meetings

Required equipment:

For 6 participants:

  • 3 android or kindle tablets
  • 1 -3 PC computers with Windows XP or higher
  • scissors or hobby knives

For 10 participants:

  • 5 android or kindle tablets
  • 3 -5 PC computers with Windows XP or Higher
  • scissors or hobby knives

Program Goals

Provide youth patrons introductory Arduino tutorials through creating and programming a robot.

Provide an inclusive and encouraging space.

Provide robotics and coding resources to the community.

Meeting themes:

  1. Introduction to the world of robot battling
  2. Introduction to the types of battling robots
  3. Creating the circuit
  4. Introduction to programming Arduino
  5. How to make your Android device talk to the your robot
  6. Building the wedge robot
  7. Putting it all together
  8. Robot battle tournament


Introduction to the world of robot battling

Our first meeting opened with a discussion on defining robot battling. We discussed the televised events of Battlebots and Robot Wars, regional and world competitions, and the pop-culture of mecha and super robots. We furthered the conversation with defining the different classes of battle robots and the rules we would use throughout the meetings. We closed the meeting with dividing the participants into teams and giving them a chance to battle with example robots. There were four examples made from the parts each team would later use to construct their own robots. The examples helped each team see how the parts worked together. The rules we used are listed at the end of this section.

Links and resources:

Introduction to the types of battling robots

The Second meeting focused on the different types of combat robots. The club opened with a discussion on simple machines and how robots could use them as offensive or defensive tools in the arena. After the discussion the participants separated into their respective teams and began designing their own wedge based robot. We closed the meeting with showing several video examples of wedgebots in action.

Links and resources:

Creating the Circuit

At the third meeting we created kits for each team containing all the parts needed to build a robot without armor. We walked everyone through a step by step tutorial on constructing the robots. During the tutorial we discussed each separate part and defined what its function was. We created a slide show with links to resources that contained definitions of each part and how they worked in a circuit. The meeting ended with each team refining their designs.

Links and resources:

Introduction to programming Arduino

The fourth meeting we went into the many details of programming in C++ based Arduino code. We guided each team through programming a simple codes that controlled the direction and speed of their motors. The codes incorporated several basic concepts of C structured programming: variables, operators, functions, and flow control. See below to find the codes. Once the teams finished writing their programs we provided them with a tutorial on how to use the Arduino IDE to upload code to their robots. Note: If you plan on running this program and you do not have any experience with coding please go to thArduino and Tinkercad link. The Arduino link is a tutorial on how to code for beginners and hobbyist. The Tinkercad link provides you with virtual electronic components you can program and bring to life.

Links and resources:


Code1:

<p>int enA = 3;                                                                                                                                         <br>int in1 = 2;
int in2 = 4;
int in3 = 5;
int in4 = 6;
int enB = 9;</p><p>void setup() {
  // put your setup code here, to run once:
  //pinMode tells the Arduino where sensors, motors, etc are connected.
  pinMode(enA, OUTPUT); 
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);</p><p>  //The variables enA and enB store the location of the PWM pins.
  //You can set the PWM signals to any whole number between 0 and 255.
  //The PWM pins control the speed of the motors, 0 being the slowest and 255 the fastest.
  analogWrite(enA, 255); 
  analogWrite(enB, 255);
}</p><p>void loop() {
  // Put your main code here, to run repeatedly:
  // Depending on the order of HIGH and LOW your robot wil go forwards, backwards, left, and right.
  // You can move the code below into a function, void forward(), to make more portable. 
  digitalWrite(in1, LOW );
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH); 
}</p>

The code begins with six variables: int enA, int enB, int in1, int in2, int in3, and int in4. The int stands for the type of data stored in the variable. We are storing a whole number so we use the type integer or int for short. After the type is the name of the variable. Anytime you use this variables name the Arduino will be able to access its value. Each variable name is followed by the = assignment symbol (not the equal symbol) and a value. The assignment symbol tells the Arduino the value is stored in the variable. The values represent the pins on the Arduino chip. For example, the enA port on the H-bridge unit is plugged into the Arduino Nano’s D3 pin. After the variables we find the setup function. A function is a compilation of code that defines a single task. The void setup function is used to initialize pinModes, other functions, and variables. Everything we put in between the curly brackets that follow the function are a part of that function. Each function has its own set of curly brackets. We use the pinMode to define whether a pin on the Arduino is an OUTPUT or an INPUT. We want the Arduino to turn on and off the motors so we set everything to OUTPUT. We initialize two analogWrite functions with the location of the PWM pins (enA and enB) and the level of the signal. 0 is off and 255 in completely on. You can input any whole number between 0 and 255 to get different speeds. Now that we have everything setup for the Arduino to communicate with the H-Bridge we need to code it to turn on the motors. To do this we move into the void loop function. The loop function repeats the code inside it's curly brackets, in less than a millisecond, until the Arduino power is shut off. We use four digitalWrite functions initialized to each pin number (in1, in2, in3 and in4) and HIGH or LOW. HIGH is on or whatever enA/enB is initialized to and LOW is off or 0. By setting in1 to HIGH and in2 to LOW we turn on the motor and it rotates in one direction. We can reverse the direction by initializing in1 LOW and in2 HIGH.

Code 2

<p>int enA = 3;                                                                                                                                         <br>int in1 = 2;
int in2 = 4;
int in3 = 5;
int in4 = 6;
int enB = 9;</p><p>int choice = 7;</p><p>void setup() {
  // put your setup code here, to run once:
  //pinMode tells the Arduino where sensors, motors, etc are connected.
  pinMode(enA, OUTPUT); 
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);</p><p>  //The variables enA and enB store the location of the PWM pins.
  //You can set the PWM signals to any whole number between 0 and 255.
  //The PWM pins control the speed of the motors, 0 being the slowest and 255 the fastest.
  analogWrite(enA, 255); 
  analogWrite(enB, 255);
}</p><p>void loop() {
  // Put your main code here, to run repeatedly:
  if(choice ==1)
  {
    forward();
  }
  else if (choice == 2)
  {
    stopped();
  }
  else
  {
     analogWrite(enA, 100); 
     analogWrite(enB, 100);
     forward();
  }
   </p><p>}
void forward()
{
  digitalWrite(in1, LOW );
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH); 
}</p><p>void stopped()
{
  digitalWrite(in1, LOW );
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);  
}</p>

The second code focuses on creating functions and using the if, elseif, and else flow control statements. We add a new variable choice and initialize it to the value of 2. Next we delete the code in between the curly brackets of the void loop function. Under the second curly bracket of the loop function we create two new functions, void forward() and void stopped(). The forward function will contain the code used to move the two motors forward. The stopped function will set all the digitalWrite functions too LOW to have both motors off. After the new functions are written we move back into the loop function and create and if else statement. We set if to the choice == 1 (choice equals the value of 1) and give it the forward() function. The if else statement receives choice == 2 and the stopped() function. In the else statement we add code to slow the motors down. Once the code is written upload it to the robots and see what behavior it shows. The robot should not move since the variable choice was set to 2. The code will go to each statement of the if else code to see if choice contains a value equal to the value within each parenthesis. We had the teams change the value of choice several times to see how the robot would react.


Code 3

<p>int enA = 3;                                                                                                                                         <br>int in1 = 2;
int in2 = 4;
int in3 = 5;
int in4 = 6;
int enB = 9;</p><p>int choice = 2;</p><p>void setup() {
  // put your setup code here, to run once:
  //pinMode tells the Arduino where sensors, motors, etc are connected.
  pinMode(enA, OUTPUT); 
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);</p><p>  //The variables enA and enB store the location of the PWM pins.
  //You can set the PWM signals to any whole number between 0 and 255.
  //The PWM pins control the speed of the motors, 0 being the slowest and 255 the fastest.
  analogWrite(enA, 255); 
  analogWrite(enB, 255);
}</p><p>void loop() {
  // Put your main code here, to run repeatedly:
  switch (choice)
  {
    case 1 : 
    {
      forward();
      break;
    }
    case 2 :
    {
      stopped();
      break;
    }
    default :
    {
      analogWrite(enA, 100); 
      analogWrite(enB, 100);
      forward();
      break;
    }
  }
   </p><p>}
void forward()
{
  digitalWrite(in1, LOW );
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH); 
}</p><p>void stopped()
{
  digitalWrite(in1, LOW );
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);  
}</p>

In the third coding example we remove the if else statements and replace it a switch case flow control statement. The switch statement works similar to the if else statement. With the switch statement we give it three cases each with the same value as the if else statement. The first case was set to the value of 1, forward() and the function break(), the second to 2, stopped and break(), and the default (acts similar to else) code to slow down the robot. We us the function break() so the Arduino will only use one of the case statements.


Code 4

<p>int enA = 3;                                                                                                                                         <br>int in1 = 2;
int in2 = 4;
int in3 = 5;
int in4 = 6;
int enB = 9;
int choice = 2;</p><p>int i = 0;</p><p>void setup() {
  // put your setup code here, to run once:
  //pinMode tells the Arduino where sensors, motors, etc are connected.
  pinMode(enA, OUTPUT); 
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);</p><p>  //The variables enA and enB store the location of the PWM pins.
  //You can set the PWM signals to any whole number between 0 and 255.
  //The PWM pins control the speed of the motors, 0 being the slowest and 255 the fastest.
  analogWrite(enA, 255); 
  analogWrite(enB, 255);
  Serial.begin(9600);
}</p><p>void loop() {
  // Put your main code here, to run repeatedly:
  forward();
  
  while(i<=255)
  {
      i++;
      pwm_speed(i);
      Serial.println(i);
  }
  i=0;</p><p>}
void forward()
{
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH); 
}</p><p>void stopped()
{
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);  
}
void pwm_speed(int level)
{
  analogWrite(enA, level); 
  analogWrite(enB, level);
}</p>

Code four contained a while loop to demonstrate how loop flow control works. We add a new variable and function. The variable i is initialized to 0. Below the stopped() functions second curly bracket we made a the function void pwm_speed(int level). The new function contains a parameter of the type int. We use parameters to pass values into our function. When we put a value into the function's parameter we call the value an argument. Within pwm_speed(int level) function we put code to change the speed of the robot. When we use this function in the loop function we write it as pwm_speed(100). The value 100 is the argument and the speed we want the motors to rotate at. We can pass any argument with value between 0 and 255. Arguments can also be variables. After the variable and the function were coded we remove the switch case statement and replace it with a while loop and a re-assignment statement. We set the while loop to repeat its code within its curly bracket 255 times. We do this by using the operator <=, less than or equal to. We do not use the less than operator, <, since the Arduino starts at 0 and would only reach the value of 254 instead of 255. Within the loop we increment the variable i by 1 each time the loop executes. Once the loop is completed we reset the value of i to 0 so the while loop will continually repeat until we turn off the power of the robot. Once the code is uploaded the teams should see the robot speed up and slow down.

How to make your tablet/phone talk to the your robot

Our fifth meeting focused on Bluetooth, we discussed the many benefits this technology provides. Each team was given a step by step tutorial on programming the Arduino to use the HC-05 component. Depending on the age group you can either have them write whole program featured in this Instructable or pre-code it yourself. We pre-coded the robots for the age group of 6 – 11.

Resources:


Code:

<p>#include <br>int bluetoothTx = 10;
int bluetoothRx = 11;
int choice = 0;
SoftwareSerial bluetooth(bluetoothRx, bluetoothTx);</p><p>void setup() {
  // put your setup code here, to run once:
  bluetooth.begin(9600);
  Serial.begin(9600);</p><p>}</p><p>void loop() {
  // put your main code here, to run repeatedly:
  while(bluetooth.available())
  {
    choice =int(bluetooth.read());
    Serial.println(bytes);
  }
  </p><p>}</p>

The Bluetooth code begins with accessing the library SoftwareSeria(). A library contains pre-made functions. Arduino has many libraries one can use for a plethora of projects. The SoftwareSerial library contains code we can use to send and receive Bluetooth signals. To access a library we use the keyword #include followed by the <>. Next we declare three variables and a single object. The variables bluetoothTx and bluetoothRx store the values corresponding to the pins the HC-05 is attached to. The choice variable is initialized to zero. We use choice to store the values sent from the HC-05. An object is similar to variable, it has a type and a name. We use objects to access code from the library. For example if we wanted to receive data from the HC-05 we would write bluetooth.read();. In the setup function serial transmission is activated with using to object functions bluetooth.begin(9600) and Serial.begin(9600). The value passed into the function is the rate per second bits are transmitted. For more information check out this link. In the void loop portion of the code we create a while loop that checks for connection. The loops condition contains a library function called .available(). The .available function contains the information sent to the Arduino from the HC-05 in bits. If the function has data from the HC-05 than a Bluetooth connection has been established and the code in the loop will execute. In the loop we add code that will print the data received in the serial monitor. Check out this link to find out how to access the Serial monitor. The line choice =int(bluetooth.read()); turn the data being sent from the HC-05 into an integer. Each integer will correspond to a letter, number, or symbol on ASCII code. Check out this link for info on ASCII. For example, if we have the letter f sent to the Arduino the variable choice will store the integer value of 102.


Building the wedge robot

The sixth session was the favorite for our patrons. Each team got a box worth of card board and a roll of ductape to design and create a unique wedge robot. Each team came up with some awesome designs! We also continued our discussion on simple machines from the first meeting, but focused heavily on wedges and inclined planes.


Putting it all together

At the seventh meeting teams tested their robots capabilities with a simple obstacle course made from left over materials and practice battles. Each team was given the full hour to test and redesign their armor. We also provided decals and sharpies so teams could create their own livery.


Robot battle tournament

The eighth and final meeting we held a simple ladder style tournament. A win received 3 point, a draws 1 point, and a loss 0 points. We had volunteers coordinate and keep track of points. Also, we provided 3D printed trophies, snacks, and beverages for each of the teams.

Rules

  1. Each robot will be built with cardboard, ductape, double sided tape, hot glue, and Arduino components.
    • Arduino components include:
    • Arduino Nano, Uno, or clone
    • HC-05 or HC-06 Bluetooth Module
    • 5v DC motor with or without a plastic gearbox
    • L298n or L298d (with heatsink) H-bridge
    • One or two breadboards
    • Breadboard wires
    • 9v battery case with on/off switch
  2. Wheels are allowed to be comprised of plastic, cardboard, foam, or wood
  3. LIPO batteries and brushless motors are not allowed.
  4. A robot must be less than 2ft in length, width, and height.
  5. Robots may not exceed 400g of weight.
  6. Robot’s armor must be comprised completely of tape, foam, and/or cardboard.
  7. Sharp glass, metals, blades, writing utensils, plastics, etc. on any part of the robot is forbidden.
  8. Projectiles and devices used to entangle, for example ribbon or string, are forbidden
  9. Teams may use rubber bands, hot glue, and double sided tape to improve grip.
  10. Teams may only use the following to cover their robot’s armor with:
    • Ductape
    • Double sided tape
    • Painter’s tape
    • Packing tape
    • Hot glue
    • Electric tape
    • Vinyl Stickers
    • Paper or cardstock variant
    • Matte board
    • Cardboard
  11. The arena is comprised of two standard 6ft long fold-able tables joined together.
  12. The table’s top will either be bare or covered with brown craft paper.
  13. Both tables will be raised to maximum height.
  14. A battle consists of a single 2 minute round with 2 – 4 teams.
  15. Teams and audience may not interfere with a battle.
  16. A battle ends when the time runs out or when only one robot remains in the arena.
  17. If all robots fall out of the arena simultaneously, the team with robot who left the arena last is the winner of the round.
  18. If 2 minutes pass and more than one robot is left in the arena, the teams of those robots receive a draw.
  19. During the battle teams may only have their robot stop another robot from moving for 10 seconds. After the 10 seconds pass a judge or volunteer will separate robots to opposite sides of the arena and the battle will continue.
  20. At the end of each battle teams will shake each-others hands and show good sportsmanship.
  21. Teams are given 10 minutes to repair and adjust their robots before battle.
  22. If a team or teams exceed their repair time they receive a loss.
  23. Teams, audience, volunteers, leaders, and anyone else in attendance are not to harm or show any acts of violence or bullying, including profane language, towards participants during club meetings and/or competitions.

Be the First to Share

    Recommendations

    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Super-Size Speed Challenge

      Super-Size Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020

    4 Discussions

    0
    jeanetteibclc
    jeanetteibclc

    Question 1 year ago on Step 5

    Hello Joah! We are having a great time! We hit a road block. Our HC-05 looks a bit different and doesn’t have a 5V input. (See image) Thoughts on next steps? Thank you so much!

    image.jpg
    0
    TCPL
    TCPL

    Answer 1 year ago

    Hi jeanetteibclc,
    I'm glad you are all enjoying the build process! My apologies, I forgot they don't always put 5V on the HC-05. Plug the wire for the 5V input into the VCC input.

    0
    Penolopy Bulnick
    Penolopy Bulnick

    1 year ago

    These look fun! Do you have any videos of them?

    0
    TCPL
    TCPL

    Reply 1 year ago

    Thanks! Yes, I plan to add them soon!