Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

Adafruit Ultimate Gps
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit Ultimate Gps

by dio1970 on Thu Mar 05, 2020 7:13 pm

Hello guys,

I have just purchased an Adafruit Ultimate Gps without an external antenna for a school project and I am trying to connect it with my Pi Zero using the Pi's built-in UART. The problem is that I am lost.

I follow this Adafruit guide https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython
which prompts to https://circuitpython.org/downloads but the problem is that I can not find the raspberry zero platform in order to download the CircuitPython.

After a lot of searches, I run sudo pip3 install adafruit-circuitpython-gps and some files were downloaded to my raspberry pi zero.

After that, according to the guide I had to install the necessary libraries to use the hardware. How can I detect what libraries I need?

I do not know whether I did something wrong or right.

Any help would be much appreciated.

Dio.

dio1970
 
Posts: 6
Joined: Tue Feb 18, 2020 11:25 am

Re: Adafruit Ultimate Gps

by mikeysklar on Thu Mar 05, 2020 7:24 pm

Hello dio1970,

We have a guide for using the Pi's UART with the Adafruit Ultimate GPS.

https://learn.adafruit.com/adafruit-ult ... g-your-gps

You likely need to install the gps module from PyPi using:

Code: Select all | TOGGLE FULL SIZE
 pip3 install gps


Then you can just use python3 to run our test code.

Code: Select all | TOGGLE FULL SIZE
import gps

# Listen on port 2947 (gpsd) of localhost
session = gps.gps("localhost", "2947")
session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)

while True:
    try:
        report = session.next()
        # Wait for a 'TPV' report and display the current time
        # To see all report data, uncomment the line below
        # print(report)
        if report['class'] == 'TPV':
            if hasattr(report, 'time'):
                print(report.time)
    except KeyError:
        pass
    except KeyboardInterrupt:
        quit()
    except StopIteration:
        session = None
        print("GPSD has terminated")

mikeysklar
 
Posts: 846
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit Ultimate Gps

by dio1970 on Fri Mar 06, 2020 6:18 am

Dear mikeysklar,

thank's for your quick response. I run the pip3 command and the test code that you suggested. Unfortunately after 1 hour the gps does not lock (red light still blinking) and I get a lot of zeros on my screen (I am sending a screenshot of this).

Is there something else I can do?

Thank's in advance.

Dio.
Attachments
Myscreenshot.jpg
Myscreenshot.jpg (147.97 KiB) Viewed 47 times

dio1970
 
Posts: 6
Joined: Tue Feb 18, 2020 11:25 am

Re: Adafruit Ultimate Gps

by mikeysklar on Fri Mar 06, 2020 4:53 pm

That looks like you are getting signal data. You can uncomment the line "print(report)" in the code example for additional data.

We have a guide and example code called gps_simpletest.py which you can test and see if you get a fix.

https://learn.adafruit.com/adafruit-ult ... uart-usage

mikeysklar
 
Posts: 846
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit Ultimate Gps

by dio1970 on Sat Mar 07, 2020 12:47 pm

Hello,

I tried the gps_simpletest.py for hours but I can not get a fix.

I would like to check the first GPS code you posted deeper.

Is it possible to provide me the proper commands in order to extract the latitude, longitude and altitude variables, from the report function?

Thank's,

Dio

dio1970
 
Posts: 6
Joined: Tue Feb 18, 2020 11:25 am

Re: Adafruit Ultimate Gps

by mikeysklar on Sun Mar 08, 2020 11:51 am

Dio,

Is your GPS unit being placed in a location that has significant access to the sky? A window usually works, but being outside is ideal if possible.

I see looking at the latest release on github that some of the installation process has changed.

https://github.com/adafruit/Adafruit_CircuitPython_GPS

Code: Select all | TOGGLE FULL SIZE
sudo pip3 install adafruit-circuitpython-gps


Below is the latest gps_siimpletest.py. The last two lines will print latitude and longtitude.

Code: Select all | TOGGLE FULL SIZE
import time
import board
import busio

import adafruit_gps

RX = board.RX
TX = board.TX

uart = busio.UART(TX, RX, baudrate=9600, timeout=30)

gps = adafruit_gps.GPS(uart, debug=False)

gps.send_command(b'PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0')

gps.send_command(b'PMTK220,1000')

last_print = time.monotonic()
while True:

    gps.update()

    current = time.monotonic()
    if current - last_print >= 1.0:
        last_print = current
        if not gps.has_fix:
            print('Waiting for fix...')
            continue
        print('=' * 40)  # Print a separator line.
        print('Latitude: {0:.6f} degrees'.format(gps.latitude))
        print('Longitude: {0:.6f} degrees'.format(gps.longitude))

mikeysklar
 
Posts: 846
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit Ultimate Gps

by dio1970 on Sun Mar 08, 2020 12:50 pm

Thank you so much I will try it.

dio1970
 
Posts: 6
Joined: Tue Feb 18, 2020 11:25 am

Please be positive and constructive with your questions and comments.