GPS data logging with CAN-Do

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

garygid

Well-known member
Joined
Apr 21, 2010
Messages
12,469
Location
Laguna Hills, Orange Co, CA
I have added a 5th logging channel to CAN-Do: a GPS-Data channel.

One can buy an inexpensive USB-connected GPS receiver (approximately
$25 to $85) which typically presents a virtual Comm Port when
attached to a PC's USB port.

Totally self-contained, usually "waterproof", powered by the USP's 5v,
including a GPS antenna, and often with a magnetic mount,
this small device (with the USB wire coming out of it) is often
called a GPS "mouse" (not for normal mouse-type input).

These devices typically produce a stream of NMEA-standard text "sentences"
that contain Latitude, Longitude, Altitude, GMT Date/Time, etc.

CAN-Do reads these messages and extracts data from them,
adding some GPS ("FEx" MsgID) pseudo-messages to the CAN-Log.

Usually the GPS recalculates its position information once a second,
but some units do 2, 4, 5, or even 10 recalculations each second.

With this new feature, CAN-Do could capture just a GPS tracking
log, without any CAN-Messages at all.

I will keep you posted on the progress.
Cheers, Gary
 
Suitable GPS "mouse":

Tested:
1. GlobalSat BU-353 waterproof GPS receiver (USB "mouse"):
Uses the SIRF Star III GPS chipset, with Prolific USB chip.
About $29 including shipping from http://www.Amazon.com" onclick="window.open(this.href);return false;
Magnetic mount, 1 Hz update, 4800 baud (8,n,1 and no-flow)
Worked without special drivers on my 32-bit Vista laptop.
http://www.amazon.com/gp/product/B000PKX2KA/ref=oh_details_o02_s00_i01?ie=UTF8&psc=1" onclick="window.open(this.href);return false;

Suggested by Others as Good:
1. Byonics (uses SIRF Star III) Serial-Port GPS + their GPS-USB Adapter
(the Adapter uses the Prolific USB chip), about $70 + $20
See link in TomT post below.

Others:
 
GPS Logging in CAN-Do:

1. Ordered a BU-353 GPS "mouse" from Amazon
2. Received BU-353, used Putty" (as a "dumb terminal")
to see 4800 baud NMEA messages ("sentences").
3. Added a GPS test to v1.6.4 of CAN-Do, showing the NMEA messages, and extracting the Lat, Lon, Alt, and GMT data fields.
4. Added Logging (to memory) of user-selected GPS sentence fields.

In test:
1. Defined GPS pseudo-message(s), one for Lat and Lon (4 bytes each), and others for Altitude, and GPS Date/Time. Additional messages will eventually Log "other" GPS data.
2. I Read and Display the incoming NMEA messages, and display Lat, Lon, Alt, and GMT - DONE in v164
3. Extract data while logging and insert pseudo messages - done in v1.6.7
4. Display these new messages - partially done in v1.6.7
5. Output the GPS data to some standard "tracking" format.
6. Plot 3-byte and 4-byte Recipes.
7. Export GPS fields to ".csv" files.
 
Problems:

1. Some GPS units do not have "nicely compatible" UPS virtual Comm implementations:

a) So far, the GlobalSat BU-353 seems to work well (at its default 4800 baud).

2. The drivers for some GPS units do not "play"
well with some OS systems, or GPS software.

a) I did not install the driver from the BU-353's CD, but
it still seems to work well enough on my Vista laptop.

3. Flakey Construction:

a) So far I have gently tested two BU-353 units, and both seem OK.
 
I have used a couple of GlobalSat units for the past few years. The SIRF III has good sensitivity and the NMEA output stream can be imported into Google Earth for a combined elevation and velocity chart. GlobalSat has a USB model and provides drivers for the prolific chip serial interface. For the LEAF, I have been using a self contained logger - TripMate852 and remove the microSD card or attach the Tripmate to a computer with a USB to download the NEMA files and view the information with Google Earth. The problem is the AAA battery life is about 10 hours and it's easy to forget to turn the logger off. The GlobalSat units log data once per second while the TripMate852 can output a data cycle every 200msec.

I was hoping the GPS information is available on the CAN buss from the NAV unit which would provide a synchronized GPS with the LEAF data stream and would eliminate the need for another GPS unit. If you like the Arduino then checkout http://arduiniana.org/libraries/tinygps/" onclick="window.open(this.href);return false;
 
Thanks, great info.
I will have a lot to try after I get taxes done.

I have Arduino board and shields, but have not yet had the time to use them.

After Taxes, while building and testing an SOC-Meter, I will add simple GPS NMEA reading to CAN-Do. Later, add the Fix-Data to the CAN-Log so that the data is synchronized with the CAN messages, within about a second.
 
Received the $29 GlobalSat BU-353 GPS "mouse" from Amazon
and programmed CAN-Do (v1.6.4) to capture the NMEA messages and
extract the Lat, Lon, Alt, and GMT values.

