Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Heading Indicator

Bazeo

New Member
Hi All, I’m looking for some advice if possible. I have a plan to develop a true heading indicator for a bit of static equipment. I’ve opted for the Novatel Pwrpak7D which is a dual antenna gps receiver. What I’d like advice on is how to take the true heading data out from the module and display on a 4 digit 7 seg display (heading in degrees to one decimal place). After a bit of research, it seems an Arduino or Raspberry Pi single board computer would be a suitable interface, but to be honest, I’ve no experience at all with either of these (or other brands) so I'm a bit in the dark. Am I on the right track with this, or is there a better way? Any advice would be greatly appreciated. Thanks
 
A normal GPS receiver does not provide heading information - that's derived in software from movement.
With a static item, no movement means you cannot use that system for heading.

A dual antenna system can provide heading, as long as the antennas are far enough apart - several metres for any kind of even rough accuracy to a few degrees.

For the antennas to be closer you need to be using RTK with correction data to the GPSs from a separate RTK base station. The receiver you mention requires RTK for accuracy.

Without an RTK system, accuracy would be 50 - 100 times lower, for any given antenna separation.


The easiest way I know is to use a magnetometer IC, which can provide orientation data relative to magnetic North - that's how the compass display in a mobile phone works.

Modules combining that with gyro and accelerometer are readily available, used for drones and robotics etc.

There is an Arduino library to use those, as well:
 
That GPS receiver appears to be able to produce a heading signal, as long as the two antennas are far enough apart.

https://docs.novatel.com/OEM7/Content/Logs/GPHDT.htm

The receive will transmit an GPS string, such as the example on the page I linked to:-

$GNHDT,75.5554,T*45

That GPS string could be received by an Arduino and then displayed. Arduinos can be programmed from a PC with just the Arduino IDE installed on the PC and a USB lead

The RS232 output of the Novatel Pwrpak7D would need to have the levels shifted to 0 - 5 V to connect to the Arduino, with something like this:-
https://www.sparkfun.com/products/449

I have received data from GPS receivers like this:-

1. Wait for a character.
2. Is the characters "$"? If not, discard and go back to 1
3. Wait for a character.
4. Is the character "G"? If not, discard and go back to 1

(etc for all the fixed bit of the string, in this case "$GNHDT,")

100. Set the heading as zero.
101. Wait for a character.
102. Is the characters a number? If so, multiply the previous value by 10, add the number and go back to 101.
103. Is the character a decimal point? If so, move on to storing the fractions of a degree.

and so on.

There are probably lots of examples of running displays from Arduinos, but without knowing what sort of display you want to use, it's not easy to say how to drive it.

You will need to break down the task into many sub-tasks. The smaller you can get the sub-tasks, the better as you will know what you have done right and what you have done wrong. My suggestion would be something like this:-

Get the arduino to flash a light. They have a small LED built in so that is no hardware at all to get that to work.
Connect the RS232 and level converter.
Make sure that the data bursts are arriving at the Arduino. An oscilloscope is best, but even a multimeter can be used to see the idle voltage of 5 V for most of the time, and regular dips from that as the data arrives.
Set up the RS232 reception in the Arduino. Program the Arduino to flash the light when anything is received, which is usually bursts of data once a second for GPS receivers.
Program the Arduino to flash the light when a "$" is received. Check that it is still flashing as bursts once a second.
Program the Arduino to flash the light when "$G" is received. Check that it is still flashing as bursts once a second.
Program the Arduino to flash the light when "$X" is received. Check that is isn't flashing.
Program the Arduino to flash the light when "$GNHDT" is received. Check that it is still flashing as bursts once a second.

and so on.

The Novatel Pwrpak7D looks expensive. I'm not sure if an Arduino and some home-made interfaces would be the best way to go forward with that.

You could also buy a cheap GPS receiver to see what you can get to work, even though a cheap one won't do heading on its own.

The simple GPS receivers often use the 0-5V version of RS232, so you don't need a level converter to connect them to an Arduino.
 
