Libelium World:

Publish in: Articles, Waspmote

Outdoor and Indoor Location of Sensor Devices using GSM Cells and GPS

Outdoor and Indoor Location of Sensor Devices using GSM Cells and GPS

April 20th, 2010 - Alberto Bielsa, David Gascón

There are two main ways of performing outdoor location when tracking sensor devices in a large area such as a city. The most extended is using a GPS module to get the information sent by the satellites on the 1575MHz band and extract all the information possible (latitude, longitude, speed, direction). However, this methodology is not effective when requiring mobile scenarios where the nodes can change from a clear environment to an indoor one, such as going inside buildings, garages and tunnels.

For these cases is used an alternative way which consists in taking the information sent by the Mobile Phones Cells and look for their location in a previously saved Data Base. This information includes Cell ID, RSSI and Timing Advance (TA) of any of the Base Stations which are located in the surroundings.

Obviously we are refering here about how to track a sensor device in a large area such as a city. For accurate indoor locations Waspmote uses its 802.15.4/ZigBee module, however, this application is not covered in the current article as we center on how to track mobile sensor nodes which are moving through a huge area.

Both GPS and GPRS technologies are complementaries as a system with both technologies allows to track the position inside buildings, garages, and even inside tunnels (eg. subway railway system) while maintaining an accurate precission in a clear environment where the information from the GPS satellites can reach the sensor device.

We will use the Waspmote platform and its open source programming API as it has both the GPS and GPRS modules in order to extract all the information.

The GPS module uses the A1084 GPS demodulator by Vincotech:


  • Movement sensitivity: -159dBm
  • Acquisition sensitivity: -142dBm
  • Hot Start time: <1s
  • Warm Start Time: <32s
  • Cold Start Time: <35s
  • Antenna connector: UFL
  • External Antenna: 2.4dBi

FIgure 1: Waspmote Bottom side with the GPS module


Let's see how we can extract the information from the GPS module:

void setup(){

  // set GPS ON
  // open the uart con communicate the microcontroller with the module

  // Inits the GPS module
  // waiting for GPS is connected to satellites
  while( !GPS.check() ) delay(1000);

void loop()

    //once the GPS has enough satellites we can get all the parameters

Each of the above functions stores the required parameter in the appropriate variable, this way we can now print all the information acceding directly to the variable of the class:


FIgure 2: Waspmote Top side with the GPRS module


Let's see now how extract the information from the GPRS module in order to use it to track the sensor device position according the Cell ID's location and strength of the signal received (RSSI).

Once we get this information we can compare it with the Data Base downloaded from OpenCellID, where we can find a largue list of Cell ID's from different operators thorough the world. We can store this huge database (570MB) in the internal SD card on Waspmote which let us store up to 2GB of information inside or transmit the information acquired to a central point where it will be compared with the Cell ID's data base.


The GPRS module integrated in Waspmote is the model HiLo by Sagem. As it is Quadband it can operate with any operator from any country:


  • Quadband: 850MHz/900MHz/1800MHz/1900MHz
  • TX Power: 2W(Class 4) 850MHz/900MHz, 1W(Class 1) 1800MHz/1900MHz
  • Sensitivity: -106dBm
  • Antenna connector: UFL
  • External antenna gain: 0dBi

All the needed parameters: Received Signal Strength Indicator (RSSI), Cell ID and Timing Advance (TA) of the Base Station are accessible directly from the Waspmote API.


This function will store in two variables the RSSI and Cell ID. These variables are:





If you want to know more information about the cell environment, you may use the transparent function to send to the GSM/GPRS module the command desired



Using this function and the proper command, we will obtain information about the 8 closest Base stations (BT's) surrounding to our node.






The answer is stored in a variable




The answer after the previous call to 'sendCommand' should be like this:


+KCELL: nbcells





  • nbcells: number of base stations available. The first base station is the serving cell
    (0 ≤ i ≤ 7).
  • ARFCN: Absolute Radio Frequency Channel Number in decimal format.
  • BSIC: Base Station Identify Code in decimal format.
  • PLMN: PLMN identifiers (3 bytes) in hexadecimal format, made of MCC (Mobile Country Code), and MNC (Mobile Network Code).
  • LAC: Location Area in hexadecimal format.
  • CI: Cell ID, 4 hexadecimal digits, e.g. ABCD.
  • RSSI: Received signal level of the BCCH carrier, decimal value from 0 to 63. The indicated value is an offset which should be added to –110 dBm to get a value in dBm. See the formula specified in TS 05.08 Radio Subsystem Link Control.
  • TA: Timing Advance. 0...63 in decimal format, available only during a communication (equals to 255 at any other time). Only available on serving cell during communication.

As we can see, we obtain the RSSI, Cell ID and TA from each BT's detected around the node. These three parameters which we will use in order to calculate the location of our node.

The RSSI parameter returned specifies the received signal level of the BCCH carrier. It can be used to know the link quality and locate a node using triangulation. The Cell ID parameter may be used to identify each BT's and be able to triangulate the signal and locate a node. The TA parameter is very useful as the BTS sends this information to each node according to the perceived round trip propagation delay BTS-node-BTS.

So, to know the distance between the node and the base station you have to use this equation :


Distance = (TA/2)x 3.6µs x C


Where :

- TA is the Timing Advance that you can see on the command notification.
- C is the speed of light (299,792,458 meters per second).

Waspmote can be used to locate sensor nodes in real time and in outdoor and indoor locations thanks to its GSM/GPRS and GPS modules. The open source Waspmote API allows to get all the information needed easily.

Quick Publish: