Netduino home hardware projects downloads community

Jump to content


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.
Photo

EM406a not fixing satelites


  • Please log in to reply
11 replies to this topic

#1 stan4th

stan4th

    Member

  • Members
  • PipPip
  • 27 posts

Posted 10 September 2011 - 04:31 PM

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...
            }

SAMPLE OUTPUT
================

$GPGGA,181115.872,,,,,0,00,,,M,0.0,M,,0000*56
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,181115.872,V,,,,,,,080911,,,N*4C
$GPGGA,181116.871,,,,,0,00,,,M,0.0,M,,0000*56
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,181116.871,V,,,,,,,080911,,,N*4C

$GPGGA,181117.872,,,,,0,00,,,M,0.0,M,,0000*54
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,181117.872,V,,,,,,,080911,,,N*4E
$GPGGA,181118.874,,,,,0,00,,,M,0.0,M,,0000*5D
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,181118.874,V,,,,,,,080911,,,N*47
$GPGGA,181119.872,,,,,0,00,,,M,0.0,M,,0000*5A
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,181119.872,V,,,,,,,080911,,,N*40
$GPGGA,181120.872,,,,,0,00,,,M,0.0,M,,0000*50
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,181120.872,V,,,,,,,080911,,,N*4A
$GPGGA,181121.871,,,,,
55
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,181125.872,V,
,,,,,,080911,,,N*4F

$GPGGA,181126.872,,,,,0,
00,,,M,0.0,M,,0000*56
$GPGSA,A,1,,,,,,,,,,,,,,,*1
E
$GPRMC,181126.872,V,,,,,,,080911,,,N*4C

$G
PGGA,181127.872,,,,,0,00,,,M,0.0,M,,0000*57
$GPG
SA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,181127.872,V,,,,,,
,080911,,,N*4D

$GPGGA,181128.872,,,,,0,00,,,M
,0.0,M,,0000*58
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$G
PGSV,1,1,00*79
$GPRMC,181128.872,V,,,,,,,080911,,
,N*42

$GPGGA,1811
29.875,,,,,0,00,,,M,0.0,M,,0000*5E
$GPGSA,A,1,,,,
,,,,,,,,,,,*1E
$GPRMC,181129.875,V,,,,,,,080911,,
,N*44

$GPGGA,181130.874,,,,,0,00,,,M,0.0,M,,0
000*57
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,1811
30.874,V,,,,,,,080911,,,N*4D

$GPGGA,181131.87
4,,,,,0,00,,,M,0.0,M,,0000*56
$GPGSA,A,1,,,,,,,,,
,,,,,,*1E
$GPRMC,181131.874,V,,,,,,,080911,,,N*4C

#2 CharlesTucker

CharlesTucker

    Member

  • Members
  • PipPip
  • 19 posts

Posted 11 September 2011 - 06:36 AM

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.

Some references on interpreting the NMEA output:
http://www.sparkfun....nce Manual1.pdf
http://aprs.gids.nl/nmea/

Now what can be the reasons for this behavior:

  • 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

#3 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 11 September 2011 - 12:02 PM

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).

#4 stan4th

stan4th

    Member

  • Members
  • PipPip
  • 27 posts

Posted 13 September 2011 - 10:34 PM

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

#5 Mike P

Mike P

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • LocationAuckland, New Zealand

Posted 14 September 2011 - 12:08 AM

Did you take it outside? My experience is that very few GPSs work inside.

#6 stan4th

stan4th

    Member

  • Members
  • PipPip
  • 27 posts

Posted 14 September 2011 - 07:54 AM

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.

#7 stan4th

stan4th

    Member

  • Members
  • PipPip
  • 27 posts

Posted 16 September 2011 - 08:25 AM

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

#8 Fred

Fred

    Advanced Member

  • Members
  • PipPipPip
  • 302 posts
  • LocationUK

Posted 16 September 2011 - 09:43 AM

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.

#9 CharlesTucker

