Search This Blog

Showing posts with label GPS. Show all posts
Showing posts with label GPS. Show all posts

Wednesday, September 22, 2010

Arduino GPS Tracker completed

Wrapped up the Arduino based GPS tracker project!

This project used a SIRF GPS module I bought off Ebay, integrated with a data logging shield that can write to an SD card.  The Arduino microcontroller board makes it all work together.  The code supports and LCD readout of the GPS coordinates, heading, speed, etc.   In the photos below the LCD is removed because it didn't fit in the case nicely.  I'm making another version that has a readout when the parts come.

Basically this is a teen tracker.  As long as it is powered, it logs GPS coordinates of the trip every few seconds.  It records speed as well (not perfectly accurate).   Using gpsvisualizer web site, you can pull out the SD card, put it in your computer, point to the file that is saved and draw a map of the trip.  I even tested this in the trunk of the car, and it worked perfectly. 

Here is a photo of the completed unit, in it's box.   Also shown is the cell phone USB battery that I got at Target, foam taped to the side of the unit.  This might seem odd, but the unit would normally draw power from a USB adapter from a car, not from this battery.



Here is a shot with the case open, showing the adafruit data logger shield with the GPS module hanging off to the side, installed in the prototype area of the shield.  The Arduino itself is beneath the shield that you can see.
It all snaps inside this project box from Sparkfun.



I polished up the code so the waypoints are taken more often, unless the speed is low in which case some delays are added to keep the file down.  I added some LCD display improvements including displaying the compass direction next to the heading (i.e. N, E, S, W, NE, etc).  Took it bike riding at it worked perfectly too.

Earlier posts have links to the build, but a couple notes on the circuit, since i havent drawn it.

The box is $11.95 from Sparkfun http://www.sparkfun.com/commerce/product_info.php?products_id=10088

The adafruit sd logger card is the base prototype board.  I built it up according to it's directions, it is a nice prototype card.  I attached the GPS in the empty prototype area.  $19.50 and worth every penny.
http://www.adafruit.com/index.php?main_page=product_info&cPath=17_21&products_id=243
It supports the SDFat library, which writes to and SD card in a format that is directly readable by your PC in a .csv file.

You can get several LCD modules from Digikey if you want one.  I used this one for $9.25
http://search.digikey.com/scripts/DkSearch/dksus.dll?WT.z_header=search_go&lang=en&site=us&keywords=NHD-0208AZ-FL-YBW-ND&x=21&y=15

The GPS module came for $30 from ebay http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=250686123796&ssPageName=STRK:MEWAX:IT#ht_500wt_898

The GPS has a two wire serial interface, described in it's documentation and the photo below.  Instead of pins 2,3 I moved the interface to pins 8,9 to avoid conflicts with the LCD and SD card.   Pins 10 and above are used by the SD card interface built into the proto board.   I did not use a serial LCD like in this example, i used a parallel one.   The LCD is hooked up like the Arduino library examples, except the pins are moved to 7,6,5,4,3,2.
(photo borrowed from i182will)

Here is a dump of the code.  Atrocious coding as it is.  I works though!  I am a brute force programmer.

Tuesday, September 21, 2010

Awesome - The GPS tracker makes a map

Hooray, the GPS worked perfectly, the logger logged and the gpsvisualizer sucked in the data and made a map.

By now someone could figure out where i live by these posts, but i'm pretty sure nobody will ever read any of this.

The log file can be uploaded directly to this website, and badabing, a map like this one:
http://www.gpsvisualizer.com/map_input?form=google

Arduino GPS Unit, photos and links to parts




Here are pictures of the completed working unit.  A quick compilation of what it is made of:

Arduino board from hacktronics via Amazon $28
http://www.amazon.com/gp/product/B004A7L3NC/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=workingsilico-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B004A7L3NC

Adafruit datalogger board
http://www.adafruit.com/index.php?main_page=product_info&products_id=243

GPS module from Ebay $30 This is a SIRF3 module
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=250686123796&ssPageName=STRK:MEWAX:IT#ht_500wt_1154

NewHaven LCD DisplayNHD-0216K1Z-FS(RGB)-FBW-REV1-ND  from digikey $8
http://search.digikey.com/scripts/DkSearch/dksus.dll?WT.z_header=search_go&lang=en&site=us&keywords=NHD-0216K1Z-FS(RGB)-FBW-REV1-ND&x=0&y=0


Duracell Instant USB Charger with Lithium ion battery / includes universal cable with USB and mini USB $26 (paid too much!)


http://www.amazon.com/gp/product/B002FU6KF2/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=workingsilico-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B002FU6KF2



I will post the circuit and code in a later post, as soon as i clean up some LCD display formatting issues

