
-71-
v4.9
Geolocation tracker application example
13. Geolocation tracker application example
The 3G+GPS module allows the developer to send the GPS location and sensor data to the cloud, via 3G or GPRS. This chapter
shows how to track a Waspmote with the 3G+GPS module and see in the web with Google Maps API. The example for Waspmote
and the PHP script for the server are shown as help or inspiration for the developer.
Before starting to use Waspmote, you must install the PHP script (shown at the end of the chapter). To use the PHP script you
need an Apache server with PHP active. You can run the script in a PC installing Apache with PHP. You can do this easily with the
installer from these websites (or the package manager for Linux):
•
For Windows use WAMP:
http://www.wampserver.com/
•
For Linux use LAMP: Use your package manager in Linux
•
For Mac use MAMP:
http://www.mamp.info/
In these websites, you have manuals to help you to install the server and activate PHP. Extract the PHP script on your computer.
You must change the Google Maps API v3 key in the PHP script:
“
http://maps.googleapis.com/maps/api/js?key=your_key&sensor=false
”
To show the map with the marker you need to access to the next URL:
http://your_IP_or_domain/demo_sim908.php
The IP address or server domain must be the same used in the example code of Waspmote (in case you are running the demo
on your computer, replace “your_IP_or_domain” by “localhost”)
Once the PHP script has been installed and Waspmote has the example code (3G+GPS 31: demo GPS tracker) uploaded,
Waspmote can be switched on. Remember, you must configure your APN, login and password. If you don’t do this, the 3G+GPS
module cannot connect to the 3G or GPRS network. Also, you must set the URL with the IP address of your computer (external
IP, not the LAN IP address) or your server’s domain.
When the GPS fixes the GPS satellites, the 3G+GPS module will connect to the network and send the GPS data through the
Internet to the PHP script in your computer. When a frame is received, a marker will be shown in the map.
Figure: Geolocation tracker demo - Map
Figure: Geolocation tracker demo - Satellite