140 likes | 166 Views
Phillip Profitt. How to own Robot Competitions. Why a line follower?. Needed a starting project Wanted to learn the MC IEEE sponsored a competition I thought it would be an easy project. Competition Rules:. Time Trial Robot no bigger than 1’ Points deducted for touching robot
E N D
Phillip Profitt How to own Robot Competitions
Why a line follower? • Needed a starting project • Wanted to learn the MC • IEEE sponsored a competition • I thought it would be an easy project.
Competition Rules: • Time Trial • Robot no bigger than 1’ • Points deducted for touching robot • All different types of crazy curves • Extra points for building from scratch
How much did I know? • My electrical background: • Almost 0 • How long? Took about 1 month • Thanks to Darren, for all the help!
System Overview • I know its bad, don’t laugh..
So, how does it see? • Incased infrared LED • Phototransistor • Programmed Sensor Logic • 16 different states if(volt2 > FRONT) { state = state|0x08; } if(volt1 > BACK) { state = state|0x04; } State ex. if front and back: State = 00001100
Case Statement Examples switch(state) { case 0: // go straight SPEED_right(.5); SPEED_left(.5 ); break; case 1: // go straight SPEED_right(.5); SPEED_left(.5 ); break; case 2: //turn left SPEED_right(0.0); SPEED_left(.35); break;
Interfacing with the MC • Used two main things: the 12 bit ADC • 16bit PCA Pulse Width Modulator voltage = ((float)VREF/(float)4096)*voltage; // The equation used in the process (VREF/2^nbits)*(voltage) void SPEED_right(float percent){ unsigned int x = 0; //temp variable for PCA0L and PCA0H x = (unsigned int)(65536.00*(1.0 - percent)); // Places the correct value into X, for the duty cycle percentage PCA0CPL0 = (unsigned char)(x & 0x00FF); // Writes the correct value to the Low Register PCA0CPH0 = (unsigned char)((x & 0xFF00) >> 8); // Writes the correct value to the High Register }
Any Problems? Of course PCA outputs 3.3v, motors run on 6v Used MOSFET to amplify the signal Broken gears on the first car.. Bought a new car. Among others..
So How did it end up? Go check all the floors in Anderson Tower, You might see a picture of my legs, and the Line Stalker
Improvements? • Wheels in the front have a lot of friction • Code to control the power ratio of the battery to the motor output • Smaller Car
What did I learn? • How to interface with the 040 • Differences in C and C++ • Soldering skill went up +20 • Darren gets really excited, a lot • Hardware