Getting Network Location using SIM900 GSM modules
How it works :
The way the network location feature works is that the GSM device gets the location of the network tower it is connected to. The server in the network towers is programmed to a hard coded location coordinate values which can be retrieved by the GSM module through a GPRS connection.
On a side note,
The SIM900/SIM800 modules just retrieve the tower location.But some advanced modules manufactured by Telit are having a feature where in they can triangulate their position with respect to three connected towers. The more number of towers are visible better is the locating accuracy. But we have to sign an NDA to get access to these AT commands to access the triangulated network location. This feature is also called AGPS.
In this post we will only be discussing the cell location feature of SIM900 module.
To get started we need to establish a network connection to retrieve the location, So lets set up a GPRS connection.
Text in RED is typed by me and text in GREEN is the response from SIM900 module.
Setting up GPRS connection
Set the connection type to GPRS
AT+SAPBR=3,1,”Contype”,”GPRS”
OK
Set the APN to to “www” since i am using a Vodafone SIM card, It might be different for you, and depends on the network
AT+SAPBR=3,1,”APN”,”www”
OK
Enable the GPRS
AT+SAPBR =1,1
OK
Query if the connection is setup properly, if we get back a IP address then we can proceed
AT+SAPBR=2,1
+SAPBR: 1,1,”100.120.204.132″
OK
The command AT+CIPGSMLOC is used to retrieve the network date, time and location,
Lets check the network date and time
AT+CIPGSMLOC=2,1
+CIPGSMLOC: 0,2017/07/16,18:07:13
OK
So that’s how the device responds with the network date and time
Now, Lets check the network location
AT+CIPGSMLOC=1,1
+CIPGSMLOC: 0,78.151830,15.958542,2017/07/16,18:07:47
OK
This is how we get the network location as Longitude and Latitude.
When we plot the points on map we get the approximate location of where our device is situated.
But this location is no way near the GPS location accuracy. The accuracy using network location can vary from few hundred meters to a kilometer depending on the distance between device and network tower.
This is to be noted that this command is only helpful in retrieving location of the device for emergency purpose when GPS signal is not available like in indoor locations or caves or tunnels. This can also be a low cost alternative compared to using the additional standalone GPS module.
For live demo watch this video,
Also see :
- SIM900/SIM800 Sleep mode AT Commands
- SIM800 series Bluetooth AT commands
- SIMCOM got acquired by UBLOX ! – Is it a GOOD news or BAD news
- Footprint compatible 2G, 3G, 4G modules for using in your M2M designs