CharlesTucker

    Member

  • Members
  • PipPip
  • 19 posts

Posted 16 September 2011 - 09:57 AM

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

#10 stan4th

stan4th

    Member

  • Members
  • PipPip
  • 27 posts

Posted 17 September 2011 - 08:23 AM

Hi,
these are the readings when near window, perhaps if someone could verify where it has located in case I am misreading it please?

I find that it seems to be at 40 miles east and 10 miles south of my true location;

$GPGSA,A,3,15,09,22,12,25,,,,,,,,3.3,2.3,2.4*3C

$GPRMC,080009.000,A,5311.8122,N,00034.2950,W,0.62,
3.22,170911,,,A*73

$GPGGA,080010.
000,5311.8125,N,00034.2948,W,1,05,2.3,23.1,M,47.1,
M,,0000*79
$GPGSA,A,3,15,09,22,12,25,,,,,,,,3.3,
2.3,2.4*3C
$GPGSV,3,1,10,09,73,102,31,12,64,226,26
,14,32,309,,25,28,235,24*74
$GPGSV,3,2,10,17,27,048,,15,20,167,29,22,18,273,21,18,09,23
6,*70
$GPGSV,3,3,10,30,05,242,,04,03,090,*74
$GP
RMC,080010.000,A,5311.8125,N,00034.2948,W,0.50,16.
09,170911,,,A*49

$GPGGA,080011.00
0,5311.8127,N,00034.2948,W,1,05,2.3,22.5,M,47.1,M
,,0000*7F
$GPGSA,A,3,15,09,22,12,25,,,,,,,,3.3,2.
3,2.4*3C
$GPRMC,080011.000,A,5311.8127,N,00034.29
48,W,0.41,337.92,170911,,,A*78

$GPG
GA,080012.000,5311.8132,N,00034.2944,W,1,05,2.3,2
1.5,M,47.1,M,,0000*77
$GPGSA,A,3,15,09,22,12,25,,
,,,,,,3.3,2.3,2.4*3C
$GPRMC,080012.000,A,5311.813
2,N,00034.2944,W,0.79,336.81,170911,,,A*7B

$GPGGA,080013.000,5311.8134,N,00034.
2947,W,1,05,2.3,21.0,M,47.1,M,,0000*76
$GPGSA,A,3
,15,09,22,12,25,,,,,,,,3.3,2.3,2.4*3C
$GPRMC,0800
13.000,A,5311.8134,N,00034.2947,W,0.75,327.50,1709
11,,,A*7F

$GPGGA,080014.000,5311.8
137,N,00034.2948,W,1,05,2.3,20.1,M,47.1,M,,0000*7
D
$GPGSA,A,3,15,09,22,12,25,,,,,,,,3.3,2.3,2.4*3C

$GPRMC,080014.000,A,5311.8137,N,00034.2948,W,0.9
7,341.43,170911,,,A*7A

$GPGGA,080015
.000,5311.8141,N,00034.2949,W,1,05,2.3,19.0,M,47.1
,M,,0000*77
$GPGSA,A,3,15,09,22,12,25,,,,,,,,3.3
,2.3,2.4*3C
$GPGSV,3,1,10,09,73,102,31,12,64,226,
26,14,32,309,,25,28,235,24*74
$GPGSV,3,2,10,17,27
,048,,15,20,167,29,22,18,273,21,18,09,236,*70
$GP
GSV,3,3,10,30,05,242,,04,03,090,*74
$GPRMC,080015
.000,A,5311.8141,N,00034.2949,W,1.28,331.45,170911
,,,A*7F


#11 CharlesTucker

CharlesTucker

    Member

  • Members
  • PipPip
  • 19 posts

Posted 17 September 2011 - 01:29 PM

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

#12 stan4th

stan4th

    Member

  • Members
  • PipPip
  • 27 posts

Posted 17 September 2011 - 01:48 PM

Hi Pete, thanks - I am incorrectly interpreting the data!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.