User:Skwon9642/ENES100 (Fall 14)/Project 2

Week1 Narrative
task: keep working on arduino code. Ali mentioned that the error code is possibly due to the sensor not connected to the arduino.


 * Assigned Professor Plotnick to the task: attach pin adapter to the QTR sensor


 * It can now be attached to the brackets
 * Bracket prototype will be removed and real brackets will be installed

next steps:
 * wire up sensor to Arudino and test for error
 * Use Fritzing software to learn how to wire sensor to Arduino

Week2 Narrative
task: learn about each different components on the this Adafruit motor shield

tasking:


 * I joined the arduino forum and posted the question on how to connect the sensor to the motor shield Here


 * Found a youtube video that uses the same kit that this project is using.


 * Blue plastic connections labeled "M1 - M4" is a port used to connect DC motors. It can connect up to 4 DC motors at the same time.
 * Pins labeled as "ser1-ser2" is used for servos which This project does not use.
 * Pins labeled digital 0-12 correspond to the 0-12 pins on the arduino.


 * bought a sidekick basic kit for arduino from radioshack, and "how to build a robot" book by MAGBOOK magazines.
 * Red wires connect sensor to motorshield
 * Black wire is ground
 * 2 pairs of black/red wire is for the 2 DC motors for the wheels

next steps:
 * run the code and check for errors. Fix errors

Week2 Narrative

 * upon discussing with Prof. Plotnick, our group wanted to present in the seminar.
 * our group decided to present if we can get the robot to move in a straight line before the Thursday seminar.

include 

AF_DCMotor motor(1, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

void setup {

motor.setSpeed(255); // set the speed to 200/255

motor2.setSpeed(255); // set the speed to 200/255 }

void loop {

motor.run(FORWARD); // turn it on going forward

motor2.run(FORWARD); // turn it on going forward

delay(1000);

}

The code enables the user to control the speed and direction of the motors


 * video to show that motor is spinning without any errors

Week3 Narrative
Task: to prepare for presentation in seminar


 * decided to set a sub-goal of making the robot go forward, without any sensors
 * found a code that spins 1 motor back and forth

include 

AF_DCMotor motor(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

void setup {

Serial.begin(9600); // set up Serial library at 9600 bps

Serial.println("Motor test!");

motor.setSpeed(200); // set the speed to 200/255

}

void loop {

Serial.print("tick");

motor.run(FORWARD); // turn it on going forward

delay(1000);

Serial.print("tock");

motor.run(BACKWARD); // the other way

delay(1000);

Serial.print("tack");

motor.run(RELEASE); // stopped

delay(1000);

}


 * this program powers only 1 motor and goes forward for 1 second, backwards for 1 second and rests at 1 second.


 * I modified this code to power 2 motors and continue going in 1 direction

include 

AF_DCMotor motor(1, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

void setup {

motor.setSpeed(255); // speed 255/255

motor2.setSpeed(255); // speed 255/255

}

void loop {

motor.run(FORWARD); // turn it on going forward

motor2.run(FORWARD); // turn it on going forward

delay(1000);

}


 * This revised code powers 2 motors that go in the forward direction and keeps going untill the end.


 * Since our code tells the robot to go in a straight line, it was possible for the audience to think the robot is just being powered by the battery.


 * So I made a code that made the robot go forward for 1 second, and stop for 1 second, then repeat to prove that the robot is operation through the code.

include 

AF_DCMotor motor(1, MOTOR12_64KHZ); // create motor #2, 64KHz pwm AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

void setup { motor.setSpeed(255); // set the speed to 200/255 motor2.setSpeed(255); // set the speed to 200/255 }

void loop { motor.run(FORWARD); // turn it on going forward motor2.run(FORWARD); // turn it on going forward delay(1000);

motor.run(RELEASE); // stopped motor2.run(RELEASE); // stopped delay(1000);

}


 * We have achieved the sub-goal of making the robot go forward

Next steps:


 * modify the code to integrate the QTR sensor
 * wiring sensor into arduino

week4 Narrative
task: make code for QTR sensor


 * Got pin headers on motorshield and sensor (tasked Mr. Plotnick)
 * Got another Polulu sensor from Mr. Plotnick
 * Ran QTRAExampleValue code that was part of the library downloads
 * This code allows user to validate that the sensor reading values from it's surroundings.


 * Higher value means the sensor is experiencing minimal reflectance (black)
 * Lower value means the sensor is experiencing maximum reflectance (white)

next task:
 * find out why the 3rd pin is always reading higher than others and always on consistent regardless of exposure to black tape
 * find the code that links the sensor values into motor motion