microstack-IoT / python3-microstacknode

Python modules for interacting with Microstack node components (accelerometer, GPS, etc)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python3-microstacknode gps

jonhdeppp opened this issue · comments

Hi, Im having errors on the GPS. I just bought 30 units. Please help. Thanks.
ERROR:
pi@raspberrypi ~ $ sudo python3 /usr/share/doc/python3-microstacknode/examples/gpscat.py
Traceback (most recent call last):
File "/usr/share/doc/python3-microstacknode/examples/gpscat.py", line 9, in
gpgll = gps.gpgll
File "/usr/lib/python3/dist-packages/microstacknode/gps/l80gps.py", line 101, in gpgll
pkt = self.get_nmea_pkt('GPGLL')
File "/usr/lib/python3/dist-packages/microstacknode/gps/l80gps.py", line 255, in get_nmea_pkt
"Timed out before valid '{}'.".format(pattern))
microstacknode.gps.l80gps.NMEAPacketNotFoundError: Timed out before valid 'GPGLL'.

Have you disabled the login shell over the serial port? Run:

sudo raspi-config

Then navigate to: Advanced Options -> Serial -> No

Yeah, I did.
Im using Raspberry Pi 2 running on Raspbian Debian Wheezy
Release date: 2015-05-05
Default login: pi / raspberry
Kernel version: 3.18

Is the power jumped connected on the Microstack base board? Do you have a picture of how the board is plugged in?

Here are the pictures.

dsc_0205
dsc_0206

Looks correct. It could simply be that you're not getting a GPS signal. There should be a flashing 'FIX' red LED on the GPS board. If it's not flashing then you probably aren't getting any signal and the error makes sense: "timed out before valid GPGLL". The GPS unit needs to have clear line of sight of the sky so make sure you're by a window or are outside.

Hm, perhaps I should update the gpscat.py program to print out something more useful if that error is thrown.

Thanks Thomas, I will try.

Hi Thomas,

Same error even though I'm working in the middle of soccer field

Is the LED flashing? The red LED needs to be flashing before it will work. It sometimes takes about 3 to 5 minutes to get a fix (depending on all sorts of conditions including the weather!).

Yes, it's blinking every 2 seconds. I also tried putting the RPi on my car while moving but still the error I posted above appears.

Is it okay to send me a working image for raspberry pi 2? Thanks

Any update? I bought 30 pairs of this gps and adapter but it's not working. Hope I can get a better support. Thanks

So let's test if you're getting any serial data at all from the GPS unit by accessing the serial port using minicom. Run the following and let me know how you get on.

First, double check that you have disabled the RaspberryPi login over serial port:

sudo raspi-config

Navigate to Advanced Options > Serial > 'Would you like a login shell to be accessible over serial?' > No > 'Serial is now disabled'.

sudo reboot

When you're back up, install minicom:

sudo apt-get update && sudo apt-get install minicom

Start minicom in setup mode:

sudo minicom -s

Navigate down to Serial port setup and press Enter. Press a to navigate to the Serial Device line and replace the device name with /dev/ttyAMA0. Press Enter to stop editing and then press e to edit the Bps/Par/Bits setting. Press c and q to configure this as 9600 8N1. Press Enter to save the Bps/Par/Bits settings and then Enter again to exit the settings dialogue. Finally navigate down the Exit and press Enter to leave the configuration.

You should see the serial data being send out from the GPS. If you have a fix (flashing LED) most of this will be comma separated coordinate data and if you don't have a fix then it'll mostly be a bunch of commas.

The Microstack Python interface provides interactive access to this data stream.

