woensdag 2 februari 2011

GPS tracer for school (Stenden)

GPS tracer

In my education I had some option to do a subject of choice. I chose to make a GPS tracer. To accomplish this I had to make a circuit board. I first made it on a bread board. In the next figure you can see the wire mess. The microcontroller I had to use was a PIC18f4550.

The GPS tracer had to do the following things.
·         Save data
·         Communicate with the GPS receiver
·         Communicate with the computer
·         Show data on a touch screen
·         Show the G forces on the touch screen

Saving the traces

The first idea for saving the data was to save it on a MMC card. MMC cards are cheaper for each MB than for example an EEPROM. But it gave big problems to connect the MMC card to the PIC microcontroller. First of all I had to change the 5V operating voltage to a 3.3V operating voltage for the MMC card. I solved that problem with a current splitter and the use of a Mosfet. But that’s where the problems began. Somehow I couldn’t communicate with the MMC card. After two weeks, I chose to use two EEPROMs (Microchip 24AA1025) instead of the MMC card. I save the x coordinate, y coordinate, speed, altitude and the 3 axis of the accelerometer on the EEPROM. The example below shows how I save the data. The ? is the closing character.
5255.8676,701.9997,98.24587,.7,1,3,7;
5256.0687,701.9443,96.13950,.7,11,3,9;
5256.2909,701.8583,95.13681,.7,1,3,7;
?

Communicate with the GPS receiver

For reading a GPS message I used the hardware UART interface. The GPS message consists of two strings. The GPGGA and the GPVT string. From these strings I get the x and y coordinates, speed, the number of connected satellites and altitude. When the data is received and processed it will be shown on the screen or it will log it onto the EEPROM. The logging of the data to EEPROM happens only 3 times a minute.

Communication with the computer

To communicate with the computer I use a TTL-232R-5V-PCB. At first, I wanted to use the USB interface of the PIC18f4550. Only this gave a problem. Sometimes the PIC wouldn’t connect with the computer. Also, there was the problem that USB firmware on the PIC uses almost 60% of its available RAM. So that’s the reason I chose the TTL-232R-5V-PCB. I connected the TTL-232R-5V-PCB to the soft UART because I used the hardware UART for the GPS receiver. To communicate with the PIC I made the next protocol.
Command
Reaction
B
Start pc communication
$start\r\n
G
Get the two GPS strings
$GPGGA,000622.976,0000.0000,N,00000.0000,E,0,00,50.0,0.0,M,0.0,M,0.0,0000*78\r\n
$GPVTG,,T,,M,0.000000,N,0.000000,K*4E\r\n
A
Accelerometer x, y, z
$ACC,0,4096,2341\r\n
P
EEPROM data
$EEPROM\r\n
Gpsx,gpsy,speed,altitude,accX,accY,accZ\r\n
Gpsx,gpsy,speed,altitude,accX,accY,accZ\r\n
...
$/EEPROM\r\n
E
Stop GPS tracer communication
$eind\r\n

Show data on a touch screen

To interact with the user I connected a 128x64 pixel touchscreen to the PIC. This is read by an ADC (microchip mcp3208). The accelerometer is also connected to the ADC. I only use the horizontal position, retrieved from the screen. Below is an example of the screen witch shows the current speed.



On the left and right are the navigation arrows. With those two arrows you can go to another screen. If it is a screen that you can set an action, like clearing the memory, or selecting if you want to log the data. Selecting an option can be done by touching the middle of the screen. At the top you can see what screen you’re in. If the text “LOG” is blinking, it means that there is a satellite connection and you’ve selected that you want to log the data. At the top right corner of the screen, you can see how many satellites are connected to the GPS receiver. On the bottom you can see the GPS time.
The following screens are available: 
     ·         Speed
     ·         Delete log
     ·         G forces
     ·         Altitude
     ·         Tracing on/off

GPS tracer computer program

Alongside the tracer, I also made a C# program. In this program you can select the traces you want to show in Google Maps. You can also see a graph with the speed, G forces and the altitude from each trace.
The program exists of 2 parts. The communication with the GPS tracer, and graphical user interface. The communication is a component/dll which I made. First of all, the component looks at every COM port and looks if the GPS is connected to that COM port. That is done by sending the command “B” to every COM port. When that’s done and the COM port sends the correct answer, it will use that COM port to communicate with the GPS tracer.
In the graphical user interface will fill the dataset with 2 csv files. In these files the different traces and trace data are saved. These are needed to make a kml file for the kml tree viewer and Google Maps. I used the FC.GEPluginCtrls.dll. This dll includes different components like the kml tree viewer, an options bar and the Google Maps viewer.
In the Graphical User Interface you can also see the trace altitude, speed and G forces in a graph. Furthermore you can see the current GPS time and number of connected satellites at any given moment. Below you can see a screenshot of the main window of the program.

There is also an option to see the current speed and the G forces. Those things are shown real-time in a graph. Beside the graph you can also see the G forces, especially the x and y forces in a Formula 1 style display as shown on television. This is shown below on the left. Further you can see the speed in a speedometer. The circle around the decimal speed will turn further and further red when you drive faster.

Geen opmerkingen:

Een reactie posten