When you start developing a GPS solution, you have to deal with energy and for this you have to create a strategy based on what you expect and the size of your battery.
Basically, a GPS is consuming about 25mA when running. An active antenna will consume about 10mA more. The first time you start it, it have to sync with the satellites, get the ephemeris then you can position in 2D then in 3D.
Read more for more information
Getting in touch with satellites
For localization, the device are listening on GNSS (Global Navigation Satellite System) aka GPS, GLONASS … constellation. There are two main phase : the first fix and the next one. the first fix required to have a better signal quality than on tracking and to receive different informations from the satellites.
So the first time you try a sync with the GNSS you need to get ephemeris from at least 4 satellites. Each satellites send ephemeris every 30 seconds. Ephemeris is composed by 3 frames of 6 second each. To get the data the signal must not go below the GPS chip sensitivity during the transmission. For TD1204, the cold start sensitivity is -148dB.
The minimum time to get a sync is 3×6 = 18 second but as you can’t anticipate when the ephemeris transmission will start, it can be up to 30+18 seconds. When the signal quality is not good, you can miss some frame and have to wait for 30 second more each time. To be more precise, the satellite send 5 frame of 6 seconds (5*6=30s) but actually we don’t need the 2 last anymore.
The GPS chip is capable to listen on a certain number of frequencies in parallel. If it have only one channel and as you need at least 4 satellites to position, it means you need a minimum of 4x30s = 2 minutes to get in sync. Actually GPS chips are capable to listen on many channels in parallel to get enough ephemeris at once. The TD1204 sounds to be capable to get up to 7 in parallel.
Once the ephemeris have been downloaded, they are valid for these satellites for the next 4 hours. You can sleep and get a quick fix. If you sleep more than 4 hours it is like a cold start.
During these 4 hours, you should be in sync, but you will never be sure that the next satellite you will have in view will be the same as the previous one and if you don’t have all the last 4 one, you will need to get the ephemeris of the new one before being able to fix. That is why a hot fix can be fast (you already know the satellites) or slow (you have new satellites to sync with).
If you are lucky, the same satellites are in view and you are in sync, the fix duration can be 1 or 2 seconds. For the positioning, once synchronized, the required sensitivity is generally lower. For example on TD1204 chip, when you need at least -148dB during the cold start, you only need -162dB/-160dB on tracking/reacquisition.
There are about 32 GPS satellites around earth, each of them have a rotation cycle of 11:58:02 (1 sidereal day) ; this means that after 4 hour you have not a lot of chance to continue to receive the same satellite that is near to be at the opposite of you on earth. This means that regularly you must listen on satellites sufficient time to get the new ephemeris from the new satellites.
You can eventually use different satellites constellations because of your location / choice but actually it seems that most of the chip have a better use of GPS as it is the oldest one and the one on which providers are the more experienced. Depend on the chip you are using, you can be able to choose between constellation of to use different altogether. This last option can help to get more precision by using more satellites but this will also consume more power. So in IoT it seems better to choose one constellation only.
How to get synchronized faster or longer ?
As the GNSS is needing ephemeris, on first start / regularly, the system must maintain these data, receive some new and so one. This can be accelerated by loading these ephemeris from a network or a file.
There are two type of solutions:
- Online : the system is connected to a network and every time it is needed it gets the ephemeris from a central server. This avoid the first time sync. The validity is generally 4 hours.
- Offline : the system load a larger file with ephemeris valid for today and up to 1 month. The file is bigger but the refresh rate is lower.
Both of these solution requires a network connectivity. For IoT domain with sigfox connectivity is is not possible to upload ephemeris that way. These solution are not really valid. eventually the second one could be deploy with a bluetooth gateway is the object cross a cellphone in a given month … but sound not a standard use-case
There is another solution that is not helping for the cold start first fixing but that can help to optimize the ephemeris management. The autonomous mode allow to predict ephemeris with an on-chip computation. Basically this can gives valid ephemeris for the next 3-4 days. This could be a good way to avoid too many ephemeris download but older is the initial ephemeris, worst the precision will.
It exists some other possibilities : a french startup (at least) Ubiscale propose to use a short message received from the GPS satellite to be decoded by the central infrastructure they own. They return you the object location. This requires a modified GPS chip firmware and to pay for the service but it allows to obtain a location of the object not having to obtain ephemeris.
What is impacting the precision of the localization ?
The precision depends mainly on the position of the satellites. The wikipedia page on Hdop have a nice illustration of this :
In this configuration, satellites angles are large and satellites are far away of each others, the precision of the measure will be nice.
This is generally the case when the antenna have a full access to the sky with nothing blocking the signal in a direction.
Here the HDOP value should be around 2.00
At the opposite, when the satellites angles are small, all the satellites are in the same area and the precision is not good.
This can be related to location you are. As an example if you have big building around you may have a small part of the sky in view and the satellite you could see could be all in the same area. The HDOP will not be good ; something like 5.00
HDOP doesn’t means the coordinate you get is wrong, it means that we can’t be sure of the given value.The best way to get a good hdop is to have a large opening to the sky and be in sync with many satellites. If you only have sync with 4 of them, you will be limited to the position of these 4 and if they are near, the hdop will be bad. Eventually you can take more time in your fix, waiting for them to be far away.
There are some other reason to get a wrong coordinate. The main one is reflexion : we you have a lot of mountains, building, the signal doesn’t directly go to the receiver be jump from the building to the receiver. This adds time in the transmission and change the location. This can’t be identified easily.
The quality of the reception is also a key point, it depends on the antenna you are using. larger is is and better it sounds. For example a small 12×13 antenna can provide a 15 meter precision when a 20×20 can help to have 5 meters… The ground plane around the antenna is also a key point.
Some antenna have a gain that also help to compensate loss & co. An antenna with a gain of 20-26dB will be a great help for precision.
What king of information can we get from a TD1204
TD1204 is based on a Ublox 7 serie chip for the GPS part. Some of the information are accessible in the sdk to understand what is happening:
The TD_GEOLOC_Fix_t structure have most of the information in it ; this structure is updated at each GPS cycle.
- hard.rtc_calibrated – indicates that the TD1204 rct clock is in sync with the GPS system
- fix->sats.usabled gives in real time the number of stats usable for fixing
- sats.sv_info structure contains the satellites current status:
- channel_count : list how many channel are activ
- channels[] : gives details for each of them
For each channel we have the information about the corresponding satellite :
- svid : is the satellite id (1 to 32 for GPS) / (65-96 for GLONASS)
- level : is the signal strength / Carrier to noise ratio in dBHz
- With a level >= 30 you can receive ephemerids
- With a level >= 15 you can position once ephemerids are good.
- quality : indicated the link status with the satellite
- 0 – idle
- 1 – searching for satellite
- 2 – signal acquired
- 3 – signal detected not yet usable
- 4 – locked on signal
- 5 – 6 sound like loading ephemeris (not sure)
- 7 – ephemeris are loaded for this satellite (not sure)
Unfortunately once the ephemeris have been loaded, when you stop the chip and start it again, even if it have the ephemeris still valid, the quality goes back to 0,1,2… and this is not a usable way to have an idea on what satellites are usable or not. So the other way to do it is to look at the flags field. If you mask the flag with 8 and get non 0, it means the ephemeris is valid for this satellite.
Then we have some information about the quality of the positioning:
- fix->quality.sat gives the number of satellites used for position determination
- fix->quality.hAcc gives the precision in meters of the positioning
How to preserve energy
Ublox-7 chip have optimized automatic mode ; basically two modes depends on the frequency requested:
- Cyclic tracking operation : this mode allow automatic fixes between 1s and 10S. In this mode the system never stop but switch to a low power tracking mode and keeps the signal valid automatically.
- ON/OFF operation : this mode allow automatic fixes over 10 seconds. In this mode the device switch from a sleeping mode to a startup/nav mode. In this mode the acquisition time is maximized by a timeout. One of the main issue in my point of view is that is you have no signal you continue to listen until timeout and that can be a long time… basically > 40s to get a first fix… In this mode on every wake up the GNSS switch back to a acquisition mode (power consuming).
In these mode, the ephemeris are kept updated automatically on a 30 minute schedule basis or eventually sooner if the number of usable ephemeris decrease.
RTC synchronization is a keypoint for a quick fix but it have to be re-sync every 5 minutes that could create extra consumption.
Fantastic write up, thanks!
Is this part one? A bit of an intro?
I hope that you dig in a little more to the IoT side of GPS. Tracking ‘things’ is going to be an important part of IoT.