automatic video traking system

Post on 17-Oct-2015

20 views

Category:

Documents


0 download

TRANSCRIPT

From Mech

overview

The goal of this project was to create a device that would follow a moving infrared light. The IR Tracker does this by continuously detecting the position of an infrared emitter in two axises, and then tracking the emitter with a laser.The IR Tracker follows two major steps: (1) Identify the position of the IR emitter (2) Rotate the device to align itself with the IR emitter.The IR Tracker finds the location of the maximum infrared intensity in both the x- axis and y-axis. Two encoders continuously record the position of the IR emitter based on intensity levels detected by two IT detectors.Given the information about the location of the IR emitter, the device rotates itself in two dimensions to adjusts its plane to be normal to the IR emitter. At this point, the laser should point to the IR emitter.We will discuss the mechanical design, electrical design, PIC code, resulting project andour team reflections.

1.1 Mechanical Design 1.1.1. Primary ComponentsThe primary components used in this device are:1.2 Pitman Motors2.2 RC Servos3.1 Turntable (6031K17, McMaster-Carr, $2.20, readily available)4.1 Cylindrical Bearing1 LaserMirrorPlexiglas

Detecting Component Detecting Component

On the main plane of the device, two encoders are placed perpendicular to each other (able to track on two axises). Mirrors are placed on the output shafts of the two encoders at 45 degree angles. Two infrared detectors are placed in line with the encoders. While the encoders are constantly spinning, the mirrors detect light from the IR emitter and bounce the light to the IR detectors.

Rotating Component

1.2.Rotating ComponentBelow the main plane of the device, two servos are used to rotate the entire device to align the main plane to be normal to the emitter. The main plane is attached to a block of Plexiglas that surrounds a cylindrical bearing. This bearing allows the main plane to rotate along the y-axis. This block of Plexiglas is mounted on a turntable which allows the main plane to rotate along the x-axis.1.3.Electrical DesignPrimary Components1.1PIC (18F4520)2. 2 IR Detector / Emitter Pairs3. 2 Hall Sensors & Small Magnets4.2MOSFETs5.1Inverting Schmidt Trigger (74HC14)IR Tracker

3

The primary components used in this circuit are:IR Tracker Schematic (includes original H-Bridge in design --> use MOSFETs instead)

aIR Tracker Top View

0) output low(pin D3); f (PositionCountY > 4875) output high(pin D4); lse if(PositionCountY>0) output low(pin D4);ircheck()//Check to see//First half of//If IR detector//Gives visual //Increase moment //Increase count//Clear B5 ifThis finds the location of maximum infrared light in both the x-axis and y-axis. This information is originally collected as an encoder position count value, is converted into an angle in degrees and is then converted again into servo position count value, so that the servo can move to the appropriate location.void ircheck() where in the rotation {if(PositionCountX=4875)&&(MomentCountX>5)) //Runs when this function is called and IR detector {AverageAngleX = (MomentX/MomentCountX);//Averagethemoment to give the center of IR in terms of motor encoder countsif (((AverageAngleX)>650)&&((AverageAngleX) 4250) //Greater than 450 degrees {ServoTargetX = 2700;}else//between 90 and450 degrees {ServoTargetX = AnglePositionX + ServoCurrent[0] - 1550;}}MomentX = 0;//reset momentvariablesMomentCountX = 0;}if(PositionCountY=4875)&&(MomentCountY>5)){AverageAngleY = (MomentY/MomentCountY);if (((AverageAngleY)>650)&&((AverageAngleY) 4250) // greater450 deg{ServoTargetY = 2700;

{}else{ServoTargetY = AnglePositionY + ServoCurrent[1] - 1550;}}MomentY = 0;MomentCountY = 0;}}equalize()This syncs the speed and direction of the rotation of the two encoder motors.void equalize()//puts motors inphase with each other {if(PositionCountX>PositionCountY){set PWM1 duty(850); set PWM2 duty(1023);}else if (PositionCountX