RadioLocman.com Electronics ru
Advanced Search +
  

04-24-2013

Convert your smartphone into a pedometer and tracking device

Ali Asgher Mansoor Habiby and Abdus Sami Abdul Qayyum, Sir Syed University, Karachi, Pakistan

EDN

When you go hiking or mountain biking, or simply take a long walk around the neighborhood, you might wonder about the distance you covered or specific details, such as speed. A specialized device for such a task is an expensive idea. Now, however, the increasing penetration of smartphones in the market with built-in GPS devices makes it possible to configure a mobile phone to log or send the current readings from its sensors to a server for viewing and processing.

This Design Idea describes a simple approach to log readings from a GPS using the Python scripting language. An advantage of Python is that an electronics engineer need not delve into the complex realm of C/C++ calls for Symbian/Android architectures to accomplish this simple task. All that is required is the installation on a phone of the Python interpreter, along with a text file containing the script.

The Python script initializes the mobile phone’s GPS and records location and speed data periodically in a file. It can upload the information via GPRS (general packet radio service) or send it using SMS (short messaging service) to another mobile phone. A .NET application that runs on any PC with a mobile phone connected receives the SMS to track a user in real time on maps provided by Google Maps. In cases where the expense of a PC and receiving mobile would be extra, it’s possible to import the tab-separated log file from the smartphone for manual data calculations.

The novelty of this idea, however, is in the use of a built-in accelerometer to calculate the number of steps taken when a user is walking or jogging and, based on this data, to calculate the amount of calories burned using one of many sample equations available (references 1 and 2). Hence, a total working pedometer and tracking system can be made using simple software in your smartphone without any additional hardware.

Convert your smartphone into a pedometer and tracking device
Figure 1. The trackee’s location is displayed just after he or she turns on the mobile application.

Figures 1 and 2 show two snapshots of the .NET application on the receiving PC. The app simply receives an SMS (with predefined format), parses it, displays the location/data on the map, and logs the information into a CSV file.

Convert your smartphone into a pedometer and tracking device
Figure 2. The user sets the COM port connection to the mobile device.

A few lines of code, available for download here, enable the device to use its GPS for receiving its current location. A single line then sends the location data via SMS to the destination number. The destination can be connected to a PC for logging and is playing real-time data. The code writes all information to a file on the mobile phone itself, in case the SMS option is not required and all data needs to be on the device for later analysis. A flow chart shows the functions of the code listings (Figure 3).

Convert your smartphone into a pedometer and tracking device
Figure 3. The code listings write and send the data and initialize the GPS.

Several components of the final design can be considered optional, as some users may want only the tracking app, and others might be content with a local file, without sending an SMS.

References

  1. Scarlett, Jim, «Application NoteAN-900: Enhancing the performance of pedometers using a single accelerometer,» Analog Devices, 2007.
  2. «Pedometer Steps to Walking Calories and Distance Calculator,» About.com.

Downloads

The script file

You may have to register before you can post comments and get full access to forum.
User Name

News on theme:

Slices ↓
Radiolocman facebook Radiolocman twitter Radiolocman google plus