The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
Hi,
I've wired up and written a code to read from a EM406a GPS unit and I'm getting messages from it but I don't think I'm getting a fix on any satellites.
The led on the EM406a is staying steady red.
Does anyone have any ideas about what I might try please?
Thanks
public class Program
{
public static void Main()
{
AnalogInput rx = new AnalogInput(Pins.GPIO_PIN_A0);
SerialPort serialPort = new SerialPort("COM1", 4800, Parity.None, 8, StopBits.One);
serialPort.Open();
while (true)
{
int bytesToRead = serialPort.BytesToRead;
if (bytesToRead > 0)
{
// get the waiting data
byte[] buffer = new byte[bytesToRead];
serialPort.Read(buffer, 0, buffer.Length);
// print out our received data
var msg = new String(System.Text.Encoding.UTF8.GetChars(buffer));
Debug.Print(msg);
}
Thread.Sleep(100); // wait a bit so we get a few bytes at a time...
}
Hi, first, it seems there is nothing wrong with your code, your results are valid NMEA sentences. But indeed for some reason you don't get a fix, as can be seen from the second number in the "$GPGSA" message (1 -> no fix). In fact, your device is not "locking" onto any of the satellites, as can be seen from the 3rd number in the "$GPGSV" messages, it is zero, which means no satellites in view.
There are no strong enough signals available where you are. Although your device is based on a very sensitive chipset (SiRF III), GPS signals are extremely weak. If you did your experiments inside, try it again outside with a good clear view on the sky. Usually close to the window should also work, you might not get a fix, but the satellite in view count should go up a little. Notice that some windows may contain some coating that block GPS signals, I had that happen in an office building, it also occurs in some cars.
Make sure you keep trying long enough, especially if your device is new and you never had it working properly before (or only in a very different location). It is claimed that the device can do a "cold start" in 42 seconds, I never used this particular device, but this seems overly optimistic to me.
Since it spits out NMEA, I guess you wired it right, but just to be sure, check if you are providing it with 5V, according to the datasheet it needs between 4.5 and 6.5V DC
I hope you get it to work, with best regards, Peter
It is claimed that the device can do a "cold start" in 42 seconds.
Also note there are cases when startup may take several minutes (lost clock drift), and up to 12.5 minutes when the complete GPS almanac has to be downloaded (e.g. if it was lost after factory reset, or copy stored in flash is old and must be renewed).
Thanks Charles and CW2 - I was beginning to think I wasn't going to get it working and would probably have given up if I hadn't got your input. But after 3/4 hr of leaving it running I got a fix and some readings!
Cheers
It was in my living room - not near the window (I was going to try that if needed as suggested earlier).
So when I get a chance to try again one evening I'll see if it locks on a lot faster next time in the same place in the living room, as CW2 said that it may have needed to get all updated with the almanac...
What I need to do now is check the coords are accurate and that its giving correct readings.
Thanks all.
Hi,
is seems to me that I'm getting an incorrect reading for Longitude (not just within the margin of error you expect for GPS) but the Lat seems OK.
Can anyone suggest ideas for debugging this please?
Thanks
You definitely need to be outside or at the very least near a window.
I had problems with longitude and it turned out to be a NETMF bug in double.Parse for numbers between -1 and 0, e.g. double.Parse("-0.3") returned +0.3. Living near the meridian meant this causes some odd problems for my GPS project. I hope this has been fixed in 4.2 but I haven't checked.
I agree with Fred, if possible, try to do your experiments outside, but at least close to a window (if you are in the Northern hemisphere, preferably a southward facing window), and when you are satisfied with the results you could try to move away from the window and see if it still works.
I dont' think the parse bug is biting here, as it seems he is not parsing anything, just reading and displaying NMEA output generated by the receiver. Could you post a couple of NMEA lines (including GGA, GSA and GSV) when the receiver has a fix, that might help to help you debugging.
With best regards, Peter
Hi Stan,
When I interpret your data, it puts you in the backyard, very close to the last house on Southland drive, on the south side of Lincoln in the UK (according Google Earth). If that is correct, you are probably misinterpreting the data. If that is not correct, we need to dive deeper.
From the GGA string, your latitude appears to be 5311.8127,N, that has to be interpreted as 53 degrees, and 11.8127 minutes. That is a bit weird way of putting it, more common would be either decimal degrees (53.1968783 degrees) or in degrees, minutes and seconds (53 degrees, 11 minutes, 48.846 seconds). The same goes for the longitude, 0 degrees, 34.2949 minutes west of Greenwich, which would be 0.57158167 degrees west, or 0 degrees, 34 minutes and 17.691 seconds).
Interpreting the latitude incorrectly as 53.118127 would put you indeed about 10 miles more south, 40 miles to the east means either you or your receiver also has the east/west mixed.
I hope this helps, with best regards, Peter