Introduction: Track ME

Track ME is a "small" GPS, SD Card, and GSM Shield controlled by an Arduino Mega. Call me and get my location.

Step 1: Intro

A while back I decided to build a Car/Personal tracker.

This was my first prototype on this direction.

The system itself is very simple. Just an Arduino Mega, a GPS, a GPRS Shield and an SD Card. This last one is optional but I included because I thought in launching a challenge to my friends in Facebook, they call the system and get an SMS with my position or my last known position, in the end I would know how called me.

The system is always searching for the actual position. If someone calls the number of the SIM card, the system will send an SMS with the actual position and with a link to google maps. For example:

Hugo location is now: Lat: 54.315010, Log: 10.130997. http://maps.google.com/maps?q=54.315010,+10.13099...

If the GPS is not receiving any position, the system will send the last known position. For Example:

I can not seem to find Hugo. Last time that I've saw him, was in: Lat: 54.315010, Log: 10.130997. http://maps.google.com/maps?q=54.315010,+10.13099...

The date, time, position and SMS status and caller phone number are then stored in the SD Card.

Step 2: Components

For this project, you will need:

1x Arduino MEGA
1x GPRS Shield (It is also possible to use other GSM shields available in the market)

1x GPS (I used the NEO 6, very popular in ebay)

1x SD Card Shield

1x 9V Battery

1x Plastic

Box Some wires

Step 3: Connect All

Before assembly you will need to do the following steps.

  1. Remove the SIM pin code. Place the SIM card in phone and remove the SIM pin at the beginning of the cell phone startup.
  2. Insert SIM card in the SIM card holder in the GPRS shield. In the case of my GPRS shield, the card holder is located on the bottom of the shield.
  3. Setup the jumper to Software Serial (Optional). On my shield there are 2 jumpers that allow connections to pins 7 and 8 or pins 0 and 1. Because I want to use the normal Serial Communication port in the Arduino Mega, the jumpers need to be placed in SWserial position. When assembled I connected pins 7 and 8 to Serial Communication port 1, pins 17 and 18 in the Arduino Mega.

After performing the previous steps, place the GPRS shield in the Arduino Mega.

Then place the SD Card Shield on top of the GPRS shield.

Now connect pins 8 and 7 to pins 18 and 19 (Serial 1).

The SD Card Shield, that was designed for Arduino Uno, and uses pins 10 to 13 for SPI, so in order for this to work on Mega, they need to be "passed" to the SPI pins on MEGA.

Arduino UNO SPI pins - Arduino MEGA SPI pins

MOSI - 11 to 51

MISO - 12 to 50

SCK - 13 to 52

SS - 10 to 53

Using the prototyping area on the SD Card shield, I solder the GPS module.

Step 4: Assembly

After everything connected I placed the system inside a case.

The power from the system comes from a 9V battery connect in the DC power jack.

Step 5: Software

The library used for the GPRS Shield can be found where:

GPRS Library Download

After download, install in the correct Arduino library folder.

It is necessary to do some changes in order to use the Arduino Mega:

1) Open GSM.h in the library folder and comment/"decomment" the appropriate lines like below e.g. for Arduino Mega:

//#define UNO

#define MEGA

2) In HWSerial.h decomment the line for Mega definition e.g. for Arduino Mega:

#define MEGA

The library used for the GPRS Shield can be found where:

GPS Library Download

The program it self runs in a very simple manner. After all of the start up routines (GPRS, GPS and SD card initialization), the GPS will attempt to determine the number of satellites that he has available and a valid GPS coordinates point.

If call is placed during this period, the call will be automatically rejected and nothing will happen.

When the GPS has a valid location and is detecting more than 3 satellites (I'm assuming where that the GPS has good reception), if a call is placed, the system will send an SMS to the call number with my position.

All of these data will be stored in the SD card. If the GPS has less then 3 satellites, no valid position can be retrieved, so if a call is placed, the call number will receive an SMS with my last known position. Again all data is stored in the SD card.

The program can be found where:

Program Code Download

Step 6: Pros and Cons

Since this is a prototype, there are a lot of thing that didn't work ok. But the objective is always to improve.

First the battery only lasts for one hour!! I did not implement any energy saving mechanics in the software. So for future improvements "Sleep Mode" is a must. The size was also reviewed and I design a complete new board.

Please write me if you found any mistake or if you have any suggestion/improvement or questions.
Thanks for reading.

Hugo Gomes

P.S. If you like my tutorial, please share it and leave a me a vote :)

Comments

author
busani (author)2017-04-10

