Building your own GPS tracker device using an Android phone

This page describes how Henrik Carlqvist used an android phone to build his own car tracking device.

The phone

X10 mini

Choice of phone

The important thing when choosing phone for this project is that the phone should be automatically turned on when a charger is connected. The Sony Ericsson X10 mini has this important feature. It is also a rather small phone which makes it easy to hide in a car and at the time of this writing a used such phone can be bought for about 50 €.

Only charging?

Only charging?

Depending on your firmware version, the phone might seem as if it is only charging and not turned on when the charger is connected. However, the hardware in the X10 mini is really powered up, but some firmware versions interrupt the init process to only show a charging icon. This can be fixed, no need to worry.

Rooting the phone

Rooting the phone

Root privileges are needed to modify the firmware to complete the init process when the charger is connected. The app to power down the phone when the charger is disconnected will also need root privileges. To root the phone I followed the steps described at howto-root-your-xperia-x10-mini-pro. Even though that page is written for X10 mini pro the steps worked also on my X10 mini and the steps worked fine on my laptop running Slackware Linux 12.2.

However, one of the steps described on that page, "touch testfile" did not work on my phone. The touch program only gave "permission denied" even though I did have write access as a normal user to that directory.

Complete boot

Complete boot when charging

If your phone only gets one of those ugly battery symbols when a charger is connected to a powered off phone this is because the init process is interrupted by /system/bin/chargemon. That file is a binary ARM program, I replaced it with a simple script containing only a single line:
echo skipping chargemon
The file was created and installed with the following steps:
echo "echo skipping chargemon" > chargemon.script

adb pull /system/bin/chargemon chargemon.backup

adb push chargemon.script  /sqlite_stmt_journals

adb shell

$ cd /sqlite_stmt_journals
$ su
# mount -o remount,rw /dev/block/mtdblock0 /system
# cat chargemon.script > /system/bin/chargemon
# chmod 755 /system/bin/chargemon
# reboot -p
  • When the command su is given above, it might have to be acknowledged in a dialog on the phone screen.
  • The final command reboot -p shuts down the phone. As the USB cable is still connected it will power on again, and if everything has gone fine the phone will complete its boot process without halting with any battery symbol.
Comviq

Choice of carrier

For this purpose I choose a prepaid plan from Comviq. Whenever the plan is refilled with 169 SEK (about 17 €) a data plan with up to 200 MB will be included for the next month.

The apps

GPS Tracker

GPS Tracker

GPS Tracker QR code I did not try out every single GPS tracking app on Google play, but I quickly found GPS Tracker which seems perfect for my purpose.

spysat

Spysat

(update 2015-04-06)

Since a few months back GPS Tracker no longer works. I have now switched to Spysat, another free GPS tracking service. The Spysat web interface has a smaller map, but it is capable of exporting tracks on .gpx files which can be converted to .kml and displayed on google maps. I also evaluated some opensource projects which would allow me to run my own GPS data collecting server, but none of those projects were useful both on my old phones and on any of my web servers.

Startup Manager

Startup Manager

Startup Manager QR code To make GPS Tracker start when the phone is powered on I use Startup Manager.

HaltTimer

HaltTimer

HaltTimer QR code As I do not only want the phone to power-on when it starts charging but also to shutdown some time after the charger has been disconnected I searched google play for some app to accomplish this. Being unable to find anything I wrote HaltTimer myself. I configure HaltTimer to shutdown the phone 900 seconds after it has stopped charging. If you want to play around with the source code for HaltTimer you can find it at SourceForge.

Car installation

500 mA charger

Cheap charger

At first I bought the cheapest 12V USB charger I could find at Biltema. Unfortunately, specified for only 500 mA it was a little to weak to charge the phone with GPS software running in the phone.

1000 mA charger

Good charger

This one, also bought at Biltema for about 7 €, is specified for 1000 mA which is enough to charge the phone even with GPS software running.

Lighter socket

Lighter socket

A lighter socket is needed to connect the 12V USB charger. I bought this one at Biltema for about 4 €.

Charger in lighter socket

Charger in socket

The charger fits perfectly in the lighter socket!

Car power

Car power

The socket is wired so that it gets 12V only when the car ignition key is on.

Padded phone

Padded phone

To avoid rattling noises when traveling on bumpy roads I padded the phone.

Padded lighter socket

Padded lighter socket

For the same reason I also padded the lighter socket.

Phone in place

Phone in place

I used re-open-able cable ties to fit the phone in place.

Phone in dash board

Car dashboard

Who would guess that this cars dashboard is hiding a GPS tracking device?

Result and some final thoughts

Map result from test drive

Test drive

Logging in to the application web does not only show the current position of the car. It is also possible to look at historic tracks.

X10 mini

Acceptable defects

When buying a cheap used phone for this purpose you might have to accept some defects. The phone does not have to look like new when it is supposed to be hidden. The screen might have scratches and maybe even partly broken as long as it is still possible to install and configure programs. However, the most common problem with these phones seems to be loose contacts at the connector for the USB problem. Make sure that you buy a phone that is possible to charge.

Behind electric central

Electrical modifications to the car

If you are fortunate your car might have a spare 12V socket for you to use for this project. If you are a little unfortunate that socket is always connected to 12V regardless of the position of the ignition key. Don't try to do anything stupid with the electric central.

Fuses

Reversible electrical modification

One reversible modification is to get ignition key controlled 12V from one fuse socket and using a line fuse to split that to both fuse sockets.


Last modified: Mon Apr 6 16:51:44 CEST 2015