Hey guys, my name is John Paul. I come from a school called Community Health Academy Of The Heights. I live in the Bronx and I am about to become a senior next year. My project is the Hexbug spider moving in a white line. I choose this project right off the bat because I want to have the knowledge of building more robotic spiders, so that I may be able to scare my little sister and couisins at my home. In addition, I’m going to take advantage of this perfect opportunity that Bluestamp gave me to experience engineering.

MAIN PROJECT: HEX BUG LINE FOLLOWING ROBOT

Hexbug

3rd Milestone: Coding the Arduino

I face a big challenge when I was programming the hexbug robot, so during this milestone I was focusing on putting in a code that will make the leg motors move when the IR sensor picks up the white line. First I initialize the variables like where is the leg and the rotate motor. So I named the pins in which the leg motor is the LEG MOTOR and named the rotate motor to ROTATE MOTOR.  In addition, the leg motor was set to 4 meaning the digital pin 4, and the rotate motor was set to digital pin 6.  Second step was to program what these pins function would be. I did this in void setup() and set their function in pinMode(). Furthermore, Instead of using a black line to detect a lack of IR light, I decided to make the robotic spider detect the presence of IR light because the room i work in has to many black color tables, and that would have made the IR sensor to sense the entire table. I did this by switching the operand in my code so that the spider would following a white path placed on a dark background. Finally I changed the code so that the spider would rotate about 30 degrees at a time instead of rotating constantly which allowed it to sense more effectively.

Here is the bill of materials for the build:

Arduino Nano http://arduino.cc/en/Main/arduinoBoardNano

Hexbug Spider http://www.hexbug.com/mechanical/spider/

– QR1113 IR Sensor (Analog) https://www.sparkfun.com/products/9453

– 9V Battery

– Jumper Wires

Here is the Circuit Diagram for this project:

 

Hexbug Spider Schematic_schem3

Hexbug Spider Schematic 3

Here’s the code I use for my Hexbug:

int sensor = 5;
int legs = 4;
int rotate = 6;
// put in pin numbers
void setup()
{
pinMode(sensor, INPUT);
pinMode(legs, OUTPUT);
pinMode(rotate, OUTPUT);
Serial.begin(9600);
}
void loop()
{

int val = analogRead(sensor);
int legsLast = digitalRead(legs);
int motorLast = digitalRead(rotate);
Serial.println(val);
Serial.println(legsLast);
Serial.println(motorLast);

//put sensor value here. don’t forget less than!

if(val < 900) {

delay(250);
digitalWrite(legs, HIGH);
digitalWrite(rotate, LOW);

}
else if((digitalRead(legs) == HIGH))

{
digitalWrite(rotate, HIGH);
digitalWrite(legs, LOW);
Serial.println(“if working”);
delay(2400);

}

else
{
digitalWrite(rotate, HIGH);
digitalWrite(legs, LOW);

delay(200);
digitalWrite(rotate, LOW);
delay(500);
}

}

2nd Milestone: Weight Distribution

After finishing setting up the Hexbug with the Arduino Nano and IR Sensor, I was left with figuring out the weight problem for the hexbug. At first I tried to tape the 9 volt battery at the back of the arduino nano, but it was no use, the hexbug didn’t move. I took off the taped, then I tried to unscrew the head of the hexbug spider and tape the battery at the very base center of the robot,with the arduino nano taped on the top. It still didn’t move, but everytime I lifted up, the spider then starts funtioning and so from this I’d infer that it wasn’t that the 9 volt battery was putting to much weight on the legs, it needed more on it. So then I re-screw the head back on top of the hexbug, then I taped the battery in the center of the head and finally I taped the arduino on top of the battery. It work! Turns out that the leg motors needed an equal disrtibution of the battery weight for it to function properly.

1st MILESTONE : THE SETUP

My first steps was to unscrew the top of the hex bug, taking the batteries out and cutting off the controller for the hex bug(the receiver). I was left with 4 wires, 2 white ones and 2 black ones. There were a black and red wire but i didn’t need them so I cut them because the black and red wire do not connect with the any of the two motor for the Hex Bug (which are the head motor and leg motor).

In addition, since I’m using the Arduino nano, it act as a battery to provide power through the USB connected to a laptop or a computer. Then soder a jumper wire to each of the black and white wires. Each motor has two wires coming out of it ( white – positive and black – ground), so I had to make sure not to mix up the motor wires.

Furthermore, I’d use the breadboard as a template to soder the connection between the jumper wires and the Arduino nano. Next I soder the black wires to the GND (ground) of the Arduino uno while I soder the white wires to any of the digital pins (EX. D3, D5, D6,A8,A10, and A11).

I then soder in the IR SENSOR( QRE1113 Analog) to the Breadboard with the Arduino uno. There are 3 holes on the IR Sensor which are VCC ( high voltage), Out ( the output), and the GND ( ground). I soder the jumper wires pins to their location (GND) to GND on the arduino nano and VCC on sensor to 5v on arduino nano. Lastly I soder the OUT to any of the analog pin on the arduino that begin with “A.” In addition, I notice that the IR sensor was wobbling and moving around, causing it to getting entangle with the leg motors of the hexbug. To get around this issue, I taped the sensor in place with two hot glue stick, a crude but mostly an effective solution.

Starter Project: TV-B-Gone

2010_08_11

My starter project is called the “TV-B-Gone,” a kit from Adafruit. Its purpose is to turn off virtually every TV produced.  It works extremely well, I was able to turn off and on all the TVs in my house from as far as 15 feet a way.

How it work is that since every TV that is able to be remotely controlled has an infrared light (IR) sensor.  TVs are able to be remotely controlled by different sequences of pulsing IR light, meaning that each brand of TV responds to a specific sequence of IR pulses.  So the TV-B-Gone works by emitting IR pulse sequences from its two narrow, long-range IR LEDs and two wide, short-range IR LEDs.  Inside the microcontroller, the sequences for almost 100 brands are stored.  When the button is pressed, the microcontroller activates a transistor for each LED based on the sequence for a specific brand.  Once the first sequence is emitted, the microcontroller sends the next brand’s code, and continues to send sequences to the transistors for all codes stored.

It takes 69 seconds for the TV-B-Gone to go through all of its stored codes.   Besides the microcontroller and transistors, other parts in the TV-B-Gone play important roles, too.  The green LED towards the back of the device lights up when the TV-B-Gone is currently emitting IR pulses.  The ceramic oscillator sits right next to the microcontroller, acting as its watch and timekeeper, so the IR LEDs emit at the right moments.  There are two resistors in the device, one to restrict the current going into the green LED, and one to restrict the current going into the IR LEDs, so the LEDs do not get fried by a surge in energy.  The electrolytic capacitor, which charges from the two AA batteries underneath the device, is the main controller of energy for the device, and increases the flow of energy while the TV-B-Gone is emitting.

At first I came across a few problems while assembling this device. When I started to assemble it, I inserted the small green LED and the microcontroller chip on the circuit board wrong, and it didn’t function right. I then rechecked all of my circuits on the circuit board, found out what the problem was and fixed it by using the soldering iron tool on it.

This device was extremely fun to make, and will provide countless hours of fun and entertainment of pranking people by turning off their TVs.

Leave a Comment

Start typing and press Enter to search

Bluestamp Engineering