Table of Contents(5)
Overview
GPS modules communicate with each other using UART (Universal Asynchronous Receiver/Transmitter), a widely used hardware communication protocol for serial communication between devices.
Serial Communication is a data transmission method where data is transmitted sequentially bit by bit, typically over a single data line. Serial communication is used in many communication and data transfer scenarios, especially suitable for long distances or low bandwidth requirements. Baud rate measures the speed of serial communication, defined as the number of symbols transmitted per second. In digital communication, a symbol may represent one or more bits. The baud rate is an important parameter because it determines how fast data can be transmitted over the communication link. The choice of baud rate depends on several factors, including the quality of the transmission medium, communication distance, and noise levels in the system. For instance, using a lower baud rate can slow down data transmission but might improve reliability, as lower speeds generally mean lower error rates. Conversely, a higher baud rate can increase data transmission speed but might require higher quality transmission media and more complex error detection and correction mechanisms.
Components and Supplies
Wiring
# | GY-NEO6MV2 | Arduino UNO R3 |
1 | VCC | 5V |
2 | GND | GND |
3 | TX | 2 |
4 | RX | 3 |
Arduino UNO R3, a popular open-source hardware platform based on the ATmega328P microcontroller, comes with a hardware serial port (UART) implemented through onboard pins 0 (RX) and 1 (TX). The information seen in the Arduino IDE serial monitor is sent out through this hardware serial port.
In this experiment, our goal is two-fold: to communicate with the GPS module via the serial port and display data from the GPS module in the Arduino IDE serial monitor. Since the Arduino UNO R3 has only one hardware serial port, we need to create an additional serial port to achieve this goal. This is where “Software Serial” comes into play.
Software Serial is implemented through Arduino programming, allowing us to use ordinary digital input/output pins as additional serial communication ports. Although software serial communication is not as fast as hardware serial ports, its maximum rate can reach up to 115200bps, which is sufficient for many applications. Considering that our GPS module typically uses a baud rate of 9600bps, software serial is entirely adequate. Therefore, with software serial, we can achieve communication with the GPS module and display data in the serial monitor simultaneously.
Code
Result
Please take the GPS module to an open outdoor area with the antenna facing the sky. The first time you use the GPS module, it needs to download the almanac data (i.e., the orbital information of the satellites) from the satellites, which can take 5 to 30 minutes. Cloud cover can significantly affect the time required.
We open the Arduino IDE serial monitor, set the monitor’s rate to 9600bps, and observe the results: