| Swordfish Tutorial - GPS Module (LS20031) |
|
|
| Sunday, 27 September 2009 05:08 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The LS20031 GPS Module supports up to 32 Channels and outputs at 5Hz. That's some serious specs and a will serve the needs of almost any GPS application!
Also, the LS20031 GPS receiver includes an embedded antenna and GPS receiver circuits. It is a low-cost unit which outputs an astounding amount of position information 5 times a second. The receiver is based on the proven technology found in LOCOSYS 32 channel GPS SMD type receivers that use MediaTek chip solution. A long story short - its a great bit of kit for less than US$60 from most distributors. After building my development board and powering up the circuit, the LS20031 had picked up 5 satellites in less than 40 seconds - not bad given I was still in the house!! Note: There are 5 bare pads you can solder to - the unit does not contain a connector. Here's what the device looks like in real life;
Features:
Development and Prototyping
With one of these widgets in my possession, the first item on the agenda was to make a standalone development board. The module is so forgiving as it has 5 bare pads to solder the connections to - there are no other external components required. A side note though; the unit must operate at 3.3V, so use any PIC's with "LF" in their name. (for example, use 18LF2620, not 18F2620) as they can operate at lower voltages. The LD1117V33 (as shown below) is a 3.3V regulator. The development board makes use of the PICKit 2 to both program and monitor the data. As there are different data transfer paths to consider (such as UART between PIC to GPS, PIC to PICKit2, PICKit2 to GPS), some DIP switches were used to allow control over the data paths. Here's a screenshot of the PCB layout (click on the layout to download the bottom copper layout to print and make your own); Be sure that when wiring the LS20031 to the development board that Pin 1 of the LS20031 connects to Pin 1 on the dev board. Pinout of the LS20031;
The PCB was designed with Proton Ares and developed via a light transfer technique. Download the PCB Layout The PCB board costs about $4 and the components are less than $10. It took me about 1 hour to produce the PCB and another 10 minutes to solder on the components. The result;
In the above image; the circuit is operating and the PK2 is busy receiving UART data from the PIC (which is receiving NMEA sentences from the GPS module). Note that you should carefully monitor the circuit after building - the last thing you want is a blown voltage regulator because of a missed short circuit due to poor soldering etc. Also, the bottom copper side of the PCB has labelling for Vin and respective polarity. There is a diode in place to protect against reverse polarity. If all goes well, than the LED should light up with power applied (the 3 pin header switch) and the voltage regulator should only get warm (not HOT). To program the PIC - simply connect the PICKit 2 to the top 6 pin header, and program as per normal. There is no need to remove power as In Circuit Programming (ICP) protection is in place. Just set your PK2 to run at target Vdd and off you go.
First Power-Up
With the development board made, it was time to power up the circuit. As a fail safe, I removed the GPS module and ensured that the voltage regulator was functional before hand (3.3V), and also checked the current draw to ensure no short circuits on the tracks. With everything checking out, connecting the GPS module was simple enough as shown above. The DIP switches allow data paths to be selected, and prevent short circuits between multiple TX outputs. Starting from the left on the board layout they are as follows;
Above, a cropped image of the board layout, color coded for reference. So there's a few options heh, its really quite simple though. Given the first thing I want to do is inspect the raw data of the LS20031, I want direct coms from the GPS to the PICKit2. To do this, simply switch to "On" 3 and 4 of the above list. * Note: To prevent short circuits between multiple TX outputs, always turn switches "Off" before making changes *
I was a little annoyed at this point! Long story short; the LS2003x GPS modules can be factory programmed to whatever baud and NMEA sentences the distributor desires, mine was configured to 57600 baud and 5 different NMEA sentences (a little bit of overkill, and does not leave much overhead for the PIC). This is quickly apparent when the PICKit2 is connected to the PK2-GPS connector and the UART Tool is showing gibberish at all speeds including 38400 (the PK2 max). Given the information was starting to look consistent at 38400 baud, it was a matter of a guess to assume that the GPS was configured to the next common increment (57600 baud). Worry not, as the GPS module is programmable and customisable by end users as well. If your in the same boat, then use the following code on your PIC with DIP switches 5 & 6 on; Device = 18F2620
NMEA Sentances
It's a standard across all GPS modules, NMEA. Wiki does a decent job at breaking it down, this article is more focused toward just using it. You may have noticed on the previous page that the GPS module had been configured to operate at 38400 baud and only to use GGA & RMC NMEA sentences. These sentences are just that, sentences. They are structured to comply with a standard protocol to ensure the fields within the sentences are always the same. Here's what the GGA and RMC sentences contain;
GGA - Global Positioning System Fixed DataThe following table contains the values for this example: $GPGGA,053740.000,2503.6319,N, 12136.0099,E,1,08,1.1,63.8,M,15.2,M,,0000*64
RMC - Recommended Minimum Specific GJ SS DataFollowing table contains the values for this example: $GPRMC,053740.000,A,2503.6319,N,12136.0099,E,2.69,79.65,100106,,,A*53
With the above information, a programmer can get ample positional information. Now to extract the fields so that we can use the values in a more meaningful way.
NMEA.bas Library
Download the Swordfish user library NMEA.bas here, and save it into your "Swordfish\UserLibrary" folder. The GPS module has already been configured previously to operate at 38400 baud, with RMC and GGA NMEA sentences at 5Hz. This means that 5 times a second, two sentences will be transmitted. The following program will capture and parse these NMEA sentences with a structured approach. // device and clock
Sample programs make it easy to interpret the sequence to interface/use libraries. With the minor aspects aside, here's whats happening;
Results
Using the LS20031 GPS module was simply a breeze, not to mention it has good quality reception and reliable performance. I've had a few GPS modules move over my workbench, none worth writing about compared to this. Here are some screen shots of the PICKit 2 UART Tool screen and the development board in operation. A screen shot of the PICKit 2 UART Tool receiving formatted information from GPS NMEA sentences;
And the development board in operation;
Comments (6)
Joomla components by Compojoom
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Last Updated ( Friday, 06 November 2009 02:34 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Whos Online
- Jon Chandler
- andyo
Forum Activity
REALISTIC LED candle flicker - mrdeb Wednesday, 10 March 2010 05:48 - [0 replies]
the LCD demo hello world - mrdeb Wednesday, 10 March 2010 05:41 - [29 replies]
USB problem - jon chandler Tuesday, 09 March 2010 11:31 - [3 replies]
Servo Module - andyo Tuesday, 09 March 2010 03:39 - [3 replies]
pic to ps2 communication - roshan Friday, 05 March 2010 01:30 - [7 replies]
Way Off Topic: Worldwide Ignite Week - jon chandler Wednesday, 03 March 2010 20:33 - [4 replies]
PIC USB with C and Visual C++ Project - hop Tuesday, 02 March 2010 21:49 - [0 replies]
Recent Comments
- 2010-03-05 13:24:23 mrpse...
I was thinking of battery with powered routers or powered for every...
- 2010-03-05 12:17:40 andyo
50 rooms - wow. The XBee modules are very easy to use but I'm not ...
- 2010-03-05 11:46:37 mrpse...
Thanks AndyO. What I have to do is design a device to monitor temp...
- 2010-03-05 03:08:58 andyo
The circuit used for the remote sensor can be found here: [url]http...
- 2010-03-04 07:19:06 renno
plz i need help do u know from where i could download it or how cou...
- 2010-03-04 07:16:05 renno
hello everyone i'm trying to finish my final project and i want to ...
- 2010-03-04 02:49:38 Saira...
Thanks that was helpful
- 2010-03-04 02:35:35 Jon C...
There is a BlueTooth module available. If you used this, you can s...











Fantastic project tutorial Graham! I am VERY INTERESTED in this project! I have a fish finder that receives NMEA messages to allow a proprietary connection to a GPS module the maker sells. I made a cable and connector, modified my Magellan hand held GPS to connect to that cable and was feeding my finder those NMEA messages. It works great but it is cumbersome. Now I can build a module to connect to my finder and have that ability while leaving my Magellan at home because it has a busted LCD display.
NICE JOB! THANK YOU!
Hop