light-following robot - inside...
TRANSCRIPT
LIGHT-FOLLOWING ROBOT
EGGN 383 Final ProjectJacob DubinskyTyler Scott
Overview• Mobile platform that determines and drives towards the
direction of strongest light• If an obstacle is in the way, redirects and then resumes
following the light
Hardware• Arduino Uno• 4 Photoresistors• 4 10kΩ resistors• Two wheels with attached DC Motors and Rotary
Encoders• H-Bridge• Proximity Sensor• Platform
Schematic
Software Overview• Arduino Uno – ATMega328P• Registers instead of built in functions (digitalWrite(),
analogRead(), etc)• Interrupts• Analog Read• PWM
• Subsumption Architecture• Avoid obstacles has highest priority (lowest layer)
Interrupt Registers
Interrupt Registers
• Set INT# bit to enable interrupts on pin INT#
• Set I bit to enable global interrupts
Analog Read Registers
Analog Read Registers
PWM Registers
PWM Registers
Source (Register Slides 6-11): http://www.atmel.com/Images/doc8161.pdf
Phase-Corrected PWM
Source: http://www.cs.washington.edu/education/courses/csep567/10wi/lectures/Lecture7.pdf
Pseudo Code – Light FollowingInitialize PWM to 1kHz on pins D5,D6,D9,D10Initialize A/D converters on A0-A3Input capture on D2,D3 with interruptsLoop:Check analog valuesDetermine new directionCheck the speed of wheelsChange speed of wheels with PWMD5 = PWM D6 = 0 for left wheel forwardD9 = PWM D10 = 0 for right wheel forward
Interrupt:Calculate speed of right wheel
Interrupt:Calculate speed of left wheel
Pseudo Code – Obstacle AvoidanceLoop: // same loop as previous; broken up for readability// Read proximity voltageVproximity = ReadAnalog(ProximityPin)// Check if closer than 15 cm (1.75 V) to an obstacleIf(Vproximity > 1.75 V)Allow vehicle to turn, do not allow it to move forward
elseFollow light // loop in last slide
Questions?