Introduction: The Ultimate Child Tracker

One of the worst nightmares for a parent is when your child is "missing". He / she may be just around the corner, but not know where they are can be a perfect recipe for a panic attack. Statistics show that during 2013, a daily average of 1,720 parents or primary care givers felt the disappearance was serious enough to warrant calling law enforcement (in the US). [Source: https://www.fbi.gov/about-us/cjis/ncic/ncic-missin... ] The worldwide figures would be even more alarming.

I was looking for a simple small device that could track my child (4-year old) whenever I wanted and looked around for some commercial products that were available. There are many products available, however most of them were very limited (required a home station within range) or had expensive monthly subscription fees.

Then it struck me, that mobiles these days are the perfect tracking devices, with easy tracking ability using just GPRS (and some with GPS as well). Android and Google / iPhone and iCloud provide the perfect combination to track the phone. The only problem with this idea is that the phone can be left behind / dropped / broken by the child and I needed something small enough to be pinned to the child's clothing (and difficult to break).

I came up with the following wishlist:

  1. Small and lightweight
  2. Battery life of at least 8 hours (standby)
  3. Rugged
  4. Should look good and appealing to a child
  5. Should provide me with the location when I ask via sms
  6. Should pick-up my call so that I can communicate with my child

The original plan was to use the RePhone, but my C skills are rusty and I'm more comfortable with the Arduino series of boards. Seeed Studio also makes another board for wearables that had what I needed. It's called the Xadow. It's an Arduino Leonardo compatible board with multiple modules that can be used to create a smart wearable easily.

Step 1: Theory Behind Trackers

The two most frequently used trackers are GPS based and GPRS based, both with their advantages and disadvantages; some combining both to get the best results.

GPS (Global Positioning System)

According to Wikipedia, the Global Positioning System (GPS) is a space-based navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites.The system provides critical capabilities to military, civil, and commercial users around the world. The United States government created the system, maintains it, and makes it freely accessible to anyone with a GPS receiver.

The GPS concept is based on time. The satellites carry very stable atomic clocks that are synchronized to each other and to ground clocks. Any drift from true time maintained on the ground is corrected daily. Likewise, the satellite locations are monitored precisely. GPS receivers have clocks as well—however, they are not synchronized with true time, and are less stable. GPS satellites continuously transmit their current time and position. A GPS receiver monitors multiple satellites and solves equations to determine the exact position of the receiver and its deviation from true time. At a minimum, four satellites must be in view of the receiver for it to compute four unknown quantities (three position coordinates and clock deviation from satellite time).

Source: https://en.wikipedia.org/wiki/Global_Positioning_S...

Disadvantages:

  1. Requires a clear view to the sky - and hence does not work in basements, within buildings
  2. Is more power-hungry than GSM tracking and hence requires a larger battery

GSM (Global System for Mobile Communications)

According to Wikipedia, GSM is a standard developed by the European Telecommunications Standards Institute(ETSI) to describe protocols for second-generation (2G) digital cellular networks used by mobile phones, first deployed in Finland in July 1991.[2] As of 2014 it has become the default global standard for mobile communications - with over 90% market share, operating in over 219 countries and territories.

Source: https://en.wikipedia.org/wiki/GSM

The cellular network is distributed over land areas called cells, each served by at least one fixed-location transceiver, known as a cell site or base station. In a cellular network, each cell uses a different set of frequencies from neighboring cells, to avoid interference and provide guaranteed bandwidth within each cell.
When joined together these cells provide radio coverage over a wide geographic area. This enables a large number of portable transceivers (e.g., mobile phones, pagers, etc.) to communicate with each other and with fixed transceivers and telephones anywhere in the network, via base stations, even if some of the transceivers are moving through more than one cell during transmission. Cellular networks offer a number of desirable features:

  1. More capacity than a single large transmitter, since the same frequency can be used for multiple links as long as they are in different cells
  2. Mobile devices use less power than with a single transmitter or satellite since the cell towers are closer
  3. Larger coverage area than a single terrestrial transmitter, since additional cell towers can be added indefinitely and are not limited by the horizon

Source: https://en.wikipedia.org/wiki/Cellular_network

As each tower in a cellular network provides a unique identity code, it is possible to triangulate using 3 or more towers to get your position. The more number of towers available, the more precise your location.

Cellphones receive signals from various cellphone towers and picks up the signals from the tower with maximum signal strength. Since, the distance & signal strength between different cellphone towers are known (usually around 5-10 km), the signal strength from various towers to the cellphone is used to calculate the distance between each tower & the cellphone & further triangulate the approximate position of the cellphone.

Source: http://www.quora.com/How-do-mobile-operators-track...

Disadvantages:

  1. Location is not extremely accurate, however in urban areas with a lot of cell towers, this should be acceptable
  2. You need a SIM card with a cellular service network of your choice

You can find more information on GSM tracking on the following pages:

http://www.neilson.co.za/mobile-network-geolocatio...

http://stackoverflow.com/questions/10329877/how-to...

My Choice

I decided to go with GSM based tracking as even with the GPS tracking, I would have needed a cell phone connection for my other features (calling, SMS, etc). GPS tracking is much more accurate, but needs a larger module and battery. (Maybe in the future)

Step 2: Hardware

I decided to use the following hardware for the tracker:

  1. Xadow Main Board: http://www.seeedstudio.com/depot/Xadow-Main-Board-...
  2. Xadow Breakout Board: http://www.seeedstudio.com/depot/Xadow-Breakout-p-...
  3. SIM800L GSM Module: http://www.aliexpress.com/item/Smallest-SIM800L-GP...
  4. Small speaker
  5. Small microphone (pulled from an old hands-free kit)
  6. 10k Resistor
  7. Some Wires

Please note, there are many other options available and I chose these mainly because i had them available (and in the case of the GSM module - it's cost)

Xadow Main Board

The Xadow Main Board is a microcontroller board based on the controller ATmega32U4 with 32k flash and is compatible with the Arduino Leonardo. The board can be powered either from the USB connection or a Lithium battery (included) and hence can be easily used as a wearable.

The Xadow Modules cascade with each other using FFC cables. Since the pins on the module are not broken out, we need to use a breakout module that breaks out the RX/TX pins and allows us to connect to the SIM800L Module.


Also, since the module is compatible with the Arduino Leonardo, it has two serial ports (One through USB and one on RX/TX pins) which makes it easier to debug the arduino sketches.

SIM800L GSM Module

The SIM800L is a quad-band GSM/GPRS Module, effectively making it usable across the world. It has the following features:

  1. Quad-Band GSM/GPRS
  2. Audio in and out
  3. Serial TTL compatible
  4. AT Command Set
  5. Operating Voltage: 3.4 to 4.4 Volts
  6. In-built function that provides GSM based location (latitude, longitude)

SimCom has provided a lot of documentation on the best ways to use these modules and Adafruit is kindly hosting all of them for us:

They have also created an easy to use library: https://github.com/adafruit/Adafruit_FONA_Library

Step 3: Circuit

The circuit is very simple:

Xadow Connections:

  1. Connect the Xadow Breakout Module to the Xadow Board using the FFC Cable - ensure that the slots face the same direction
  2. Connect the Battery to the Xadow Board (JST Connector)

SIM800L Connections:

  1. VCC to the battery pad at the bottom of the Xadow Board (See image above)
  2. GND to ground
  3. Mic to MICP and MICN
  4. Speaker to SPKP and SPKN
  5. DTR to ground via a 10k Resistor
  6. TXD to RX on the Xadow Breakout
  7. RXD to TX on the Xadow Breakout
  8. RST to A5 on the Xadow Breakout

You can test the module using the FonaTest sketch in Adafruit's Fona Library. I tested the circuit using my Induino development board (see image above).

Step 4: Cellular Network

The SIM800L module requires a working SIM card (with data). In India, there are many affordable pre-paid plans by all the major carriers (Airtel, Vodaphone, etc) as low as INR 105 (~USD 2) for 300 MB per month. Unfortunately in US most of the carriers have "unlimited" plans ranging from $40-$80 per month. For this application, you would need at the max 10-20 MB per month.

The only service provider I found that was budget friendly was Ting (working on the T-Mobile network) which comes to ~USD 9 (plus taxes) per month for 1 device and upto 100 MB of data per month.

So, I went ahead and bought a Ting SIM card and installed it on the SIM800L module. Please note, the chamfered edge has to point towards the edge of the slot and not inside.

Step 5: Software

The Arduino Sketch is heavily modified from the examples in Adafruit Fona Library.

#include 
#include "Adafruit_FONA.h"

#define FONA_RST 4
#define AUTHORIZED "+1*****************" // INSERT YOUR PHONE NUMBER HERE

// this is a large buffer for replies
char replybuffer[255];

HardwareSerial *fonaSerial = &Serial1; // Use the Serial1 on the Xadow Board

Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);

void setup() {
  while (!Serial);
  Serial.begin(115200);
  Serial.println(F("Initializing....(May take 3 seconds)"));

  fonaSerial->begin(115200);                                  // The SIM800L module auto detects the baud rate, but works really well with 115200
  if (! fona.begin(*fonaSerial)) {
    Serial.println(F("Couldn't find SIM800L"));
    while(1);
  }
  Serial.println(F("SIM800L is OK"));

  // Print SIM card IMEI number.
  char imei[15] = {0}; // MUST use a 16 character buffer for IMEI!
  uint8_t imeiLen = fona.getIMEI(imei);
  if (imeiLen > 0) {
    Serial.print("SIM card IMEI: "); Serial.println(imei);
  }

// Configure APN Settings for TING - please change for your network
  fona.setGPRSNetworkSettings(F("wholesale"));
}

char fonaInBuffer[64]; 

void loop() {
  Serial.print(F("FONA> "));
  while (! Serial.available() ) {
    if (fona.available()) {
        Serial.write(fona.read());
    }
  }
  char phone[32] = {0};
  if(fona.incomingCallNumber(phone)){
    Serial.println(F("RING!"));
    Serial.print(F("Phone Number: "));
    Serial.println(phone);
    if(phone == AUTHORIZED)
      fona.pickUp(); 
  }
  char* bufPtr = fonaInBuffer;    //handy buffer pointer
  
  if (fona.available())      //any data available from the SIM800L?
  {
    int slot = 0;            //this will be the slot number of the SMS
    int charCount = 0;
    //Read the notification into fonaInBuffer
    do  {
      *bufPtr = fona.read();
      Serial.write(*bufPtr);
      delay(1);
    } while ((*bufPtr++ != '\n') && (fona.available()) && (++charCount < (sizeof(fonaInBuffer)-1)));
    
    //Add a terminal NULL to the notification string
    *bufPtr = 0;
    
    //Scan the notification string for an SMS received notification.
    //  If it's an SMS message, we'll get the slot number in 'slot'
    if (1 == sscanf(fonaInBuffer, "+CMTI: \"SM\",%d", &slot)) {
      Serial.print("slot: "); Serial.println(slot);
      
      char callerIDbuffer[32];  //we'll store the SMS sender number in here
      
      // Retrieve SMS sender address/phone number.
      if (! fona.getSMSSender(slot, callerIDbuffer, 31)) {
        Serial.println("Didn't find SMS message in slot!");
      }
      Serial.print(F("FROM: ")); Serial.println(callerIDbuffer);
      if(callerIDbuffer == AUTHORIZED) {
        //Send back an automatic response
        Serial.println("Sending reponse...");
        if (!fona.enableGPRS(true))  
         Serial.println(F("Failed to turn on"));
        uint16_t returncode;
        if (!fona.getGSMLoc(&returncode, replybuffer, 250))
          Serial.println(F("Failed!"));
        if (returncode == 0) {
          Serial.println(replybuffer);
        } else {
          Serial.print(F("Fail code #")); Serial.println(returncode);
        }
        if (!fona.sendSMS(callerIDbuffer, replybuffer)) {
          Serial.println(F("Failed"));
        } else {
          Serial.println(F("Sent!"));
        }
        if (!fona.enableGPRS(true))  
          Serial.println(F("Failed to turn on")); 
      }
    }
  }
}
  

Step 6: Enclosure

I wanted to use the Xadow Metal Frame as the enclosure, unfortunately it has been discontinued by Seeed Studio.

So, for the time being I settled with a plastic enclosures that came with the Xadow Boards covered with a paper box. I went to TemplateMaker and created a template for the enclosure 4cm x 8.5cm x 1.5cm, printed it on card paper and put the entire circuit within it. The only problem with this approach is that the entire device needs to be opened up to charge, however, the intent is to have a 3D-printed enclosure that exposes the USB port for charging.

The entire device is tied to the arm using a velcro tape and can be hidden under the jacket / loose shirt.

Step 7: Final Result

The final product has the following features:

  1. Accepts calls from a defined number (defined in code)
  2. Responds to an SMS command from defined number with current latitude and longitude

To Do:

  1. Set up location tracking, so that the module automatically sends location to an MQTT server when either of the following conditions are met:
    • The child moves by 500m
    • every 30 minutes
  2. Implement a vibration sensor / sound sensor so that the module can dial out / send message to a specific set of people. e.g. if the child is crying or has fallen down.
  3. Still debating whether to implement GPS - the SIM808 module has in-built GPS, but is considerably more expensive. Alternatively, I have a GPS module that I can use, but that would increase the size of the device.

Suggestions welcome.

DISCLAIMER: I have tested this device, however do not provide ANY warranty whatsoever.

Phone Contest

Participated in the
Phone Contest

Epilog Contest VII

Participated in the
Epilog Contest VII

Safety Challenge

Participated in the
Safety Challenge