GPS-logging my bike rides

Five weeks ago I started logging my road bike rides, runs and mountain hikes using the GPS in my Google Nexus S Android phone. I use the iMapMyRide app which requires Android 2.1 and later (of course there’s also an iPhone version).

Start the app, a few taps on the screen and it starts recording. You can pause the recording any time, say if you stop for food or rest. When you’re done you can easily upload the complete route with GPS coordinates and timing to the MapMyRIDE.com website. Besides bike rides you can also use the app for hiking, running or walking.

As it records it displays basic map information, so it can be used for simple navigation too, but most of the time I relied on Google Maps for that.

Afterwards you can view the workout on your PC. It will show altitudes along the route, including total gain. It shows average speeds for each km of progress. It calculates how many kcals you used based on the route, your weight and your age.

A calendar view shows all days on which you exercised, with distances for each workout, weekly totals and monthly totals. This can be a powerful tool to keep up a certain level of exercise on a regular basis.

Battery usage

As with many mobile applications, battery life is of concern to users. So far my longest recorded hike was 5 1/2 hours and my longest bike ride was 4 1/2 hours. I have not run out of power yet, but I’ve had the battery low warning pop up on occasion.

There are a few things you can do to optimize power usage. I make sure to disable WiFi and Bluetooth to minimize power usage. If I am in areas without mobile data coverage, such as high on a mountain I switch the phone into “airplane mode”, which will still let it receive GPS data but it won’t download map data (which it can’t anyway without a nearby cell phone tower). Disabling these wireless connections prevents the phone from wasting energy on trying to reconnect.

It makes a big difference how much you use the LCD screen. If you often turn it on to consult the map for a new or unknown route that will eat battery life.

In order not to have to worry too much about that and to be able to record longer and further rides and hikes, I got myself a cheap external Li-ion battery on Amazon Japan, into which I can plug the USB cable of my Android phone for extra power. I paid JPY 2,380 (about $30) including shipping. Its capacity is listed as 5000 mAh and it has two USB output ports, plus one mini-USB input port for recharging. It comes with a USB cable for charging, a short spiral USB output cable and 10 adapters to connect it to different phone models (including the iPhone and iPod). Because of the standard USB ports you can use any existing USB cable that works with your phone. It’s like running your smartphone off power from your computer.

The device is about the weight and size of my phone. It came charged to about 60%. It should take a couple of hours to fully recharge it from empty.

If fully charged it should theoretically provide three complete charges for my mobile phone, which has a 1500 mAh battery inside, thereby quadrupling the length of rides I can record. Most likely, I will run out of energy long before my battery does 🙂

My longest distances with MapMyRIDE so far:

  • Bike ride: 71 km, 560 m elevation gain
  • Mountain hike: 14 km, 1020 m elevation gain
  • Run: 10 km in Tokyo

A few rough edges

While the iMapMyRIDE+ app feels fairly solid, it will need fixes for a few problems.

The major issue for me is that the app and the website don’t see eye to eye on time zones. For example, if I record a ride at 17:00 (5pm) to 18:00 (6pm) on a Sunday, the recorded workout title will include the correct time. However, if I view that workout on the computer’s web browser, it is shown on the calendar as having been recorded on the following day (Monday). If I check the details, the start and end times are listed as 8am (08:00) and 9am (09:00): Wrong day and off by 9 hours.

Probably not by coincidence my time zone (Japan Standard Time) is 9 hours ahead of UTC. It’s like the app sends up the start and end time in UTC but the website thinks the data is local time. Yet for determining the date it seems to add those 9 hours again, which takes it beyond midnight and Sunday gets turned into Monday.

I can manually correct every single workout from the website, which also fixes that date on the calendar, but then the app displays the wrong time, which I am prepared to simply ignore.

When I enter my height on the website and then view my details on the app, I am 2 cm shorter than I entered, perhaps as the result of my height having been converted from metric to imperial and back to metric with numeric truncation.

I wish the site would support 24 hour clocks, not just AM/PM. I also wish the site would let the metric size to be entered as cm, not just m and cm separately (probably a hangover from code written for feet and inches).

Note to the app developers out there: The world is much bigger than the US and most of it is metric.

UPDATE 2011-12-13:

I have used the Li-ion battery on two weekend bike rides now. One was 93 km, the other 101 km in length. In both cases I first used the phone normally until the remaining charge level was heading towards 20% (after maybe 4 hours), then I hooked it up to the 5000 mAh battery and continued the ride. The longer of the two rides was about 8 hours, including lunch and other breaks. At the end of the 101 km ride the phone battery was back up to 75% charged, while the external battery was down to 1 of 5 LEDs, i.e. close to empty.