Thanks both, really useful info. The antennas will be separated by 4m and if I get a 1 degree heading accuracy I’ll be happy. I’m having to steer away from a magnetometer due to the amount of metal around the equipment affecting the magnetic heading. I’ve used compasses, prismatic compasses and mobile phones but the results can be wildly different, so the location seems really susceptible to external influences. I inherited the PwrPak from another project which I’d like to put to use but I think I’ll find a cheaper gps receiver while I find my feet with this. Is the Arduino-type board more of a prototype tool to develop bespoke designs, and by that suggestion, not suitable for use in the long-term solution? The end goal is to provide an easy to read panel-mounted display on the side of the kit giving its heading in degrees.
 
The antennas will be separated by 4m

With the GPS system alone at 4m antenna separation, you would very lucky if you got accuracy with ten degrees.

That's if it is capable of accuracy to within a foot?

It's only the RTK capability that allows for high accuracy (centimetre level), by using a fixed reference station to provide phasing and correction data.



A suitable Arduino-compatible module socketed on to stripboard should be fine for a one-off permanent system. Just don't use plug-in prototyping boards for other than short term testing and experimentation, they are not particularly reliable.

A couple of my one-off builds as examples; most of the interconnections are on the back of the board, made using thin single strand wire (wire-wrap wire):-

This does not have a display, just switch control:

IMG_1545.jpg



This one has a graphic LCD, hidden behind the stripboard:

IMG_1546.jpg


Neither used an Arduino branded module, the upper one uses an STM32 "Blue pill" clone and the lower an ESP32 devkit module. These are far faster and more powerful, with much more memory, than most Arduino modules - but the can be programmed using the Arduino IDE.

The blue pill clones are also very! cheap.
 
With the GPS system alone at 4m antenna separation, you would very lucky if you got accuracy with ten degrees.

That's if it is capable of accuracy to within a foot?
Most GPS receivers are nowhere near that good. A "high precision" one from Ublox quotes about 2.5m without RTK. Finding the angle from a 4 m baseline is difficult.

However, that Novatel Pwrpak7D may do something clever to look at differences between to antennas and give you much better angle accuracy.
 
a true heading indicator for a bit of static equipment
Welcome to ETO!
I'm puzzled as to why you want to know the heading of something that is static?
 
However, that Novatel Pwrpak7D may do something clever to look at differences between to antennas and give you much better angle accuracy.
That's what I was thinking as a possibility, as it would only need the position difference between its two antennas to calculate a bearing, rather than two completely independent positions.
Either way, it's not going to give any practical accuracy without RTK.
 
That's what I was thinking as a possibility, as it would only need the position difference between its two antennas to calculate a bearing, rather than two completely independent positions.
Either way, it's not going to give any practical accuracy without RTK.
I'm not sure about that.

GPS works by calculating the time differences between pairs of signals. When the receiver measures the time difference between two signals from different satellites, that tells the receiver how much closer it is to one satellite than the other.

The errors come from the fact that the two paths go through completely different bits of the atmosphere.

RTK helps by having a base station in a known position, but reasonably close, so that those errors can be accounted for.

If there are two antennas connected to one receiver, the receiver would be able to measure the time difference between the two antennas, and calculate how much closer one is to the satellite that it is receiving. The errors due to different bits of the atmosphere, which are the errors that RTK helps cancel out, don't matter in that case because the two antennas are only metres apart.

All it needs is two satellites in view, one to give the north-south difference and one the east-west difference. Obviously they won't line up exactly like that.

Also, satellites that are close to overhead won't be much help in determining the heading, as the signal paths will be similar lengths. That is a similar problem that GPS has when measuring altitude. If all the satellites in view are close to overhead, if the receiver moves up, all the path lengths shorten. The receiver works from time differences, and there is little change in the differences, so the altitude cannot be accurate. If some satellites near the horizon are visible, it improves the altitude accuracy a lot.
 
I read many years ago about an aircraft system that used GPS receivers to get the attitude/heading of an aircraft. It relied on the fact that all receivers would have the same error so the difference was accurate. I think there is a mode that doesn't estimate the error which is what would be required.
Would this be the same?
A quick google finds, GNSS receiver.

