Arduino Interfacing with GPS sensor diagram,working,code
This app note covers Arduino Interfacing with GPS sensor diagram and its working. It describes GPS sensor used and mentions arduino code.
Introduction:
GPS is the short form of Global Positioning System. The GPS system consists of space segment,
user segment and control segment. Space segment contains satellites located in the orbit at
about 12500 miles over the Earth. These satellites travel twice in 24 hours.
User segment refers to GPS signal receiving devices.
Control segment refers to command, control and monitoring stations.
About GPS sensor
GPS satellites transmit on several frequencies simultaneously.
One such frequency known as L1 (1575.42 MHz) is used for civilian applications
where as the other frequency L2 (1227.6 MHz) is used for military applications.
Refer GPS and GNSS frequency bands >> for more information on
gps and gnss frequencies.
GPS sensor consists of chip with rectangular antenna which processes GPS satellite signals
for determining its position i.e. latitude and longitude.
Refer ACADEMIC.
GPS sensor module requires DC supply for its operation. It starts outputting data as soon as it identifies the satellites within its range. The data follows plain ASCII protocol known as NMEA protocol. The transmission rate is either 4800 bps or 9600 bps and uses {8 bits, no parity, 1 stop bit} for decoding. The data blocks are known as sentences which are of about 80 characters in length. Refer GPS Sentences >> for more information.
Following are the specifications to be considered while purchasing GPS sensor.
• Sensitivity in dBm
• Time to First Fix (It is measure of time required for GPS receiver to acquire satellite signals and navigation data and calculate position solution (called "fix").)
• Number of channels to be sensed by GPS receiver chip.
• Form factor of the chip
• Power consumption in mWatts
• Update Rate (Number of position measurements per second)
• Output type
• Supply voltage
• Current consumption
About Arduino board
• Arduino Uno houses ATmega328 microcontroller from ATMEL. This microcontroller contains flash memory (32 KB), RAM (2 KB), 8 bit wide CPU and 1 KB EEPROM.
• It also supports 6 analog pins which reads voltage and not current. Inside, it converts analog measurement to digital for various purposes.
It supports digital pins (0 to 13) which can function either as input or output.
• It has various interfaces viz. I2C, digital pins, analog pins, serial communication, USB etc.
• It also has reset pin, power port, crystal oscillator and Tx/Rx LEDs.
• This open source prototype board can be easily programmed using easy to use arduino IDE and USB interfaced between
laptop PC and arduino board.
• IDE uses simplified C++ program.
• Board requires 5V DC which can be powered using AC/DC adapter or battery.
Arduino Interfacing with GPS sensor diagram and its working
One can interface GPS sensor with microcontroller board or arduino or ESP32 in order to acquire its data for further analysis/processing.
The figure shows one such interfacing of arduino with GPS sensor model number GY-GPS6MV2.
Arduino GPS sensor interface code
Following is the arduino code compiled and uploaded to the arduino board using Arduino IDE. The code outputs GPS data read from sensor to "Serial Monitor" window of arduino IDE. One can go to "Tools" and click at "Serial Monitor" to open this window. One can also write the code to upload the data to cloud server for further analysis.
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
//The serial connection to the GPS device SoftwareSerial ss(RXPin, TXPin);
void setup()
{
Serial.begin(115200);
ss.begin(GPSBaud);
}
void loop()
{
//Output raw GPS data to the serial monitor
while (ss.available() > 0){
Serial.write(ss.read());
}
}
Conclusion: In this application note we have seen GPS sensor interfacing with Arduino Uno board. Arduino board is also used for interfacing different types of sensors for applications. The typical sensors interfaced with arduino are sound sensor, heartbeat sensor, gyro sensor, LDR sensor, color sensor, pH sensor etc.
GPS RELATED LINKS
IoT system on chip tutorial Related Links
Main tutorial IoT section IoT article Cellular IoT Components Sensors INDIAN companies Antenna Types Wireless technologies IoT transceiver SoC