HI. what do you have inside?

author
Ankitmishra (author)2016-12-15

Error compiling for mega

author
Tiobel (author)Ankitmishra2016-12-20

Can you please post the error?

author
Ankitmishra (author)Tiobel2016-12-20

Variable p Scope is not declared....
Please update seperate files for mega.
And Uno
I tried multiple times but doesn't able to find what's going wrong.

author
Tiobel (author)Ankitmishra2016-12-21

I do not have any problem. Did you install the library's correctly? Did you change the GPRS lib from UNO to Mega?

author
Ankitmishra (author)Tiobel2016-12-24

almost did everything ......but still faceing error.

Arduino: 1.6.8 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Program Files (x86)\Arduino\libraries\GSMSHIELD/SIM900.h:5:0,

from F:\weber\gsm\Track-ME-master\Track-ME-master\code\code.ino:2:

C:\Program Files (x86)\Arduino\libraries\GSMSHIELD/GSM.h:195:18: error: redeclaration of 'SoftwareSerial GSM::_cell'

SoftwareSerial _cell;

^

C:\Program Files (x86)\Arduino\libraries\GSMSHIELD/GSM.h:192:12: note: previous declaration 'HWSerial GSM::_cell'

HWSerial _cell;

^

exit status 1

Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

author
Tiobel (author)Ankitmishra2016-12-29

Did you change the GSM.h and HWSerial.h as defined in point 5 of the instructable?

author
Babru BahanD (author)2016-12-22

This is B.B.Das

Thanks Hugo for your tutorial

author
RodrigoÚ6 (author)2016-12-19

Is it necessary to use the Arduino MEGA? wouldn't a ONE or nano be enough? I just say it because it would reduce the size a lot.

author
Tiobel (author)RodrigoÚ62016-12-20

I took the Mega because of the memory. The library's that I used take a lot of space.
Probably with some code optimisation you can fit everything in an Uno or Nano.

author
BenjaminB145 (author)2016-12-15

It's an awesome system, I must confess.... "if someone calls the number of the SIM card, the system will send an SMS with the actual position and with a link to google maps".

What if I want to get position or coordinates of the caller?

author
SeekandFind (author)2016-12-04

Would it be possible to have a WhatsApp message sent (in stead of an SMS)? And to activate by a WhatsApp message (in stead of calling)? This would make operational costs a lot lower.

author
diy_bloke (author)SeekandFind2016-12-14

obviously with whatsapp u would need to have wifi availability. with a gsm not

author
Tiobel (author)SeekandFind2016-12-05

I do not know how to use WhatsApp with this setup, if some other user come up with this fell free to share it where. There are some SMS internet services that can do this. I will try to update this program with some more changes and this will be one of them.

But if costs are the problem, (at least in Germany) you can get SMS flat rate for very low fee per month. The Call action will not charge you anything because the system rejects the call automatically.

author
diy_bloke (author)2016-12-14

Nifty!!!!

author
langtupt (author)2016-12-06

Good Morning Mr. Tiobel,

Could you please help the code in sim900a, i want to use sim 900A mini in this project,do you have schematics and source code for me with email: langtupt@gmail.com

Thank you very much.

( link img sim900a mini: https://encrypted-tbn2.gstatic.com/images?q=tbn:AN... )

author
Tiobel (author)langtupt2016-12-07

Hi, the setup must be more or less the same, I do not know your pcb version of SIM900A but if it is 5V tolurante, you can probably connect like I connected my GPS. Please see the schematic below.

author
Valkem (author)2016-12-05

Nice, I could see using this in my car, just in case it runs away or my kid is up to no good. :) Then the battery issue might not matter, just minor adapting and wiring into the harness. Great work.

author
Daelke (author)2016-12-05

Very Nice! The instructions look to be bullet proof, thanks for that!

author
Shahid Khattak (author)2016-12-05

Impressive

author
biggles246 (author)2016-12-04

What SIM card can you use and do you gave to pay for the sim card monthly like it was in a phone?

author
Tiobel (author)biggles2462016-12-04

No the card that I used was a prepaid. But you also can use an monthly one.

author
nikk777 (author)2016-12-04

Maybe consider motion detection in addition to sleep mode to activate tracking. Also reduce frequency of GPS links.

author
Yavnik (author)2016-12-01

Awesome mixture of GPS and GSM. Definitely going to try this!!!

author
AnandC16 (author)2016-12-01

good work

author
Vergespace (author)2016-12-01

Nice tutorial!

author
tomatoskins (author)2016-11-30

This is great! Thanks for sharing!