Using GPS breakout on Raspberry Pi Touchscreen Camera

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
caramellcube
 
Posts: 3
Joined: Thu Jun 25, 2015 1:04 pm

Using GPS breakout on Raspberry Pi Touchscreen Camera

Post by caramellcube »

Hi, I've been working on a version of the Adafruit DIY touchscreen camera for a while now and, while there are no major problems so far, I'm working outside of what I understand with some of this so I could use some advice. The project is described in detail here but to summarize, I've added a timelapse mode to the control script, and a sensor array that communicates via usb so that photos can be tagged with sensor readings. So far, the mod is nowhere near efficient, but it works. The next step is to add a GPS receiver to allow geotagging (I'm using an Adafruit Ultimate GPS breakout board through a TTL USB converter). Unfortunately this is where I'm getting too far outside of what I know.

I've been able to get the demo script working, but making it work in cam.py is where I'm stuck. At the moment, it seems like I need to do it like this...

1) On bootup, the Pi starts GPSD, then Cam.Py
2) On starting, Cam.Py starts a new thread "GPS updater"
3) "GPS updater" runs constantly in the background, grabbing the latest data from GPSD and using it to update a set of global variables for Lat, Lon, Time and whatever might need recording.
4) When a photo is taken, the global variables are checked and used to geotag the image.
5) When Cam.Py closes, it first terminates the "GPS updater" thread.

Is that how it works? Is there anything I should watch out for with this?
I've read that if GPSD isn't checked regularly it overflows, but I'm not sure how exactly this works, for example do I need to shutdown GPSD itself if Cam.Py closes? or switch off the receiver completely? I was planning on installing a satnav application as well but I'm not sure how to handle the time between closing an application and starting another.

I know there's a lot more potential for this project than it's current state so if anyone has any advice for improvements it would be much appreciated.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Using GPS breakout on Raspberry Pi Touchscreen Camera

Post by pburgess »

Sounds like a reasonable approach. The main loop of Cam.py waits for PyGame events, so having a separate GPS updater thread sounds like a decent way to avoid ripping that all up.

I have zero familiarity with GPSD, so not sure what to recommend there for avoiding an overflow when the camera script isn't running. I see it has a 'foreground' mode, maybe it's advisable to use that (spawned & ended by Cam.py) instead of always being present as a daemon. Might be less tape-and-band-aid-y than the alternative, unless the client library has a way to pause & resume the daemon.

User avatar
caramellcube
 
Posts: 3
Joined: Thu Jun 25, 2015 1:04 pm

Re: Using GPS breakout on Raspberry Pi Touchscreen Camera

Post by caramellcube »

Thanks for the advice, I'll do some research on that foreground mode.

User avatar
zggy
 
Posts: 10
Joined: Wed May 06, 2015 7:16 am

Re: Using GPS breakout on Raspberry Pi Touchscreen Camera

Post by zggy »

I'm considering buying a Raspberry Pi A+, Raspberry Pi camera board, and Adafruit Ultimate GPS HAT for Raspberry Pi and I want to make sure I will be able to connect all of them at the same time so I can track where the Raspberry Pi is at the same time as filming.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using GPS breakout on Raspberry Pi Touchscreen Camera

Post by adafruit_support_mike »

Yeah, that should be possible. The GPS module communicates through a Serial interface and the camera has its own data bus.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”