RC Robot Tank

The RC Robot Tank is a project similar to most RC cars with tank treads you can find on the market. The project focuses on power sources like the motor and engines, as well as some programming

Engineer

Benjamin R,

Area of Interest

Mechanical engineering

School

Summit High School

Grade

Incoming freshman

Reflection

When I first applied to Bluestamp Engineering program I felt nervous because I had no prior experience in the field of engineering. Once I arrived at the program, my feelings quickly changed and I began to feel more comfortable. I struggle with problem solving, but the staff were helpful and helped me gain confidence.

When I entered the program the first task I had to complete was learning how to solder. This task helped me gain confidence because I knew I wasn’t the only one without experience in the field. After learning how to solder I felt ready to complete my projects.

My favorite project was my main project, the RC Robot tank. This was my first experience with coding and Arduino.  I started the project by assembling the tank. Assembling these parts was difficult, especially the motor. After building the body of the tank I had to connect the PS2 controller to the tank using Arduino. The wiring was complex and I had to stay another week just to find the right code, but these struggles helped me with problem solving and troubleshooting. After completing this challenging project, it was rewarding to know I was able to finish it in the end.

Overall I enjoyed my experience at Bluestamp. I learned many skills like how to effectively troubleshoot and improved my ability to solve problems. The staff were supportive and motivating, and helped me overcome any challenges I faced. I look forward to continuing my education in engineering and attending Bluestamp in the future.

 

Final Milestone

Circuit Diagram

Milestone Video

STEM Summer Camps for Kids New York Robotics & Coding

Stage 1: Arduino & Shield Assembly

After building the base tank it was time for me to move on to the wiring and coding. The first step was assembling the Arduino Uno and the motor shield. using header pins and soldering them onto the motor shield I was able to easily attach and detach the shield from the arduino because the two boards weren’t soldered together directly, which was very convenient for me during the wiring process.

Step 2: Beginning Wiring

Now I just had to complete the wiring. I started by attaching 2 wires to each motor, and connecting them to the motor shield. The motor shield I used required me to connect the wire via screwing it down rather than soldering it to the shield, something I became more and more thankful for as progress continued. After that I connected my power source in the form of a 7.4 volt rechargeable battery pack to the shield and did a quick motor test with an example code from an arduino library I downloaded. This test was a success and from that point all I had to do was get the PS2 controller working with the tank.

Step 3: Connecting the Controller

I knew this would be the most difficult part of the project, and I can’t say I was wrong, but I didn’t expect to be faced with the roadblock that I did. By this point it became clear to me that I had ordered a different motor shield than the one used by the guide I followed, which meant that the code given to me would not be compatible with my motor shield. The way I wired the PS2 to the shield was different from the guide as well. Instead of using header pins, which would have been easier and less messy, I ended up breaking the pins and ended up using wires to make the connection, and soldering the jumper wires to them. Even after checking the wiring and finding a special code for the shield I was using I was still getting no response from the shield. After even more time spent checking the wiring I came to the conclusion that the code was the problem. After many boring hours and many codes tested I finally found one that worked, and I got the controller working. The tutorial I followed to get this to work can be found in the code.

Step 4: Completing the Code, Challenges, and Reflection

As explained before connecting the PS2 controller was an annoying task, but I came across one other big issue, the gearbox. When I started getting the tank to respond to the controller, the motors became a big problem. The gears were moving around inside the gearbox and as a result not making contact with each other, which was necessary for the motor to function. I used spare parts to fill in the gap to stop them from moving around but it seemed that doing this made the other motor stop working efficiently, but this new problem seemed to go away in a few minutes when both motors started working just fine. I’m really happy to say that I finally finished this. I needed a lot of help along the way but I never thought I would be able to get this done in time.

