light-following robot - inside...

15
LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

Upload: vuthuy

Post on 09-Mar-2019

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

LIGHT-FOLLOWING ROBOT

EGGN 383 Final ProjectJacob DubinskyTyler Scott

Page 2: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler 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

Page 3: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

Hardware• Arduino Uno• 4 Photoresistors• 4 10kΩ resistors• Two wheels with attached DC Motors and Rotary

Encoders• H-Bridge• Proximity Sensor• Platform

Page 4: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

Schematic

Page 5: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

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)

Page 6: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

Interrupt Registers

Page 7: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

Interrupt Registers

• Set INT# bit to enable interrupts on pin INT#

• Set I bit to enable global interrupts

Page 8: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

Analog Read Registers

Page 9: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

Analog Read Registers

Page 10: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

PWM Registers

Page 11: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

PWM Registers

Source (Register Slides 6-11): http://www.atmel.com/Images/doc8161.pdf

Page 12: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

Phase-Corrected PWM

Source: http://www.cs.washington.edu/education/courses/csep567/10wi/lectures/Lecture7.pdf

Page 13: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

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

Page 14: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

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

Page 15: LIGHT-FOLLOWING ROBOT - Inside Minesinside.mines.edu/~whoff/courses/EENG383/projects/2012fall/Dubinsky... · LIGHT-FOLLOWING ROBOT EGGN 383 Final Project Jacob Dubinsky Tyler Scott

Questions?