My name is Christopher and I am a rising Sophomore at KIPP Sunnyside High School. My current GPA is approximately a 3.60 to 3.70.  I’m planning on  attending RICE University and becoming an electrical or mechanical engineer. I currently take an “Intro” to engineering class during school and planning to ride it out for all 4 years of my High school experience.

Final Project

For my final project, I programed a Hextech Spider Robot to avoid edges. This robot uses IR sensors to detect the light reflecting of an surface and turns it into values. The motors of the robot takes these values and uses them in a way where I can tell it what I want it to do with those values. All I did was take the values from when it was on the surface and the values when it was off the table and put it into a program. Basically, the program reads then this value, which is off the table, I want you to turn your “head”, or motor A and when both the IR sensors reach the values on the table, I want you to turn your “legs”, or motor B forward.

Documentation

Code

IMG_4822  Spider robot
PICTURE                                                                 SCEMATIC

 

First I had to hack into the head of the robot and disconnect the “brain” which is a circuit with a IR receiver  and hijack the motors. After Hijacking the motors I had to figure out how exactly was I suppose to control those motor in the manor I wanted them to. S0, after  thinking my first attempt was with this  transistor circuit.

 

learn_arduino_breadboard.jpg

https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/breadboard-layout

(This is adafruit’s design)

In the end this circuit did work; however, not in the way I wanted it to. Whenever I would plug the motors into their selected locations they would start, but wouldn’t stop. It seemed as though the motors wouldn’t respond to the actual program. That’s when one of the instructors, Rachel, suggested that I use a motor shield. I recommend using the Arduino motor shield as well because it made my life way easier and I’m sure it will work for everyone else too. Lastly, all I had to do is insert the motors into the shield.

Next was to test the motors and make a simple program that would allow the motors to just  move. This program made by adafruit was my first program I tried that worked very well. The motors where not just controlled my turning them on or off, but by increasing and decreasing the speed.

 

int motorPin = 3;

void setup()

{

pinMode(motorPin, OUTPUT);

Serial.begin(9600);

while (! Serial);

Serial.println(“Speed 0 to 255”);

}

void loop()

{

if (Serial.available())

{

int speed = Serial.parseInt();

if (speed >= 0 && speed <= 255)

{

analogWrite(motorPin, speed);

}

}

}

For the IR sensors, all I had to do was use a code that would accept the values that the sensors sent to one of the Analog pins and use that to interact with the movement. To do this I took a value from when it was off the edge and another value when it was table and used those to set up the code. Also, I had to find a reasonable spot to put the sensors that that they pointed downward while still being able to reach past the legs so that it can detect the values ahead of time to that it doesn’t fall off the edge.

 

My next objective was to add another IR sensor because due to the robot being so wide scale, it needs to be able to not fall off from the side. To prevent this the best thing to do was a another IR sensor left of the previous one. I recommend that you also have one on the right side to that it doesn’t fall on the right as well. Due to the IR sensors having to take 5 volts and the Arduino motor shield having only one 5 volt slot I had to solder both the IR’s % volt wires together so that they both accept power.

For the code, all I had to do is add the analog pin and make sure that the motors reads the values from both of the IR sensors twice. Once the robot reaches the edge and when it gets the “OK” to move forward. The only problem that I encountered with the two IR sensors was that they didn’t really work together. While one would pick up the single for the “OK” to move the other would pick up the value to “Turn” which messed with the motors.

Lastly, in order to fix the problem I had earlier with the IR sensors all that I had to do was to make sure that both values where being read before and after the edge was detected which is something I forgot to do.

The materials used in this project was:

  1. Arduino Uno
  2. Arduino motor shield
  3. Jumper Wire
  4. 2 or 3 IR sensors(2Y0A02)
  5. wood or metal
  6. 9 volt battery
  7. HEX BUG(spider XL)

Some websites that  I used information from are as follows:

  1. https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/breadboard-layout
  2. https://learn.sparkfun.com/tutorials/ardumoto-shield-hookup-guide

Starter Project.

The first project I started with was the Exploding Start organ, which uses the sounds in the environment to synchronize  a chain of LEDs. This circuit consist of 25 LEDs, 11 resistors, 7 transistors, a sound receiver, a 9 volt battery, and more. the only problem I had with creating this circuit is when the time came to solder all the parts to the board, the solder from corresponding parts would get stuck together which  prevented the circuit  from functioning correctly. In addition, some of the LEDs and other essential components would break forcing me to get new ones.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Leave a Comment

Start typing and press Enter to search