[Project] Display GPS Location on OLED



  • I am working on my next project, which springboards off this one. Using the GPS to grab the current location and then pulling the weather from Weather Underground's API to display the current conditions. I am about 60% complete, most has been written, but now I need to go home and test.

    I will post another project up once completed. And I will watch the syntax better this time.



  • Very cool- pretty similar to what I did. I added an animation while it was getting the fix. Just starts marching across the screen. I'll have to upload my script at some point.

    FYI, you don't need to save a file with the data. You can call ubus directly:

    gpsDataProcess = Popen(["ubus", "call", "gps", "info"], stdout=PIPE)
    gpsDataJSON = gpsDataProcess.communicate()[0]
    gpsDataProcess.stdout.close()
    if ( gpsDataProcess.returncode == 0 ):
         # gps available
         gpsData = json.loads(gpsDataJSON)


  • I have this set up and working now but I was wanting to try and leave the heading info off and replace it with the time or something.

    I can easily add the system time but I can't see a way (yet) of getting the gps time out. I am thinking at the moment that I will need to extract it from the NMEA data as the ogps calls don't supply it .



  • @Ian-Marchant You could also just grab the system time instead.



  • @Brad-Buskey That's what I am doing at the moment but i know that the GPS time is much more likely to be correct (Unless there is a way of setting the time from the GPS and then it won't matter)



  • Thank you for this project. Nice and easy as a first project with Omega 2.

    In my case there is a systematic error in the position returned by "ubus -S call gps info". Not a major one; just a few miles away but it is annoying for a device that should have an accuracy of a few meters

    I looked at the source code on github and identified a bug in ugps when the NMEA data is converted.

    I was wondering if you ever checked the accuracy of your results, for example by plotting the latitude and longitude on Google Map?

    Did you find a fix?



  • @Pi-Phea Thanks for the comments. I have not found any kind of fix, nor would I be the one to likely find it - not a programmer, and no real training. This is really my first forray into this world.

    When the name came up on the OLED for the local weather station, it was one that is close enough. (from a different project), but now I am curious to see where my Omega thinks it is.



  • @Matthew-Butch said in [Project] Display GPS Location on OLED:

    Very cool- pretty similar to what I did. I added an animation while it was getting the fix. Just starts marching across the screen. I'll have to upload my script at some point.

    FYI, you don't need to save a file with the data. You can call ubus directly:

    gpsDataProcess = Popen(["ubus", "call", "gps", "info"], stdout=PIPE)
    gpsDataJSON = gpsDataProcess.communicate()[0]
    gpsDataProcess.stdout.close()
    if ( gpsDataProcess.returncode == 0 ):
         # gps available
         gpsData = json.loads(gpsDataJSON)
    

    I must be missing something here. I get the following when I run the .py file.

    Initializing display
    Writing '+-------------------+' to display
    Writing '| Current GPS Info: |' to display
    Writing '+---------+---------+' to display
    Traceback (most recent call last):
    File "showgps2.py", line 23, in <module>
    gpsDataProcess = open(["ubus", "call", "gps", "info"], stdout=PIPE)
    NameError: name 'PIPE' is not defined



  • @Brad-Buskey Did you happen to declare PIPE?

    from subprocess import Popen, PIPE



  • Yes sorry missed that part:

     from subprocess import Popen, PIPE


Looks like your connection to Onion Community was lost, please wait while we try to reconnect.