Make Your Own GPS Transmitter with the HC-12 Transceiver
The first article in this two-part series, Understanding and Implementing the HC-12 Wireless Transceiver Module, uses the HC-12 to create long-distance data transmission between two Arduino Unos. This article uses a pair of HC-12 transceivers, a GPS module, an Arduino, and Google Maps to create a very simple tracking device.
|HC-12 transceiver (x2)||$4||Datasheet|
|or Adafruit GPS Logger Shield||$45||Project Guide|
|Arduino Uno R3 (or compatible)||$45||Reference|
Part one of this two-part series discussed the HC-12 transceiver module and described how to hook it up to an Arduino and a power source.
In this article, we will create a remote GPS receiver that can be used to track nearby items without using a cellular network.
For further information on the transceiver module, please see the HC-12 datasheet (PDF).
Adding and Transmitting GPS
The Global Positioning System (GPS) allows users to accurately determine the location of objects on or above the surface of the Earth. Both of the GPS receivers listed at the top of this article transmit National Marine Electronics Association (NMEA) sentences that provide information that includes latitude and longitude, altitude, time, bearing, speed, and a great many other variables at 9600 baud.
The HC-12s can transmit the information from a GPS receiver with no additional programming or circuitry.
You can transmit GPS coordinates to remote locations with as little as a GPS receiver, an HC-12 transceiver, and a battery. Remotely transmitted coordinates would have to be received by another HC-12 transceiver and then processed with a microcontroller or computer.
A simple setup such as the one above would allow you to create a small remote object tracker; it will alert you if the object leaves a predefined area, and then you will have a certain amount of time to track the object before the transmitter goes out of range. You could use this with a vehicle, a pet, or even—if you are concerned about theft—the giant pumpkin that you are growing for the state fair.
If you are in an area with clear line of sight, the transmitters will broadcast up to one kilometer, which is a 15-minute walk (or 5-minute run). The maximum range in urban areas will decrease but should remain adequate to alert you if your luggage is leaving the train station without you, or let you know where your dog ventures when he escapes from your yard.
We can refine this project by passing the GPS data to an Arduino instead of directly to the HC-12. Then, only selected strings can be transmitted to the HC-12. This is useful if you want to increase the range of the HC-12 communication by decreasing the over-the-air baud rate.
The $16 SparkFun GPS module has a default transmission rate of 9600 baud, and this corresponds to an over-the-air rate of 15000 baud. Sending the 9600 baud GPS data to the Arduino and then transmitting only selected information to the HC-12 at 2400 baud will reduce the over-the-air rate to 5000 baud. According to the datasheet, this improves receiver sensitivity by at most 5 dB, which provides a modest increase in range.
The GPS shield from Adafruit, which is significantly more expensive, can be programmed to transmit select sentences at all standard baud rates.
This is an example data transmission from the receiver to an Arduino. You can decode your own strings with this online tool.
Arduino libraries exist that enable decoding of NMEA sentences into the latitude & longitude pairs below:
|Type||UTC Time||Position||Speed||Altitude||HDOP, VDOP, PDOP||Satellites|
|RMC||2016-09-20T21:01:54Z||33°58’53.38”N, 117°56’20.03”W||0.824 knots|
|GSA||1.67, 2.66, 3.15||5|
RMC (recommended minimum information), GGA (3D location and accuracy), and GLL (latitude and longitude) all include latitude, longitude, and time. GGA provides altitude, and GSA provides the dilution of precision of the reading (lower numbers indicate greater precision).
The following program is backward-compatible with the two programs presented in part one. It reads the NMEA sentences sent by the GPS to the Arduino, discards all but the selected sentence, and transmits the selected sentence to a remote Arduino when requested. It works with either the SparkFun GPS receiver or the Adafruit GPS logger shield, as shown below. This program allows users to remotely “ping” distant transceivers to determine their location.
Read More: GPS Transmitter with the HC-12 Transceiver
This Post / Project can also be found using search terms:
- Arduino gps module based project
- gps and arduino related projects list