Archive for the ‘ Biking ’ Category

Thank you Garmin!

I bought a brand new Edge 500 off of eBay last May.  It has been great, except the lap / reset button has been getting progressively harder and harder to press.  I’d press it and it wouldn’t register which sucked because in order to record a ride so that its data can be exported you have to press and hold the button for 3 seconds.  It finally got to the point where I was unable to record my last ride last week.

I was prepared to pay $89 in order to RMA my device because even if I wasn’t a few months past the end of the warranty period, since I bought it off eBay the warranty was never valid.  I called the RMA line and explained my problem.  The operator was nice enough to extend the warranty to me!  All I had to do was mail in my broken Edge and they sent me a refurbished model that is as good as a new unit.  Thanks Garmin!

Resetting the Edge 500’s battery meter

If your Edge 500’s battery meter gets stuck at 100% just disable the auto shutoff feature and let the battery drain. The next time you charge it up the battery meter will reflect the actual amount of charge you have remaining.

Chernoff Faces of Bike Rides

Chernoff faces of 4 bike rides

Chernoff faces from 4 bike rides

I plugged some of the fit file data that I stored in a Postgres database into R to generate the image above.  Two R libraries, RpostgreSQL to connect to Postgres, and aplpack, to generate the faces were used.  Once the libraries were loaded the following R command pulls the data out of Postgres:

rs <- dbSendQuery(con, "
SELECT ride_date
, ST_Length(ST_Transform(ST_Makeline(the_geom ORDER BY ride_time),26916)) As length
, date_part('hour', max(ride_time))-date_part('hour', min(ride_time)) As ridetime
, avg(temperature) As temp, avg(speed) As avg_speed
, avg(altitude) As alt, max(altitude)-min(altitude) As alt_diff
, avg(cadence) As rpm 
FROM ride GROUP BY ride_date ORDER BY ride_date

Then fetch the data from the record set with:

rides<-fetch(rs, n=-1)

And finally plot the faces with:

faces(rides[,2:8], face.type=0, labels=rides$ride_date)

The faces function draws the faces based on the order of the variables.  The features are modified in this order:

height of face 
width of face 
structure of face 
height of mouth 
width of mouth 
height of eyes 
width of eyes 
height of hair 
width of hair 
style of hair 
height of nose 
width of nose 
width of ear 
height of ear

If you don’t have enough variables to fill this list it will wrap around and start again from the top.  For more configuration options use ?faces after you load the aplpack.

There are two small problems with the data, and they both caused by stopping the timer on your bike computer, then restarting at a later time and place.   The time ridden is calculated here by simply subtracting the minimum time from the maximum.  If you rode for 3 hours and took an hour break the query would return a time of 4 hours.  Similarly, if you ride for a mile, hop in a truck and drive 10, then ride for another mile you’d get a result of 12 miles.  There’s a way to work around this, I just haven’t figured it out yet.  I suppose the best solution is to harden up and not take breaks.

The data is stored as points in the database, to get the length ST_Makeline “connects the dots” from point to point.  An awesome feature of Postgres 9.0+ is the Order By in the middle an aggregate function.  It helped in this case because the first ride graphed doubled up and crossed over itself several times.  This lead to the query planner making some interesting decisions on where the line should go.  Forcing the process to follow the points in order the line followed my route perfectly.

Getting .fit file data into PostGIS

GPSBabel released an update (1.4.4) on Labor Day.  This update fixed GPSBabel’s FIT file compatibility.  Now FIT files created on Garmin Edge and other devices can be converted into formats that can be imported into PostGIS.  Follow along after the jump to see how.

Continue reading

Get data off of an Edge 500 with Linux

If you want to use a site like Strava or Ride With GPS to track your rides you’ll need to upload fit files from your Edge.  Luckily it is a quick and easy to do so.  First use `sudo blkid` to get the volume label so you can make an entry in /etc/fstab to easily mount the device. You’ll see something like this:

/dev/sdc: SEC_TYPE="msdos" LABEL="GARMIN" UUID="BF82-4CA9" TYPE="vfat"

You’ll want to use either the label or UUID values to point to your Garmin device, especially if you have several USB drives.  If you use /dev/sdc the next time you plug in your Edge it might be /dev/sdb or /dev/sdd instead.  If your only Garmin device is your Edge 500 go ahead and use the label, if you have more than one the unique ID in the UUID field will work best for you.  Below is the entry I made to my /etc/fstab file.

LABEL="GARMIN" /mnt/garmin vfat noauto,user 0 0

You can put the mount point, in my case /mnt/garmin, where ever you like. You’ll need root permissions to create a directory in /mnt, but the options in the above fstab entry will give ordinary users permission to mount the device there and read-write to the files on the device. The vfat option tells your computer the device is using a fat32 formatted filesystem, noauto prevents the device from being mounted automatically, and the user option was covered above. Since noauto is being used to mount the Garmin you have to use

mount /mnt/garmin

to be able to see the files stored onboard. When you are done use

umount /mnt/garmin

so that you don’t corrupt any files when you unplug the USB cable.

Once you’ve mounted your Edge navigate to Garmin/Activities.  In this directory you’ll find .fit files for each of your rides.  You can upload them directly from here or copy or move them to your hard drive for safe keeping.  You’ll want to clear the Activities folder from time to time, the Edge doesn’t have much storage space.

I almost killed my new Edge 500

Quick summary:  If the new Edge 500 firmware update (3.0) bricked your device press and hold the Page/Menu button as you plug the USB cable into your computer.  This will start the Edge in mass storage mode and you’ll be able to explore the file system and delete the firmware update file.  Now on to the whole nerdy story!

Continue reading