I wasn’t as careful to conserve power with the external battery hooked up. My phone is configured to not go into sleep mode while hooked up to a USB cable, unless I manually push the power button. That’s because I also use it for Android application development, where it’s controlled from a PC via the cable. I should really turn that developer mode off on rides to have the screen blank after a minute as usual even when getting external power. Total capacity with the external battery probably at least 10 or 11 hours, more if I put the phone into “airplane mode”, which disables map updates and hence navigation.

My headlight currently consists of a twin white LED light using a pair of CR2032 batteries that I need to replace every now and then. It’s not very bright, especially where there are no street lights. Probably next year I’ll upgrade the front wheel using a Shimano DH-3N72 dynamo hub,

which can provide up to 3W of power while adding very little drag. A 6V AC to USB adapter will allow me to power USB devices like my phone and the headlights from this without ever having to buy disposable batteries or connecting anything to a mains charger.

UPDATE 2012-01-02:

I have had the front wheel of my Bike Friday rebuilt with a Shimano DH-3N80 dynamo hub. The old 105 hub is now a spare while the rim with tube and tyre were reused. Here is the bike in our entrance hall:

Closeup view of the hub with AC power contacts:

I purchased a USB power adapter made by Kuhn Elektronik GmbH in Germany. It weighs 40 g and measures 8 cm by 2.5 cm. It provides a standard USB-A socket which fits standard USB cables such as the one that came with my Google Nexus S:

USB power adapter with Google Nexus S:

UPDATE 2012-03-14:

At the end of January I started using Strava for tracking rides, in addition to MapMyRides (MMR). I stopped using the MMR app because there is no way in MMR to export GPX files with time stamps, so you can not track your speed or performance on any sites besides MMR. They lock in your data. Instead I either record with Strava on my Android 4 Nexus S or with Endomondo on my Android 1.6 Google Ion. That way I can generate GPX files that will upload to Strava, Endomondo, MapMyRide or just about any other site. The automatic competition feature of Strava is superb. MMR’s best features are its calendar view with weekly and monthly statistics and its mapping feature for planning rides. If those were merged with what Strava can do, it would be a terrific GPS cycling app and site.

Minoura iH-100-S phone holder for Nexus S

In my blog post about my bike ride up Mt Fuji Subaru line I mentioned the Minoura iH-100-S phone holder that I use with my Google Nexus S Android smartphone, which I use for Google Maps and the iMapMyRide application to track my cycling routes.

In the local bike shop I was was considering either the Minoura or the Topeak Phone Drybag, which is designed specifically for the iPhone, but also is big enough to hold the Nexus S. It offers rain protection, while with the Minoura iH-100-S the phone is exposed.

I didn’t go for the Topeak because it looked too iPhone-specific: The transparent cover extends to the home button in the bottom centre, but my Nexus S has four buttons side by side (Back, Menu, Search, Home), which would have been obscured.

My solution for rain is simple: If it looks rainy, I’ll wrap the phone in cellophane (for kitchen use, the local leading brand in Japan is Saran Wrap), which does the job. I also keep a small transparent plastic in my backpack, for emergencies.

The Minoura works well and grips the phone firmly if used properly. Make sure the phone firmly touches all three support points: the clamps on the left and right and the corner hook. I have yet to lose it, but the fact that the two clamps at the left and right snap apart if the release lever is pulled did make me a bit nervous. I always visualized this happening unintentionally, say if the release mechanism wears out or becomes brittle with UV exposure and breaks one day.

My peace of mind solution for that is a small rubber band which I keep attached to the holder. I twist it around once to give it more tension and then wrap it around the two clamps, which keep it away from the touchscreen, but it provides enough friction and tension that even when I pull the release lever there’s no way the phone would fly away.

Auto Unlock application

Another issue with using the phone for navigation was the Android screen lock. When the screen blanks due to inactivity, I need to push the power button to turn the screen back on, which is fine, but then I also need to slide a dot across the screen to unlock the desktop. If find that too distracting, because I prefer to keep my eyes on the road as much as possible. I found an application in the Android market called “Auto Unlock”, which does away with the need for the sliding move – most of the time. The trial version can be used for 5 days for free. The paid version is $1.29.