Code I Used For My PS2 Controller (I used code for an Adafruit v2 motorshield, other shields will require different code)
//Source for code can be found here
//Tutorial I followed can be found here
#include <Wire.h>
#include <PS2X_lib.h>  //for v1.6
//#include <AFMotor.h>    // Use for older Adafruit Motorshield v1
#include <Adafruit_MotorShield.h>
#include “utility/Adafruit_PWMServoDriver.h”
Adafruit_MotorShield AFMS = Adafruit_MotorShield();   //  MotorShield v2
PS2X ps2x; // create PS2 Controller Class
//AF_DCMotor rightmotor(2);   // MotorShield V1
//AF_DCMotor leftmotor(1);
Adafruit_DCMotor *rightMotor = AFMS.getMotor(2);   //MotorShield V2
Adafruit_DCMotor *leftMotor = AFMS.getMotor(1);
//right now, the library does NOT support hot pluggable controllers, meaning
//you must always either restart your Arduino after you conect the controller,
//or call config_gamepad(pins) again after connecting the controller.
int error = 0;
byte type = 0;
byte vibrate = 0;
void setup(){
 Serial.begin(57600);
 AFMS.begin();  // create with the default frequency 1.6KHz
 //CHANGES for v1.6 HERE!!! **************PAY ATTENTION*************
 error = ps2x.config_gamepad(17,15,14,16, true, true);   //setup pins and settings:  GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error
 if(error == 0){
  Serial.println(“Found Controller, configured successful”);
  Serial.println(“Try out all the buttons, X will vibrate the controller, faster as you press harder;”);
  Serial.println(“holding L1 or R1 will print out the analog stick values.”);
  Serial.println(“Go to www.billporter.info for updates and to report bugs.”);
 }
  else if(error == 1)
   Serial.println(“No controller found, check wiring, see readme.txt to enable debug. visit www.billporter.info for troubleshooting tips”);
  else if(error == 2)
   Serial.println(“Controller found but not accepting commands. see readme.txt to enable debug. Visit www.billporter.info for troubleshooting tips”);
  else if(error == 3)
   Serial.println(“Controller refusing to enter Pressures mode, may not support it. “);
   //Serial.print(ps2x.Analog(1), HEX);
   type = ps2x.readType();
     switch(type) {
       case 0:
        Serial.println(“Unknown Controller type”);
       break;
       case 1:
        Serial.println(“DualShock Controller Found”);
       break;
       case 2:
         Serial.println(“GuitarHero Controller Found”);
       break;
     }
}
void loop(){
   /* You must Read Gamepad to get new values
   Read GamePad and set vibration values
   ps2x.read_gamepad(small motor on/off, larger motor strenght from 0-255)
   if you don’t enable the rumble, use ps2x.read_gamepad(); with no values
   you should call this at least once a second
   */
 if(error == 1) //skip loop if no controller found
  return;
 ps2x.read_gamepad(false, vibrate);          //read controller and set large motor to spin at ‘vibrate’ speed
 //  Using Analog sticks move left side and right side of robot independantly
 int joyValueLeft = scaleForMotor(ps2x.Analog(PSS_LY));
 Serial.print(“Left: “);                 // Only for serial monitor debugging
 Serial.println(ps2x.Analog(PSS_LY),DEC);
 if (joyValueLeft > 50){
   //leftmotor.setSpeed(joyValueLeft);
   //leftmotor.run(FORWARD);
   leftMotor->setSpeed(joyValueLeft);
   leftMotor->run(BACKWARD);
 }
 else if (joyValueLeft < -50){
   //leftmotor.setSpeed(joyValueLeft * -1);
   //leftmotor.run(BACKWARD);
   leftMotor->setSpeed(joyValueLeft * -1);
   leftMotor->run(FORWARD);
 }
 else{
 //leftmotor.setSpeed(0);
 leftMotor->setSpeed(0);
 leftMotor->run(RELEASE);
 }
 int joyValueRight = scaleForMotor(ps2x.Analog(PSS_RY));
 Serial.print(“Rightt: “);
 Serial.println(ps2x.Analog(PSS_RY),DEC);
  if (joyValueRight > 50){
   //rightmotor.setSpeed(joyValueRight);
   //rightmotor.run(BACKWARD);
   rightMotor->setSpeed(joyValueRight);
   rightMotor->run(BACKWARD);
 }
 else if (joyValueRight < -50){
   //rightmotor.setSpeed(joyValueRight * -1);
   //rightmotor.run(FORWARD);
   rightMotor->setSpeed(joyValueRight * -1);
   rightMotor->run(FORWARD);
 }
 else{
 //rightmotor.setSpeed(0);
 rightMotor->setSpeed(0);
 rightMotor->run(RELEASE);
 }
}
int scaleForMotor(int joyValue){
      int scaledVal = map(joyValue, 255, 0, -200, 200);
 //     Serial.print(scaledVal, DEC);
 //     Serial.print(“, “);
      return scaledVal;
}

First Milestone

My first milestone for my RC Robot Tank project was the construction of the tank itself. Doing this was quite a challenging task and I had to work hard to build it. I had to do things I had never done before like sawing through the plate to fit the gearbox on. Many of the parts used were small and often fell to the floor while I was working, making assembly take even longer. The hardest part so far was building the gearbox. The parts were small and got lost easily, which was a problem due to the lack of spare parts provided. In the end I’m happy to say I finally was able to overcome such a challenging part of this project.

Starter Project

STEM Summer Camps For Kids New York

Introduction

Hello, my name is Benjamin. I am going into ninth grade at the Summit Upper School and am looking to transfer to York Prep later. On my third day of attending the BlueStamp Engineering program I was able to complete my starter project, the TV-B-Gone. This small device has the ability to power on and off nearly every TV on the market. 

How It Works

This project works by emitting signals in the form of infrared light. This light is the same light used in most TV remotes to signal to the TV to turn on and off. This light is emitted by the LEDs, light emitting diodes, on the front. This project is powered by two AA batteries which fit into a battery pack which is later connected to the circuit board.The resistors are there to resist the current flow to prevent the circuit from burning up.The capacitor stores energy that is released back to the circuit when it is needed. The ceramic resonator and the microcontroller allow the infrared light flashes to sync to the TV using a specific resonance. The transistors are used to amplify and switch the electrical power and signal.

Challenges & Reflection

While this project was not intended to be overly challenging and had instructions that were easy for me to follow, I did find myself in a handful of frustrating situations along the way. Many of my troubles were caused by the close proximity of where the parts were supposed to go. If you slip up and solder into a hole that was not occupied by a part, you have to desolder it, or else you can not finish the project. Possibly the most frustrating part of this project was connecting the wires on the battery pack to the circuit board. Sometimes while you’re trying to solder a wire, the wire will move out of place and you may end up filling the hole with solder, which, as said earlier, makes finishing the project impossible until the hole is desoldered. I personally recommend this starter for people with little experience in engineering outside of Bluestamp. The building is very straightforward and it makes for good practice with soldering, as it is required for every part. It also uses parts that are very important for a large amount of other projects, so the knowledge you gain from completing and documenting this project will be very useful later.

Leave a Comment

Start typing and press Enter to search

Bluestamp Engineering