Mike.
P.S. wish I could find that article. Think it was in UK Flyer magazine.
 
I don't know if that is the same thing.

I do know that GPS receivers don't have accurate clocks in them, which is why all timings have to be relative.

That receiver you linked to is somewhat less accurate in height than it is in position. As I understand it, the reason is that height needs signals from satellites nearer the horizon, so the signals have passed though more of the atmosphere so the timing error will be worse.

The heading accuracy of the receiver you linked to is 0.3° RMS with a 1 m baseline. That does not seem to have any other conditions applied to it, and I think that the receiver is simply measuring the difference in arrival times for a signal between the two antennas.

The OP was looking at a 4 m baseline, so 0.1° RMS may be possible.
 
The linked item also contains mems devices so is probably keeping a Cosine Direction Matrix to better estimate position and heading. I've always wanted to play around with a Cosine Direction Matrix but never got around to it.

It's been so long since I read about CDMs that they're probably old hat now and there's a completely new way to do it.

Mike.
 
The OP was looking at a 4 m baseline, so 0.1° RMS may be possible.

Indeed - apparently this is the option it uses, which it seems is included in that device:


It looks like it uses one half as it's own RTK base, and measures the position of the other antenna relative to that, for heading calculations.

Very impressive! It does look like it will easily do what he wants!
 
The Novatel agent was clear that the unit would do what I wanted, but I like to get a second opinion, as it were.
I'm puzzled as to why you want to know the heading of something that is static?
It’s for a RPAS launch rail. Most of our systems use GNSS-derived track aided by magnetometer in flight, but require a known heading input pre-launch. The accuracy of a compass is usually good enough for this as the nav systems use Kalmann filtering as soon as the RPAS is launched, but if the error is too great, we suffer problems.

rjenkinsgb, neat work. I haven’t used wire-wrapping since my apprenticeship, good to see the art is still alive.

Thanks again for taking the time to answer folks, a lot of great information.
 
I haven’t used wire-wrapping since my apprenticeship, good to see the art is still alive.
Although I still do use wire wrap quite a bit, it's only the wire, soldered, on those, as I have large quantities & I find it very convenient for things like that.

This is a recent wire-wrap one, a CPU card for an STE-bus system:
IMG_1381.jpg


Back on topic:
That Novatel unit is very neat, I've never seen anything like that before which is why I was dubious about its capabilities.
Having found the found the info on how the heading part works though, the absolute position accuracy that was making me sceptical just does not come in to the equation; only the relative position of the second antenna to the first matters.
 
I am using a GPS Module with Ceramic Antenna for DIY Handheld Positioning System.

Without moving, the Latitude & Longitude numbers go up and down independently. It seems like it is wandering around but stays within a 25 feet diameter circle. I guess that is pretty good trying to triangulate my location from 3 or more moving objects in space.

That is not good enough for GPS controlled lawn mower.
It does a pretty good job at speed & heading.

I live about 15 miles from an airport but sometimes I am in the flight path. Someone said an airplane may have caused this issue.

I got another one to test and compare.
Dual GPS readings wandered independently by 0.00420 minutes or more of longitude, which I calculate to about 25 feet.
Plots 1 2 3.jpg
 
That is not good enough for GPS controlled lawn mower.
It does a pretty good job at speed & heading.

Differential GPS will give a moderate improvement - but setting up an RTK base on your property, with an RTK compatible system on the mower (such as the one used in Openmower) should give accuracy to a few centimetres at worst.

I was already using an NTP setup with a Raspberry Pi plus ublox GPS in the loft, and that could handle the RTK Base software and still function for NTP. I have it fed from a marine-style GPS antenna mounted at the back of the house roof.


It gets a good range satellites - typically around this:

RTK_Base_Sats.jpg


I'm still working on the mower itself, though - the one I got off ebay to base the build on had a different control panel, so I needed to make a PCB and still have to do some testing & software mods for that..
 

Latest threads

New Articles From Microcontroller Tips

Back
Top