My name is James Reyes, I am a rising senior at the Renaissance Charter High School for Innovation. The projects I choose to make in my six weeks at Bluestamp are a exploding star light organ kit, and the RC robot tank. I choose these projects because both seemed to be fun and interesting. The RC robot tank, is a tank that is simple to make and is controlled by a PS2 controller. I was able to finish my tank quickly and was able to make a 3D printed case for my tank, as shown in the images below. During the six weeks here at BlueStamp I grew as an engineer and was able to strengthen previously learned skills such as Arduino coding and soldering.

20140730_11010320140731_111601

My Second(last) Milestone

Today, Wednesday, July 9th, 2014, I finished my second/last Milestone for my main project. My main project is the Remote Controlled Robot Tank. These last few days I had many issues in getting my tank to be remote controlled. One of the first problems was getting the wrong type of controller, twice, it was not a major issue because I was able to borrow a control from a peer and test out the code I found on the blog of the original creator. Borrowing the controller lead me to a second problem, The Arduino sketch could not read the PS2X library, which was a necessity for the tank to be remote controlled. I was able to fix this problem by making the file containing the library a .Rar file and then un-.Rar-ing it. The same day that I got the code working (Tuesday, July 8th, 2014) I got the correct controller, but once I ran the code, the tank would not move to the controllers input. I was able to fix this connectivity issue by following the old joke of turning it off and on again, also I had to reset the Arduino after the controller connected to the dongle. My last issue was the weight of the tank. The battery pack was supposed to be on the top of the motors, but it interfered with the movement of the gears so I moved the battery pack to the front and put the Arduino on top of it to make the weight more balanced. I am now done with the RC Robot Tank. The RC Robot Tank was created using Tamiya track and wheel set, Tamiya universal plate-set, Tamiya Twin-Motor Gearbox, Arduino Leonardo, DF Robot Motor shield, wireless PS2 Controller with a wireless dongle,  battery pack, and Jumper wires. The motors have foil tabs on the sides to which I soldered jumper wires. The Arduino and Motor Shield attach easily, and each of the four wires from the motors go into a little box on the Motor Shield. I soldered the battery pack wires to jumper wires that I attached to the motor shield, in designated areas. I knew where to put the jumper wires because I followed the pictures from the original creators blog. The wireless dongle was torn apart so that the pins and jumper wires could attach easier. Uploading the code to the Arduino was mostly easy, even though there were issues. The code was found on the blog post of the original maker(http://paulbleisch.com/blog/2013/01/03/simple-remote-controlled-arduino-tank/) and the library was found on a PS2 to Arduino blog (http://www.billporter.info/2010/06/05/playstation-2-controller-arduino-library-v1-0/). The Arduino, being like a computer was able to read the PS2X library and make it so that the PS2 controller inputs moved the tank in the direction of the users choice. The L1 and R1 make the tank move forward and L2 and R2 make it move back.

Schematic Below: /note* The wireless Dongle part can be found in the Bill Porter Website and The Materials needed can be found on the original blog.

JamesR Tank Schematic

JamesR Tank Circuit Diagram

My SketchUp tank shell: Tank shell with less width and height

Source code:

#include <PS2X_lib.h>
// Glue together PS2X controller code with DFRobot Motor Shield code
//
#include <PS2X_lib.h>  //for v1.6
 
PS2X ps2x; // create PS2 Controller Class
 
//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;
 
//Arduino PWM Speed Control for DFRobot Motor Shield (default pins)
int E1 = 6;
int M1 = 7;
int E2 = 5;
int M2 = 4;
int lmotor = 0;
int rmotor = 0;
 
void setup()
{
  Serial.begin(9600);
 
  // set pin modes for DFRobot Motor Shield
  pinMode(M1, OUTPUT);
  pinMode(M2, OUTPUT);
 
  error = ps2x.config_gamepad(13,11,10,12, 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. ");
   }
 
   type = ps2x.readType();
   if (type != 1)
   {
     Serial.println("warning: DualShock Controller Not Found!");
   }
}
 
void loop()
{
 if(error == 1) //skip loop if no controller found
  return;
 if (type == 1)
 {
    ps2x.read_gamepad(false, vibrate);          //read controller and set large motor to spin at 'vibrate' speed
 
   lmotor = 0;
   if (ps2x.Button(PSB_L1))
     lmotor = 255;
   if (ps2x.Button(PSB_L2))
     lmotor = -255;
 
   rmotor = 0;
   if (ps2x.Button(PSB_R1))
     rmotor = 255;
   if (ps2x.Button(PSB_R2))
     rmotor = -255;
 
 }
 else
 {
   lmotor = 0;
   rmotor = 0;
 }
 
 // update motors
   if (lmotor < 0)
   {
    digitalWrite(M1, LOW);
    analogWrite(E1, -lmotor);   //PWM Speed Control
   }
   else
   {
    digitalWrite(M1, HIGH);
    analogWrite(E1, lmotor);   //PWM Speed Control
   }
 
   if (rmotor < 0)
   {
    digitalWrite(M2, LOW);
    analogWrite(E2, -rmotor);   //PWM Speed Control
   }
   else
   {
    digitalWrite(M2, HIGH);
    analogWrite(E2, rmotor);   //PWM Speed Control
   }
 
 delay(30);
}

Bill of Materials: Student Bill of Materials

My First Milestone

Today, on July 3, 2014, I reached my first milestone. The past few days of this week, I started my main project and I have been building it up. On Tuesday I began by assembling my motor. The assembly was rather simple except when attaching the gears because they kept falling and not staying in place. On Wednesday I assembled the chassis which was simple because I used a universal Tamiya plate set, and a Tamiya track and wheel set. I was also able to attach the motor to the motor shield, and I found the code to test the motor, but was unable to test the motor because the code was not working. Finally today Thursday, July 3, 2014 I got the code to work and now my tank is is able to move around. My next step will be to attach the controller dongle to the tank so that it could be remote controlled. I fixed the problem with the code not working by luck. I kept on trying different ports until finally one worked.  Another problem was that I got the wrong controller for my project. The Controller is supposed to be a PS2 wireless controller, but what I got was a wired Xbox controller. This was fixed by ordering another controller that will arrive in the next few days.

Starter Project

My name is James, as my starter project for the BlueStamp Engineering Program was the Light Organ Kit. The Light Organ displays beautiful LED lights in star arrangement that light up when the MIC ,that is comes with, detects noise. The Light Organ can be used while listening to music so that a person can enjoy themselves in a visual and auditory way. The Light Organ works using transistors, resistors, capacitors, LEDs, IC’s, and Horizontal Trimmer Resistor’s 5KΩ and 1MegΩ. The first 3 Transistors act as amplifiers for the power. When sound is picked up from the microphone, the transistors amplify the sequence of the noise detected and the IC changes the sequence to pulses. The pulses then get sent to IC2, when it receives a pulse it sends the pulses to other pin. The output pulses are then coupled to output transistors in sequence. The output transistors each control a group of LED lights.

Comments
  • Michelle Pomeroy
    Reply

    James, you are incredible! Great work.

Leave a Comment

Start typing and press Enter to search