Teensy GPS Logger

Update 28/08/15, New version more light:

*The last and final design, the Teensy and GPS is directly powered from 3.7v li-on batt, 20 hours 5hz logging, 39g heights with IP4 box.

Update 23/07/15, New firmware, feature added:

*Logging data only when the speed is above 3 km/h
*Using var usb_configuration; to detect and enable charging automatically when the board is plugged on a computer (only pc, not Ac adapter).

Update 12/02/15, I have rewrite the sketch:

– The sketch is more clear, light and compact, 3.76ko from 5.07ko comparing old sketch.
– Use TinyGPS lib, so you can select what we want to log.
– Create a .CSV file directly, you can use import function from GoogleEarth PRO (good news, Google has released it for FREE right now).

CSV_exemple

The goal
In the past two years, i have released two version of GPS logger, with a lot of default like, poor autonomy, need to take off the sdcard to get the log, no function to upgrade the code easily, by the way, i have redesigned a new version with a lot of news feature, see bellow.

– Better autonomy.
– Be lightweight and wearable.
– Be rechargeable easily.
– Got log directly from USB.
– Upgrade code via IDE Arduino through USB.
– Future options implemented for improvement.
– Water Resistant IP4.

teenlogger

teenlogger2


Hardware
µC Section
The hardware run around a Teensy 2 this very small board run with a ATMEGA32U4 8bit AVR 16 MHz Processor, 25 I/O.

GPS Section
The GPS NMEA sentences comes from a PA6B module, i choose this because he is very sensitive and small, better than EM406. The MTK Command Packet can be found here.

Issue encountered: On the first board prototyp i have mounted a PA6B without problem, when i powered up the pcb for the first time the GPS try to lock to satellite, in this case the 3d fix output should continuously output one-second high-level with one-second low-level signal, in theorical, regarding the data sheet, when the GPS is locked on the satellite, the output pin should continuously output low-level signal, but in my case, the output give me a high level signal, probably du to the firmware, so i decided to re-upgrade with the default factory firmware, the software, firmware, and guideline are available here. Be careful, the factory firmware set the baud rate to 9600bps, not 4800.

Batteries backup
To ensure fast hot start, the batteries pin is connected directly to the li-ion batt, the receiver has valid time, position, almanac, and ephemeris data, enabling a rapid acquisition of satellite signals.The voltage should be kept between 2.0V~4.3V. So, its OK.

Power Section
The power come from a BlackBerry batteries (1100mha in this case), a charge pump, DC/DC converter (LT1302) give 5v/600ma from the 3,7v batt, available in SOIC-8 package, it’s a very powerful converter and can start as low as 2v. Two LP2981 give two separate 3,3v power line for the GPS and Teensy.

Charging the Batt
Power charging is assumed via a LTC4054-4.2 a standalone Li-Ion Battery Charger with Thermal Regulation in ThinSOT package, the charging current is set with a simple resistor, i found 1,5k good value for around 1h30 of charge, the charge control is drive thought a N Channel MOSFET (2n7002) the signal come from the Teensy, just plug the USB cable and push the button to turn the PIN 17 High. Another option,  is play with a “usb_configured” variable inside Teensy’s USB code which indicates if the PC has configured the USB device. Accessing that variable is the best way to know if a PC is connected to Teensy. But its not implemented yet.

The code
Original code come from Adafruit, and it run on Teensy with some majors modification.

I  have removed unused libraries like avr/sleep.h, and GPSconfig.h header, the SoftwareSerial.h, NewSoftSerial.h libraries was replaced by <AltSoftSerial.h> for better performance. More informations are available in the commented sketch.

Loading the code

  • First, download and install Teensyduino software and libraries, complete instruction are here.
  • Download and unpack AltSoftSerial Library to /libraries directories.
  • Run Arduino 1.0 and load the code.
  • Select Teensy 2.0 in the tool menu.

Image3

  •  Select USB Type Disk SD Card + Keyboard

Image2

  • Finnaly, select CPU Speed to 8Mhz

Image3

Option
A “N Channel MOSFET” (2n7002) is connected to the Enable pin of GPS, in case of you need to drive the GPS. In normal operation keep Enable Pin floated or connected to Vcc.

Power saving method
Since is a embedded project, for better batteries life, we need to run with a maximum save of power, some good way:

– Run Teensy and GPS with 3,3v power supply.
– Lowering the clock speed at 8Mhz.
– Write GPS data only every 5 seconds, in hiking we no need very accuracy in fact.
– The data is stored only when the GPS give valid fix.
– Disabling the “Analog to Digital Converter”.

With this power measure, we can switch from 27.3 mA power consumption to only 10.6 mA
The total power of TeenLogger is around 45ma with GPS satellite tracking, and give around 15/17 hours of complete logging.

The data
The data is logged into a txt file, (GPSLOG0x.txt) you can easily convert this file directly into a KML format with, NMEA to KMZ file converter, or use gpsvisualizer.com and everytrail.com

Design
teenlogger

 

shem

 

teenlogger

Resources
Global Positioning System
NMEA sentence information

Teensy Board
Arduino sketch v2
Arduino Sketch (not recommended)

TeenLogger Shematic (PROTEUS File)
TeenLogger Layout (PROTEUS File)

GPS PA6B Datasheet
LT1302 Datasheet
LTC4054 Datasheet