Difference between revisions of "IR Tracker"
From Mech
Jump to navigationJump to searchLine 1: | Line 1: | ||
[[image: |
[[image:IR_Tracker.jpg|center]] |
||
==Team Members== |
==Team Members== |
||
Line 24: | Line 24: | ||
* Mirror (part number, vendor, cost, when available) |
* Mirror (part number, vendor, cost, when available) |
||
[[image: |
[[image:Mechanical_Design.jpg|400px|center]] |
||
The goals: |
The goals: |
||
* Pitman Motors - constantly detect location of the emitter |
* Pitman Motors - constantly detect location of the emitter |
||
* RC Servos - |
* RC Servos - move the device to get align with emitter |
||
==Circuit== |
==Circuit== |
||
The |
The primary components used in this circuit are: |
||
* Controller (PIC) |
* Controller (PIC) |
||
* H-Bridge |
|||
* Parallax GPS Receiver Module |
|||
* Hall Sensors |
|||
* Liquid Crystal Display |
|||
* Schmidt Triggers |
|||
* Three buttons |
|||
[[image: |
[[image:Circuit_Diagram.jpg|400px|center]] |
||
Image 1 shows the connection between the PIC and GPS Receiver Module. |
|||
<b>Note</b> that the pin labeled "Raw" needs to be grounded with a 1K resistor. The serial line also needs to be pulled high with a 1K resistor. |
|||
[[image:Parallel_LCD_Wiring_Digram.jpg|400px|center]] |
|||
Image 2 shows the connection between the PIC and LCD. |
|||
[[image:GPS_Circuit.jpg|400px|center]] |
|||
Image 3 is an example of how to wire all these elements together on one breadboard |
|||
==Code== |
==Code== |
||
[[media: |
[[media:IR_Tracker.c|See full code here]] |
||
Include headers and set serial rate to 4800 baud |
|||
#include <18F4520.h> |
|||
#fuses HS,NOWDT,PUT,NOLVP |
|||
#use delay(clock=20000000) |
|||
#use rs232(baud=4800, rcv=PIN_C1) //can use any pin to read from GPS, but define it here |
|||
#include "flex_lcd.c" //included to allow easy writing to a parallel LCD display |
|||
Variable declarations and start of main loop |
|||
char letter[300]; |
|||
int go = 0,wait = 0,commacount = 0,dataoutput = 1,j = 0; |
|||
int16 i; |
|||
int16 comma[90]; |
|||
void main() |
|||
{ |
|||
lcd_init(); |
|||
while(TRUE) |
|||
{ |
|||
One of the most important aspects of this code is waiting for signal to return to high. Without this section, the rs232 command could end up in the middle of the output of the GPS and render all information unusable. This loop waits for the signal to remain high for over 2 bytes to ensure it is at the stop position before beginning to read. |
|||
for (wait=0;wait<20;) //for loop used to wait until signal has reset. 20*50us=1ms>two bytes of ones at 4800 baud |
|||
{ |
|||
if (input(PIN_C1)==1) |
|||
{ |
|||
wait++; |
|||
} |
|||
else if (input(pin_c1)==0) |
|||
{ |
|||
wait = 0; |
|||
} |
|||
delay_us(50); |
|||
} |
|||
After getting into the data loop, all data is recorded into a 300 character matrix letter |
|||
for(i=0;i<300;i++) //record 300 characters into letter matrix |
|||
{ |
|||
letter[i]= getc(); |
|||
} |
|||
The data is then parsed into sets of commas. |
|||
for(i=0;i<300;i++) //parse matrix for commas (ascii=44 for a comma) |
|||
{ |
|||
if (letter[i] == 44) |
|||
{ |
|||
comma[commacount] = i; |
|||
commacount++; |
|||
} |
|||
} |
|||
Counting variables are reset to zero at the end of the while loop |
|||
go = 0; //reset testing variables back to zero |
|||
commacount=0; |
|||
==Results== |
|||
To finish the program, data must be converted into a usable format and output to the LCD screen. See full code above for an example of how to do this. |
|||
Our resulting design: |
|||
==References== |
|||
==Reflections== |
|||
Parallax Info: http://info.hobbyengineering.com/specs/PX-GPSManualV1.1.pdf |
|||
* More planning |
|||
Circuit Info: http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs |
|||
* Simpler mechanical design |
|||
* More efficient code |
Revision as of 05:20, 8 March 2008
Team Members
Mark Straccia, Matt Turpin, Alice Zhao (Team '7.5')
Overview
The IR Tracker is a device that detects the position of an infrared emitter and orients itself to get in line with the emitter.
The goal of our project is:
This is how it works:
We will discuss:
Mechanical Design
The primary components used in this circuit are:
- Plexiglas
- Turntable (part number, vendor, cost, when available)
- Mirror (part number, vendor, cost, when available)
The goals:
- Pitman Motors - constantly detect location of the emitter
- RC Servos - move the device to get align with emitter
Circuit
The primary components used in this circuit are:
- Controller (PIC)
- H-Bridge
- Hall Sensors
- Schmidt Triggers
Code
Results
Our resulting design:
Reflections
- More planning
- Simpler mechanical design
- More efficient code