To exit minicom press ctrl+a and then q (on it's own, without holding ctrl+a). You should see an exit dialogue. Select yes and press Enter.

Let me know how far you get with that.

Hi Thomas,

Here's what I'm getting:

$GPGLL,,,,,013046.800,V,N_72
$GPTXT,01,01,02,ANTSTATUS=OPEN_2B
$GPRMC,013047.800,V,,,,,0.00,0.00,060180,,,N_4B
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N_32
$GPGGA,013047.800,,,,,0,0,,,M,,M,,_41
$GPGSA,A,1,,,,,,,,,,,,,,,_1E
$GPGSV,1,1,00_79
$GPGLL,,,,,013047.800,V,N_73
$GPTXT,01,01,02,ANTSTATUS=OPEN_2B
$GPRMC,013048.800,V,,,,,0.00,0.00,060180,,,N_44
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N_32
$GPGGA,013048.800,,,,,0,0,,,M,,M,,_4E
$GPGSA,A,1,,,,,,,,,,,,,,,_1E
$GPGSV,1,1,00_79
$GPGLL,,,,,013048.800,V,N_7C
$GPTXT,01,01,02,ANTSTATUS=OPEN_2B
$GPRMC,013049.800,V,,,,,0.00,0.00,060180,,,N_45
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N_32
$GPGGA,013049.800,,,,,0,0,,,M,,M,,_4F
$GPGSA,A,1,,,,,,,,,,,,,,,_1E
$GPGSV,1,1,00_79
$GPGLL,,,,,013049.800,V,N_7D
$GPTXT,01,01,02,ANTSTATUS=OPEN_2B
$GPRMC,013050.800,V,,,,,0.00,0.00,060180,,,N_4D
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N_32
$GPGGA,013050.800,,,,,0,0,,,M,,M,,_47
$GPGSA,A,1,,,,,,,,,,,,,,,_1E
$GPGSV,1,1,00_79
$GPGLL,,,,,013050.800,V,N_75
$GPTXT,01,01,02,ANTSTATUS=OPEN_2B
$GPRMC,013051.800,V,,,,,0.00,0.00,060180,,,N_4C
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N_32
$GPGGA,013051.800,,,,,0,0,,,M,,M,,_46
$GPGSA,A,1,,,,,,,,,,,,,,,_1E
$GPGSV,1,1,00_79
$GPGLL,,,,,013051.800,V,N_74
$GPTXT,01,01,02,ANTSTATUS=OPEN_2B
$GPRMC,013052.800,V,,,,,0.00,0.00,060180,,,N_4F
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N_32
$GPGGA,013052.800,,,,,0,0,,,M,,M,,_45
$GPGSA,A,1,,,,,,,,,,,,,,,_1E
$GPGSV,1,1,00_79
$GPGLL,,,,,013052.800,V,N_77
$GPTXT,01,01,02,ANTSTATUS=OPEN_2B
$GPRMC,013053.800,V,,,,,0.00,0.00,060180,,,N_4E
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N_32
$GPGGA,013053.800,,,,,0,0,,,M,,M,,_44
$GPGSA,A,1,,,,,,,,,,,,,,,_1E
$GPGSV,1,1,00_79
$GPGLL,,,,,013053.800,V,N_76
$GPTXT,01,01,02,ANTSTATUS=OPEN_2B
$GPRMC,013054.800,V,,,,,0.00,0.00,060180,,,N_49
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N_32
$GPGGA,013054.800,,,,,0,0,,,M,,M,,_43
$GPGSA,A,1,,,,,,,,,,,,,,,_1E
$GPGSV,1,1,00_79
$GPGLL,,,,,013054.800,V,N_71
$GPTXT,01,01,02,ANTSTATUS=OPEN_2B

Okay, so your GPS unit is working -- all that data is from the serial port of the GPS. It looks like you don't have a fix which means that when you run the gpscat.py program, you'll get the microstacknode.gps.l80gps.NMEAPacketNotFoundError: Timed out before valid 'GPGLL'. error.

Can you try taking it somewhere where the red fix LED (on the orange GPS board) flashes and then post the serial output from minicom.

Hi Thomas,

Its working now, was it the minicom that solves the issue?

Thank you very much for the help.

Hi Thomas,

One more question. Does Microstack GPS can determine the heading? For example, can the device tell if I'm going north bound or south bound?

I really appreciate your help.

Ah! That's great news. Minicom didn't solve the issue itself but by following the steps in getting it to work you've fixed something, somewhere. It's likely to have been some combination of incorrectly installed drivers/not having a fix.

Microstack GPS follows the L80 GPS protocol specification. There are a couple of messages which contain COG - course over ground values: GPRMC and GPVTG for example. You can query these in the same way gpscat.py queries GPGLL.

If you have any more questions then please don't hesitate to ask. :)