In this tutorial, you will learn how to create a navigation system by GSM module and Arduino instead of using GPS. At the end of this project:
- You will be familiar with GSM modules and how to use it by Arduino.
- You can make a navigation system by GSM.
In navigation, a radio station regularly sends signals around. These signals include the exact coordinates of that station. It does not matter whether the station is fixed (such as the Airport Control Tower) or movable (such as a satellite). The important thing is that the coordinates of the station itself should be known at any moment. An aircraft or ship that receives these signals acquires its coordinates by extracting the coordinates that are included in the signal and performing geometric operations, and finds its route using standard maps. In this way, more than one radio station should be in the sight of the device.
The world’s largest radio navigation system, which includes 24 satellites in Earth’s orbit, can be used to obtain coordinates at any point in the ground. Russia also has a satellite positioning system called Glonass, and the EU is also planning to launch a similar system in the near future called Galileo (satellite navigation).
From the past, poles have also been widespread in ships, with low accuracy and the possibility of many errors with their negative points. The inertial navigation system combines compass information with the gyroscope and fixes some of its error. Also, performing calibration operations can also have a great impact on the elimination of digital polarization polarities.
In this project, We want to make a navigation system without GPS module. As you know, using GSM signals of phones or other devices is one of the ways of finding location or tracking devices. When a GSM system connected to a network, you can receive some information about location of Telecommunications towers and totally you can receive the precise coordinates of your device location. We choose one of GSM/GPRS SIMCOM module for connecting to network and an Arduino board to receive data and monitor them. Let’s do it.
CircuitFirst you must add the library. Download the Zip file and add it to Arduino IDE. Go to Sketch tab, Include library and Add ZIP Library. If it is the first time you are using an Arduino board, don’t worry, just follow these steps:
- Go to www.arduino.cc/en/Main/Software and download the Arduino software compatible your OS. Install the IDE software as instructed.
- Run the Arduino IDE and clear the text editor and copy the following code in the text editor.
- Choose the board in tools and boards, select your Arduino Board.
- Connect the Arduino to your PC and set the COM port in tools and port.
- Press the Upload (Arrow sign) button.
- You are all set!
#include "SIM900.h"
#include "SoftwareSerial.h"
//#include "inetGSM.h"
//#include "sms.h"
//#include "call.h"
//To change pins for Software Serial, use the two lines in GSM.cpp.
//GSM Shield for Arduino
//this code is based on the example of Arduino Labs.
//Simple sketch to communicate with SIM900 through AT commands.
//InetGSM inet;
//CallGSM call;
//SMSGSM sms;
int numdata;
char inSerial[40];
int i=0;
void setup()
{
//Serial connection.
Serial.begin(9600);
Serial.println("GSM Shield testing.");
//Start configuration of shield with baudrate.
//For http uses is raccomanded to use 4800 or slower.
if (gsm.begin(9600))
Serial.println("\nstatus=READY");
else Serial.println("\nstatus=IDLE");
};
void loop()
{
//Read for new byte on serial hardware,
//and write them on NewSoftSerial.
serialhwread();
//Read for new byte on NewSoftSerial.
serialswread();
};
void serialhwread()
{
i=0;
if (Serial.available() > 0) {
while (Serial.available() > 0) {
inSerial[i]=(Serial.read());
delay(10);
i++;
}
inSerial[i]='\0';
if(!strcmp(inSerial,"/END")) {
Serial.println("_");
inSerial[0]=0x1a;
inSerial[1]='\0';
gsm.SimpleWriteln(inSerial);
}
//Send a saved AT command using serial port.
if(!strcmp(inSerial,"TEST")) {
Serial.println("SIGNAL QUALITY");
gsm.SimpleWriteln("AT+CSQ");
} else {
Serial.println(inSerial);
gsm.SimpleWriteln(inSerial);
}
inSerial[0]='\0';
}
}
void serialswread()
{
gsm.SimpleRead();
}
It’s a Simple sketch to communicate with SIM900 through AT commands.
AT commands are commands for controlling modems. AT commands are actually derived from Hayes Command. All commands AT commands start with AT initially.
Be careful that AT is a prefix that receives a syntax and is not a command name. For example, one of the CMC + CMCAM commands is called AT + CMGS. There is another command called D that is sent to the modem as ATD.
Many GSM, GPRS, Bluetooth and … modules use AT commands for communication with computers and microcontrollers.
You can download all AT commands from the attachment.
Now, to receive information about location, we need to use some special AT commands in order. After connecting to network, use these commant to prepare your modem to get location data.
AT+CGATT =1
It’s for attaching GPRS. Probably, it’s on 1 by default.
AT+SAPBR =3,1,"CONTYPE","GPRS"
AT+SAPBR =3,1,"APN","RCMNET"
AT+SAPBR=1,1
AT+SAPBR=2,1
It’s bearer setting for applications based on IP.
AT+CIPGSMLOC=1,1
Finally, this command gets location, time and date. Notice that for searching the location in google map, you must change (x, y) coordinates order to (y, x).
watch this GIF.
Here are a few suggestions:
- Try to make a tracker system without any GPS modules.
Comments