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 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.
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.130997
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.130997
The date, time, position and SMS status are then stored in the SD Card.
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
Since the Arduino Mega uses a different pinout, some rewiring are necessary.
First the SD Card Shield, that was designed for Arduino Uno, 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
On GPRS Shield first is necessary to setup the communication pins to Software Serial in the J7 jumper of the shield.
Then using some wires I connected Pins 7 and 8 in GPRS shield to Serial 1 port (pins 18 and 19 in the Arduino Mega).
For more details in how to connect the SIM Card in the GPRS Shield, please see my other project in Hackster.
The GPS is connected to Serial 2 Port (pins 16 and 17) in the Arduino Mega.
Also the power necessary for the GPS is taken out from the SD card 5V pin and GND pin.
The 9V battery can be connected to the Vin pin or to the power jack plug.
Preparing to close the box and field test.
I leave here some quick notes about the code.
I used this library for the GPRS Shield.
It is necessary to do some changes in order to use the Arduino Mega:
1) Open GSM.h and comment-decomment the appropriate lines like below e.g. for Arduino Mega:
2) In HWSerial.h decomment the line for Mega definition e.g. for Arduino Mega:
For GPS I'm using this library.
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.
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. The first look is this:
Please write me if you found any mistake or if you have any suggestion/improvement or questions.
Thanks for reading.