The results with Auto Unlock were a bit uneven. The application needs to be manually restarted after the phone is powered down, a minor problem. When it’s active, sometimes I still needed the slide, other times I didn’t. I’m not sure what made the difference. It’s very helpful as long as it works.

UPDATE (2011-10-15:

After the trial edition of “Auto Unlock” expired I switched to another app called “No Lock”. I am happy to say that No Lock works more reliably, though it has one minor drawback: unlike Auto Unlock it does not use the proximity sensor to still require an unlock swipe if it’s in your pocket. If you accidentally push the power button while the mobile is in your pocket, that may unlock it already. “Pocket-dialling” of calls is a possibility. For my use with the bicycle holder that is not a problem and it’s easy to switch between “No Lock” and “Lock” mode in the app.

Good bye, Dennis Ritchie!

Back in the early 1980s I learnt programming in C by reading “Kernighan and Ritchie”, as everyone around me called this book then: “The C programming language” by Brian Kernighan and Dennis Ritchie.

It is no exaggeration to say that C and its derivatives are to computers what hydrogen is to the universe.

Dennis Ritchie, who passed away today at the age of 70, was a co-creator of both the C programming language and of the Unix operating system, after which open source Linux is modelled today. Mac OS X and iOS are direct descendants of Unix (NetBSD), while Android, which runs on millions of smart phones, is based on Linux. Virtually every operating system that matters these days (including all versions of Microsoft Windows) is written in C or C++ or another C-derived language.

Dennis Ritchie may not have become as much of a household name as Steve Jobs, but the software he created probably brought about much more fundamental changes than anything Steve Jobs did, and in fact most of what Jobs created would have been unthinkable without either C or Unix.

See also:

My new Google Nexus S on Softbank Mobile

I just got myself a Google Nexus S / Samsung Nexus S with Android 2.3.6 (Gingerbread). Several of the applications I had wanted to run on my previous smartphone (Google Ion a.k.a. HTC Magic, Android 1.6) were only available for Android 2.1 or later. I would have had to reflash the phone with something like CyanoGenMod to get a newer version, since Google did not make any updates available for the old hardware.

The new phone’s screen is great. The WXVGA resolution of 800×480 (“Wide eXtended VGA”) provides much more usable space than the HVGA 480×320 (“Half size VGA”) of the Google Ion or the iPhone 3GS for that matter, though it is a little less than the 960×480 of the current iPhone 4. Talking of which, the Samsung is only a few millimetres wider and taller but also a little lighter than the Apple product.

There are several versions of the Nexus S. Some have the AMOLED screen, others the S-LCD. I picked the AMOLED version (GT-I9020A) which was about $15 more expensive but has better image quality than the S-LCD version (GT-I9023).

Setup was very easy, once I figured out how to pull off the back cover to get access to the battery and SIM slots (there was no paper owner’s manual, which instead you have to download as a PDF).

I simply moved the Softbank Mobile SIM from my HTC to my Samsung, put back the battery and switched it on. Voila, it was working on the Softbank network, and I was immediately able to send and receive SMS, unlike the HTC where I manually had to enter parameters for an access point that I had to Google in a thread in some online forum. The downside of the effort to make things work smoothly for most customers was that using a Softbank SIM also changes the language to Japanese. Sure, most Softbank customers are native Japanese-speakers and they will be helped by switching language, it wasn’t what I wanted. Luckily I could manually switch it back.

The GPS of the Samsung is much better than in the HTC, which could not get a location if I was inside my house and wanted to get directions before heading out for a train or bike ride. The Nexus GPS gets the position quickly and much more accurately. With the Ion, when I was manoeuvring the charming back streets of Shimokitazawa (which consists mostly of two story houses, no big skyscrapers to block satellites), not only might it put me two blocks away from where I was, it would not even get the directions right when I was trying to figure out which way was North and South. It worked OK only with lots of open space, such as when cycling along big roads and in the countryside.

One very neat touch is that the Gallery application where you view your camera shots is integrated with Google Picasa, which I use for hosting all pictures from my main camera, a Canon S95. So it doesn’t matter if I’ve taken a shot with the Samsung or with the Canon, it’s always there to show someone when I want to.

I’m still discovering new features and will update the blog as I go along.

More information:

UPDATE 2011-09-10:

I did still have to manually set up an APN for Softbank after all, because with the defaults, even though I could send and receive phone calls and SMS, I could not access the web or use Gmail or Google Maps unless I was on a WLAN. Here is what is required:

Go to: Settings > Wireless & networks > Mobile networks > Access Point names. The initial list was empty. Push the menu button and select New APN. Set the following parameters (leave all settings not mentioned at their initial value):

Name:Open Softbank
APN: open.softbank.ne.jp
Port: 8080
Username:opensoftbank
Password:ebMNuX1FIHg9d3DA
MCC: 440
MNC: 20
APN type: default

After that I could step outside and walk to the end of the road (out of reach of my WLAN) and still browse the web or use Google Maps. The “3G” marker will illuminate in the status bar at the top. Make sure you have the Smartphone data plan from Softbank to limit your data charges, and to have data roaming disabled so other provider networks don’t get used for (non-flat rate) data if you’re out of reach of Softbank.

Nokia’s suicidal alliance with Microsoft

Much has been written about Nokia’s alliance with Microsoft announced last month. I can understand how Nokia CEO Stephen Elop, an ex-Microsoft employee who until recently was its 7th biggest shareholder, would have made this decision that benefited his former employer, but why did Nokia’s board of directors ever agree to this move?

Under attack from the iPhone and Android, Nokia had to take action, but in my opinion this move is almost the worst possible choice. It will be an unmitigated disaster for Nokia. I am not just thinking of countless development engineers who will undoubtedly be laid off now that Nokia will be buying in Windows Phone 7 (WP7) instead of developing operating system software in-house. No, it’s also a major strategic error for the company as a whole and I’ll explain why.

Nokia used to have a great brand name with consumers. Now Symbian phones have “OBSOLETE!” stamped all over them, but that’s all Nokia will have to sell for at least another year. Who is going to buy those obsolete phones, other than at rock-bottom prices? It will be ugly for Nokia’s cash flow. How on earth does Nokia believe it can still sell 150 million Symbian phones between now and their WP7 models replacing them? They’re dead in the water.

I can’t see that Intel would be pleased about what that all means for their cooperation on MeeGo, if WP7 is the future.

In 2008 Nokia acquired Norwegian company Trolltech, developers of the well-regarded Qt cross-platform application and user interface framework. Licensing to commercial users of Qt will be now be transferred to Digia PLC of Finland. Qt will not be ported to WP7. Only a few months ago Stephen Elop still talked about Qt being the common interface for Symbian and MeeGo. Qt was supposed to be the element that ties together Symbian and MeeGo in the mobile world. With Symbian dead and MeeGo on life support and a categorical “NO!” on Qt on WP7, Qt has no future left on mobile. But what else should one expect from a proprietary software company like Microsoft? They have never been keen on applications being ported from Windows to other operating systems, so they want people to use Microsoft tools only.

Nokia’s name is dirt within their developer community because after the announcement the Symbian ecosystem is dead, whatever Nokia would have us believe. It is also hard to believe that Elop had no plans about WP7 a few months ago, when Nokia still fed developers their Symbian / MeeGo / Qt strategy. Many developers must feel deceived. It will be hard for Nokia to regain their trust.

Several hardware makers had worked closely with Microsoft on the previous generation of its phone platform (Windows Mobile), who are now firmly in the Android camp. For example, HTC built the first Microsoft Windows based smartphone in 2002, but released an Android phone in 2008 and shifted the core of its smartphone business to that platform the following year (my Google Ion phone is made by HTC). Though it also offers some WP7 models, the bulk of its smartphone business is now Android.

With Windows Mobile, Microsoft could not translate its dominance on the desktop into traction in the mobile market, so it dumped Windows Mobile, with no compatible upgrade path to WP7. Developers had to rewrite apps from scratch. These early Windows Mobile supporters learned a lesson with Microsoft that Nokia is yet to learn, the hard way: Microsoft always does what’s good for Microsoft, not for its customers or business partners.

Nokia is betting the company on an unproven challenger that is entering the market behind three bigger established competitors (Google, Apple, RIM). Late last year Microsoft boasted ‘sales’ of 1.5 million WP7 phones over a period six weeks. That sounds significant, but what they actually meant by that were phones stuffed into the sales channel, mostly still sitting on shelves at mobile phone stores and not activated phones ringing in the pockets of retail customers. At the same time Google was activating that many Android phones every five days (every 5 1/2 days in the case of the iPhone).

No matter how much market share Nokia will lose over the next few years, whatever market share is left for Nokia with WP7 will still be a gain for Microsoft. And as long as Microsoft still has a steady cash flow from Windows 7 licenses and Microsoft Office it won’t be wiped out by a lukewarm reception for WP7 in the market, which is more than can be said for Nokia.

So why did Nokia make this risky decision? They must have come to the brutal conclusion that the company could not survive long term while still developing their own mobile OSes. Nokia only saw a choice between either switching to Android or to WP7 (or going under).

With Android they would largely have had to compete on the merits of their hardware, as every other Android OEM offers essentially the same software / marketplace “ecosystem”. Nokia didn’t want to compete on price with Asian manufacturers (which, as an aside, is exactly what they’ll have to do with their dead-end Symbian phones for the next year or more, since there will be little new software developed for them now). So if Nokia couldn’t be the top dog amongst Android makers, they could turn the other way and at least take whatever sweeteners they could get from Microsoft, while cutting back their software R&D costs and cutting jobs to weather the storm.

The biggest problem with that strategy in my opinion is that a few years down the road they’ll probably realize that WP7 was a dead end too. Then they’ll still have to make that switch to Android, but having already lost a few years, their good name and a lot of good staff it will be even harder.

Skype on Android 2.1 but not in the US

A year and a half after Skype launched a version for the iPhone (March 2009) it finally released Skype for Android for customers outside the US. In the US Skype has already been available for Verizon customers for a couple of months, but if you’re with a different US network you’ll still be out of luck.

Even outside the US, Android versions before 2.1 are not supported. My Google Ion which comes with Android 1.6 got this message:

Sorry, Skype is unavailable for your mobile. We add new handsets all the time so check back soon.

Last month, about 30% of Android users were still using 1.5 or 1.6.

This makes me even keener to find out when an Android 2.2 upgrade will become available for the Google Ion, as announced in May 2010.

Excessive JPEG compression on Android phones

A few weeks ago I got my first smart-phone, an HTC Magic (aka Google Ion or myTouch 3G) which uses Android 1.6.

Originally I had wanted to get the HTC Desire with Android 2.1 from Softbank, but they had no more stocks of the old model and weren’t going to start shipping the new model until October. I couldn’t wait that long. That’s how I ended up getting an Android phone from the US.

I first transplanted the USIM from my almost three year old Softbank Samsung 707SCII into the Android phone, which wasn’t locked to any provider. I could then make calls here in Japan.

Next I added Softbank’s “smart phone pakehodai” (smart phone unlimited data) plan to my existing contract, after telling the company that I was going to use my existing USIM in an imported Android phone. They didn’t raise any objections to that. The plan is about 5700 yen per month (about US$67), plus 315 yen to enable web access and mail (US$3.60), which I had previously disabled as I was only using SMS besides voice calls. I configured APNs for accessing the Softbank network using this link, which then gave me full web access from my new phone even when not on my wireless LAN at home.

So far it has been a fun experience and I’m still exploring new features and applications.

The application I enjoy most so far is Google Maps. Having moved from the semirural suburbs of Yokohama to a densely populated part of Tokyo recently, I’m now exploring local back streets on foot or on the bicycle as well as riding trains, of which there are plenty. Google Maps will easily find me a train connection to anywhere in this city of 13 million people, including directions for walking to and from stations and down to the minute connection schedules (Japanese trains are famously punctual).

I was disappointed however by the picture quality of the 3 MP camera (1536 by 2048 pixels) on the phone, not that my expectations were too high to start with. But I was shocked to see that when I copied these 3 MP image files off the phone using a USB cable, they were only 330 to 700 MB (500 MB on average) in size even when taking pictures at the highest quality settings. This is 2 to 3 times smaller than typical 3 MP cameras.

My old Sony P8 (also a 3 MP camera) averaged around 1.3 MB per image. One Megabyte or more per image is fairly typical for high quality settings at 3 MP. That means the Android camera must be using very aggressive JPEG compression settings, which reduce detail and produce artifacts, to squeeze pictures into 40% of the space used on other cameras. And you can really tell from just looking at the pictures: They look somewhat blurred and fuzzy, not as sharp and crisp as you’d expect even from a modest 3 MP camera.

What’s worse, I could not find any setting that would let me change this. A search on Google confirmed that others using different Android phones have the same problem, but currently no solution.

I hope Google will address this problem on the Android 2.2 upgrade, because with these software settings the capabilities of the hardware are wasted, even more so on 5 MP or 8 MP camera models. It makes no sense to aggressively compress pictures when the user has selected optimum quality, especially on a camera that can be expanded with up to 16 GB per microSD memory card.