In this tutorial, we will integrate Surilli GSM with NEO 6M UBLOX GPS Module. By integrating this hardware, we will get the required values of longitude and latitude of any location under the condition that the signal strength of that particular location is very strong. A low signal strength will not show any values of both longitude and latitude.
What Is GPS?The Global Positioning System (GPS) is a satellite-based navigation system made up of at least 24 satellites. GPS works in any weather conditions, anywhere in the world, 24 hours a day, with no subscription fees or setup charges.
How Does GPS Work?GPS satellites circle the Earth twice a day in a precise orbit. Each satellite transmits a unique signal and orbital parameters that allow GPS devices to decode and compute the precise location of the satellite. GPS receivers use this information and trilateration to calculate a user's exact location. Essentially, the GPS receiver measures the distance to each satellite by the amount of time it takes to receive a transmitted signal. With distance measurements from a few more satellites, the receiver can determine a user's position and display it.
To calculate your 2-D position (latitude and longitude) and track movement, a GPS receiver must be locked on to the signal of at least 3 satellites. With 4 or more satellites in view, the receiver can determine your 3-D position (latitude, longitude and altitude). Generally, a GPS receiver will track 8 or more satellites, but that depends on the time of day and where you are on the earth.
Once your position has been determined, the GPS unit can calculate other information, such as:
- Speed
- Bearing
- Track
- Trip dist
- Distance to destination
GPS satellites transmit at least 2 low-power radio signals. The signals travel by line of sight, meaning they will pass through clouds, glass and plastic but will not go through most solid objects, such as buildings and mountains. However, modern receivers are more sensitive and can usually track through houses.
NEO-6M GPS Module:The NEO-6M GPS module is shown in the figure below. It comes with an external antenna, and does’t come with header pins. So, you’ll need to get and solder some.
- This module has an external antenna and built-in EEPROM.
- Interface: RS232 TTL
- Power supply: 3V to 5V
- Default baudrate: 9600 bps
The module only uses 4 pins: VCC, GND, RX, and TX. This is because these modules communicate over a simple serial RS232 connection.
Download and Install Required Libraries for GPS to Work in Arduino IDE:1. SoftwareSerial Library. (This library will appear in the list of libraries after you have successfully installed the Surilli GSM Board).
2. TinyGPS++ Library (Download this library from the link: http://arduiniana.org/libraries/tinygpsplus/)
Note: After downloading the library, add the library in Arduino IDE software by going to: Arduino IDE --> Sketch --> Include Library--> Add.zip library and then select the library from the path where you have downloaded the library. After selecting the library, a message will appear on the bottom of the software indicating that the library has been added to the Arduino folder in "Documents".
Components Required:1. Surilli GSM
2. NEO 6M UBLOX GPS Module
3. Connecting / Jumper Wires
4. Arduino IDE Software
Connections between Surilli GSM and NEO 6M UBLOX Module:Surilli GSM : NEO 6M UBLOX Module
GND PIN --> GND PIN.
USB (5V) PIN --> VCC PIN.
PIN 10 --> TX PIN.
PIN 11 --> RX PIN.
STEP 1: Set Up Arduino IDE for SurilliMake sure you have selected the right port, board and processor for the Surilli and it is programmable (compile and upload “Blink” from File>Examples>Digital>Blink onto your Surilli to check if everything is working fine). If it is working fine, then you are good to go. Otherwise check you port, board and processor.
STEP 2: The CircuitryThe circuitry is very simple. Follow the figure below to set up your hardware.
Now you have completed setting up your hardware and Arduino IDE. Copy and paste the Arduino sketch given below into your Arduino IDE and hit upload.
Arduino Code:#include <TinyGPS++.h>
#include <SoftwareSerial.h>
TinyGPSPlus gps;
SoftwareSerial serialgps(10,11); //pin 10 Tx GPS -- pin 11 Rx GPS
void setup()
{
Serial.begin(9600);
Serial.println("GPS6MV2");
Serial.println(" ---TEST CODE--- ");
Serial.println("");
serialgps.begin(9600);
delay(200);
}
void loop()
{
Serial.begin(9600);
serialgps.begin(9600);
while(serialgps.available())
{
int c = serialgps.read();
if(gps.encode(c))
{
float latitude, longitude;
latitude = (gps.location.lat());
longitude = (gps.location.lng());
Serial.print("Latitude/Longitude: ");
Serial.print(latitude,5);
Serial.print(", ");
Serial.println(longitude,5);
delay(100);
Serial.println();
}
}
}
Results:The values obtained can be observed on the Serial Monitor as follows:
Play with the program to see how it reacts to different values and logic.
If you make something funny and interesting do share it with our community.
That’s all for now. If you have any queries, visit our website surilli.io or contact our support. Stay connected with Surilli family for more amazing stuff. :-)
Comments