Within a week, I expect to be Logging GPS-tracks,
with or without the LEAF's CAN data.

Anybody interested in a 3D track?

Suggestions for a "most universal" GPS-track data format
that can be imported almost anywhere?
 
I've used a number of these for APRS and other applications and they are bullet proof: http://www.byonics.com/tinytrak/gps.php" onclick="window.open(this.href);return false;
 
Thanks Tom,

Partitularly interesting is the GPS chipset version that will operate up to 84,000 meters (about 50 miles) altitude, for use on high-altitude balloons. However, for use with a USB port, these units require an adapter (GUA = GPS USB Adapter).

The BU-353 GPS "mouse" (puck-with-a-tail) that I am using for testing connects directly to a USB port, getting power from the USB port.
 
The NMEA format is widely recognized and there is GPSBabel for conversions. I prefer using Google Earth for it's altitude 'locking' to the surface rather than depending on the altitude data in the GPS stream that seems to have more range than the long / lat data. Google earth will import NMEA format and you can create velocity and altitude overlays from the GPS data logs.
 
Is the NMEA $GPGGA message sufficient?

Can the fields, other than the 7 GMT (1), Lat (2), Lon (2), Alt (2) fields, be blank, or are they used?

Is the "checksum" required/used/ignored?
 
NMEA sentence checksum:

The "*HH" (asterisk and two Ascii-Hex characters) at the end of
the NMEA sentence are not required, but they are typically there.

The HH "checksum" (if present) covers all the characters between the leading "$" and the "*". It is an Exclusive-OR (XOR) of the included characters.

For the moment I am ignoring the checksum, but later I will check it,
perhaps even require it, with an option to not require it.
 
My current GPS-Logging:

The Latitude and Longitude are each 4-byte values, logged
in the pseudo-message ID "FE0" from RMC (and FE8 from GSA).

The +/- 180 degree 60.XXXX minute Longitude value is scaled
by 10000 to get a long (4-byte) integer value (+/- DDDMMXXXX),
plus for East and minus for West.

Similarly, the +/- 90 degree 60.XXXX minute Latitude, scaled
by 10000 becomes +/- DDMMXXXX (plus for North, minus for South)
value in the pseudo-message's D5 through D8 bytes.

I still need to expand the "Recipe" definition to be able to handle these
multi-byte values.

For Latitude, high-order data byte D1 (shifted 24), as a "2s-comp"
signed integer, to data byte D4 (shifted 0), all scaled by 0.0001
should give the original +/- DDDMM.XXXX value.

Similarly, Latitude would be in data bytes D5 through D8.

The pseudo-message FE9 holds Altitude, number of satellites
used, relative accuracy number, ... and ??


The FE2 message holds the GPS-provided Date and Time (GMT),
as DDMMYY and HHMMSS.

Future:
Message FE3 will hold the current Velocity (as NNN.NN kph) and
Heading (0.0 to 360.0 degrees), and ... ???
 
I updated the previous post to reflect progress.

CAN-Do v1.6.7 will now log user-selected GPS data, with the
default being Latitude and Longitude from the RMC "sentence".

However, one might prefer the Lat, Lon, and Altitude from the GSA sentence.

Now, I need to save the GPS-info to a ".gpc" Log file, and
add exporting of the GPS data to a TRACK (.txt) file.

Then, I need to read the ".gpc" log files, and write/read the GPS data
when it is combined with other data in ".alc" (all-channel) Log files.

I will make expanded (3 and 4-byte) Recipe entries. Then use
them for plotting and for exporting to ".csv" files ...
but this still needs to be implemented.

I would like to add plotting one Recipe on the X-axis, and another on the Y-axis.

I want to display a "polar" (overhead) plot of the Satellites in view,
and a bar chart of their signal "strengths" (or perhaps SNR).

Overall, good progress, almost to a first "Beta" functional version.

However, still a lot of needed (and "want-to-do") features to add.
 
The latest posted version of CAN-Do is 1.7.2
It seems to work well with GPS logging.

When logging the CAR-CAN while driving, some characters
in that data stream seem to be getting lost.

I am investigating.
 
CAN-Do version 1.7.6 has been posted and seems to work well,
logging EV-CAN and CAR-CAN, with GPS or without.
Over 1,000,000 messages with no errors that I could detect.

To do this, I made changes to the program, and also changed some
of the parameters in the driver for the 4-port RS232-to-USB adapter.

I make the Block Size 64 bytes instead of 4096 and
the Latency Timer 4 ms instead of 16 ms.

I have not yet tried the "latest" driver (2.8.24.0) for this device on Vista.
I have been using 2.8.14.0 so that might contribute to the problems I observed.

More after I get a chance to experiment more.
 
Now CAN-Do can export the logged GPS data to NEMA sentences.

Somebody still needs to test this NEMA (text) output, using it as
input to some other program to make sure I did the export correctly.
 
Back
Top