Difference between revisions of "IR Tracker"

From Mech
Jump to navigationJump to search
Line 1: Line 1:
[[image:IR_Tracker.jpg|center]]
==Overview==


==Team Members==
The [http://info.hobbyengineering.com/specs/PX-GPSManualV1.1.pdf Parallax GPS (Global Positioning System) Receiver Module] is a fully integrated, low-cost unit with an on-board patch antenna. It provides standard, raw NMEA0183 (National Marine Electronics Association) strings or specific data from up to 12 satellites via its serial command interface. It can provide the current time, date, latitude, longitude, altitude, speed, travel direction, and other data.


[[image:Team_Picture.jpg|center]]
The Parallax GPS module was designed to be used with a Basic Stamp and to use two directional information transmission. In order to use this chip with a PIC, we will need to read in long serial strings containing all data and then parse the strings for important data to export. The PIC can use RS232 to read in the serial data and store a large array of all characters, which can then be parsed by searching for comma seperated values.
Mark Straccia, Matt Turpin, Alice Zhao (aka Team '7.5')


==Overview==
The NEMA strings this particular GPS outputs are GPGGA,GPGSA,GPGSV, and GPRMC in that order. For additional information about what data can be retrieved from these strings, go [http://home.mira.net/~gnb/gps/nmea.html here].


The IR Tracker is a device that can detect the position of an infrared emitter, and orient itself to be in line with the emitter.
Here is an example string:
[[image:GPS_Raw_Data_Stream|center]]


[[image:IR_Tracker.jpg|center]]
The goal of the project was to set up a one-way connection between the PIC and the GPS Receiver Module, in which the PIC interprets the raw data collected by the GPS Receiver Module and displays it in a user-friendly format on a parallel LCD (Liquid Crystal Display). Specifically for this project, there are three sets of information that can be displayed: Position (Latitude / Longitude); Time & Number of Satellites Detectable; Velocity / Direction of Movement.


The goal of the project was to:
We will first discuss the circuitry of PIC-GPS connection, followed by the method used to allow the PIC to gather data from the GPS Module, and finally how to display specific information on the parallel LCD.


This is how it works:
==Circuit==


We will discuss:
The four primary components used in this circuit are:


==Mechanical Design ==
* Controller (PIC)
* Parallax GPS Receiver Module
* Liquid Crystal Display
* Three buttons


[[image:Parallax_GPS_Wiring_Digram.jpg|400px|center]]
[[image:Mechanical_Design.jpg|400px|center]]
Image 1 shows the connection between the PIC and GPS Receiver Module.


The primary components used in this device are:
<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.


*Plexiglas structure
[[image:Parallel_LCD_Wiring_Digram.jpg|400px|center]]
*Turntable (part #, vendor, cost, when available)
Image 2 shows the connection between the PIC and LCD.
*Mirror (part #, vendor, cost, when available)


==Electrical Design==
[[image:GPS_Circuit.jpg|400px|center]]
Image 3 is an example of how to wire all these elements together on one breadboard


The primary components used in this circuit are:
==Code==


* Controller (PIC)
[[media:ParallaxGPS.c|See full code here]]


[[image:Circuit_Diagram.jpg|400px|center]]
Include headers and set serial rate to 4800 baud
Image 1 shows the connection between the PIC and ...


==Code==
#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++;
}
}


[[media:IR_Tracker.c|See full code here]]
Counting variables are reset to zero at the end of the while loop


==Results==
go = 0; //reset testing variables back to zero
commacount=0;


Our resulting project:
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.


==References==
==Reflections==


If we were to redo our project:
Parallax Info: http://info.hobbyengineering.com/specs/PX-GPSManualV1.1.pdf


*take more time planning - redid several times
Circuit Info: http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Parallel_Interfacing_with_LCDs
*mechanical design - more efficient
*code - simpler

Revision as of 05:01, 8 March 2008

IR Tracker.jpg

Team Members

Mark Straccia, Matt Turpin, Alice Zhao (aka Team '7.5')

Overview

The IR Tracker is a device that can detect the position of an infrared emitter, and orient itself to be in line with the emitter.

IR Tracker.jpg

The goal of the project was to:

This is how it works:

We will discuss:

Mechanical Design

Mechanical Design.jpg

The primary components used in this device are:

  • Plexiglas structure
  • Turntable (part #, vendor, cost, when available)
  • Mirror (part #, vendor, cost, when available)

Electrical Design

The primary components used in this circuit are:

  • Controller (PIC)
Circuit Diagram.jpg

Image 1 shows the connection between the PIC and ...

Code

See full code here

Results

Our resulting project:

Reflections

If we were to redo our project:

  • take more time planning - redid several times
  • mechanical design - more efficient
  • code - simpler