[Project] Display GPS Location on OLED



  • I have finally gotten my project to work and can now display my current GPS location in a formatted way on the OLED screen. Thanks to help on this community, I finally had the last 2 lines of code that allowed the string to be manipulated like I needed it to. I have put up a project on Hackster.io that shows everything I did to get it working. I dont want to reinvent the wheel here, so I will link to that project.

    Who knows, maybe it will be good enough to link in the Onion WIKI?

    GPS Info to OLED Project on Hackster.io

    Here is what the output looks like: (crappy photo, I know)
    OLED Output



  • I have the "TODO" finished, and will upload it when I get back to my computer. Basically, if the GPS does not have a fix, it returns {"signal":"false}. I have the Python script testing for the existence of the "signal" key, and it if exists, it prints to the OLED there is no signal. If it doesn't exist, it checks for the existence of the "latitude" key, and if it exists, it prints the GPS location info to the OLED. If that doesn't exist (empty file, for some reason) the script will display that as well, and then exit.



  • Project has been updated on Hackster.io. It now takes into account for a 0 byte (empty) file as well as a file that notes there is no GPS signal. I hope you find it interesting, or at least learn something to use in other project. I mean, the meat of the script is really just to do a file-dump to the OLED screen. ;-)



  • Hey mate,

    super cool project. loved tinkering with this. just what i needed. i left you some feedback on hackster.io regarding improvements that can be made from some issues i encountered. nothing big though. i'll leave the feedback here too. Well done, really like this :)

    1. in OKPG installs please add the component: python-light . If you don't install this component the python script will fail in the "import time" line

    2. in showgps.py line 17 the method is actually oledExp.setTextColumns() not oledExp.setTextColums()

    3. in showgps.py line 45 the "if" has to be in small letters. it is currently with a capital I at the moment which is not recognised by python

    4. in showgps.py line 51 the "elif" has to be in small letters. it is currently with a capital E at the moment which is not recognised by python

    5. Don't forget to remind people that they have to chmod getgps.sh with executable permissions like "chmod 775 getgps.sh" for example.

    Love the project mate :) keep it up



  • @Andrew-De-Bono Thanks man! I made the changes to the project, everything should be good to go now.

    I want to do the same thing, but with weather now. So, looking how to do pull and format that info. Hope to have a new project up on that soon as well. Maybe this week or so.



  • @Brad-Buskey Line 51 in showgps.py is missing a : at the end.



  • @Brian-Delicata said in [Project] Display GPS Location on OLED:

    @Brad-Buskey Line 51 in showgps.py is missing a : at the end.

    Got it, thanks.



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