In this tutorial, we will be using the Ai-Thinker A7 module in GPS mode, presenting some guidelines on how to use AT commands to enable the GPS and get the NEMA information.
- Ai-Thinker A7 module;
- Serial-to-USB converter;
- MicroUSB-to-USB cable;
- Some jumper wires;
- Computer with Putty installed;
Ai-Thinker A7 module and AT commands
Check more information about the module and AT commands in my first tutorial about this.
GPS vs. AGPS
GPS (Global Positioning System) and AGPS (Assisted GPS) are both technologies used for determining the location of a device, such as a smartphone. GPS relies solely on satellites to calculate the device’s position, which can be slower and less accurate in areas with poor signal reception, such as indoors. AGPS, on the other hand, uses a combination of satellite signals and cell tower data to determine the device’s location. This makes it faster and more accurate, particularly in areas where GPS signal strength is weak. In essence, AGPS is an enhanced version of GPS that utilizes cellular network infrastructure to improve accuracy and speed. Overall, while GPS is the foundational technology for location tracking, AGPS provides an additional layer of accuracy and speed that can be particularly useful for applications such as navigation, emergency services, and location-based services.
Using the GPS feature on A7
In this tutorial, we will not be using AGPS so there is no need to use the A7 SIM card slot. You just need to connect your antenna to the “GPS_RF” SMA connector on the module. Connect the USB to Serial converter to the A7 module according to the following image.
Supply power to the A7 module using a MicroUSB-to-USB cable connected to either a computer USB port or other power supply. Connect the USB to Serial converter to your computer and open the Putty terminal. Press the “POWER” button for 2 or 3 seconds, and the red “LED1” should be turned on when you leave it.
Before opening the Putty terminal set your baud to 115200, and the correct COM port to which your converter is connected. First, you need to check if AT commands are working – enter AT” and press Enter key. This should print “OK” which means the correct connection and operation of the module. Second, you need to set the module to GPS mode – enter “AT+GPS=1” and press Enter key, this should print “OK”. After you turn on the GPS/AGPS, default information in NMEA format will be available on GPS_TXD output pin at a 9600 baud rate. To avoid the need for an extra USB to Serial converter we will make this information available on the AT serial port we are already using by using the instruction “AT+GPSRD=5” followed by Enter key. This will start printing the NEMA information every 5 seconds, you can change this acquisition frequency by changing the number “5” in the instruction to a different value.
NMEA (National Marine Electronics Association) is a standard format for GPS data. It is a text-based protocol that defines how GPS devices should communicate their location data to other devices, such as computers or navigation systems. NMEA messages typically include information such as the device’s latitude, longitude, altitude, speed, and time. The format also supports additional data, such as the number of satellites in view and the device’s current heading. The output you see on the Putty terminal is NMEA format messages. As I am indoors doing this test and without a proper antenna I am not getting any values of my position in this example. But if you are testing this you should get useful NMEA messages that you can then convert to useful knowledge about your device location.