GPS to do list

Tracked some car trips today, worked awesome.  It showed my position to within a few feet.

Some things on my to do list for the GPS:
-More frequent GPS updates.  At highway speed the waypoints are too far apart and it looks like I'm going off the road.  I have a lot of delays, like 5sec, to make the LCD readable.  I only have a 2x8 LCD on the unit, and i have to switch from lat/lon, speed/course, time/altitude.  That loop takes 5 seconds and meanwhile the GPS is waiting. I think i will add code to log more often

-I think i need a push switch to scroll between the three possible readouts.  The constantly switching display is kinda hard to monitor anyway.

-Put the speed column ahead of altitiude in the log file.  gpsvisualizer wants to color my route for altitude, not for speed.

GPS battery and Monoprice.com for cable

I used this rechargeable battery to power the Arduino GPS.

Duracell Instant USB Charger with Lithium ion battery / includes universal cable with USB and mini USB

It worked well, i haven't seen how long it lasts, but it has a USB plug that can connect to the Arduino and it charges from a PC USB or wall charger.  It was a bit expensive but it seemed like such a nice solution for portable power, rather than burning through 9V batteries.


Monoprice.com is a crazy cheap place to buy cables.  I needed a short USB cable to connect the Arduino to the rechargeable battery with a USB plug.  The USB cables at best buy were $25.00 and up!  At Target they were $15.  At monoprice the cables were  $0.84 plus $2.24 to ship.  I got a cord to charge my cell phone while I was at it.  All for $4.24.

Monday, September 20, 2010

Arduino GPS - data logger added

Woot!

I got the data logger shield from adafruit.  A nice kit
http://www.adafruit.com/index.php?main_page=product_info&cPath=17_21&products_id=243
It was 19.50, which if you count the parts and proto board, i think it is a good deal.  It would have cost me more to buy separately and it looks professional and fits right on top of the Arduino.

The sdfat library i mentioned in an earlier post worked first try after i soldered up the board.  I was able to run their data logging example first try on an SD card.  Pop it in the computer and the file is there.  Totally awesome.

I pasted my gps code from the ebay SIRF3 tinygps library (in an earlier post) together with the sdfat data logger code.   I made it only record data when it had a GPS fix that was >0ms and <2000ms to filter out no signal cases that were filling the file with zeros.   A little messing with the header that gps visualizer wants on top the file.  http://www.gpsvisualizer.com  and i was good to go.  Sitting at the kitchen table it logged data just fine.

Tossed on a small LCD 8x2 display i got off EBAY so i could tell what it was doing.  Between the SD card, GPS and LCD the pins are maxed out on the Arduino.

I used a USB cigarette lighter plug and a USB cable and took it in the car with me.  I drove on some errands.  The GPS showed all zeros, no signal.  boo!!!!!   Held it up through the sunroof.  Still NADA.  Frustration mounted.    Tried again the next day driving to work.  Nothing.  AAAAARRRGH.  Is the GPS signal that weak?

Brought it back inside, plugged the USB into my computer.  Bingo! signal!  Working great again.  Walked out to the car.. still working fine.  Sat in the car with the Arduino and GPS powered from the laptop USB on battery power.  Works great.  Here is a picture of my walk to the car, from gps visualizer.

So the problem was the power, either the current or the voltage supplied by the cheapo USB cigarette plug is too low for the GPS to get signal.  OK tomorrow we run with the 9V adapter and my inverter!  Banzai!

Sunday, September 12, 2010

Arduino GPS working too!

Ordered a GPS module off Ebay for $30 plus shipping
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=250686123796&ssPageName=STRK:MEWAX:IT#ht_500wt_896

It came with a tutorial wiring diagram.

http://www.fileden.com/files/2010/8/21/2948335/GPS_Arduino_Tutorial.zip

I hooked it up to the Arduino, and strapped on an LCD.  Loaded the tutorial.   After about 15 secs of 0.000 0.000 data started pouring out.  Wow!
That was easy.  Less than an hour.

SInce then i've gone through the software and have the LCD outputing time , data, speed, course, as well as the GPS data.
Now what??  I think I will make a GPS logger.  Something like a teen tracker, that writes the data to an SD card.  The onboard EEPROM is 512 bytes, too small to do anything with.

I decided to order a data logging shield from adafruit for 19.50.
A protoboard and connectors would cost me that much, and it comes with an SD card slot.

The SD card writer i made earlier is a bit of a kluge, and the one on adafruit seems like a good deal.  I got my sd card writer to work though the SPI interface, but only the arduino can read it.  I want to be able to take the files to a PC.

The sdfat libraries look like they will do the trick to log the data.

I found a cool website that will plot the gps data to a map, showing the whole route.