Skip navigation.

Enhancing the PiPole-Cam

So far I haven't really written about the software side of the project.  That is because there has been very little software.  Just a few shell scripts.

I have some scripts to turn the wireless Access Point into a normal wireless client and visa-versa.  I have some scripts to control raspistill and rasipivid etc.  Nothing really earth shattering going on here.  Life turned very busy over the local native orchid season (July-October), so the PiPole-Cam project took a back seat for a while.

In the meantime, the software writer/volunteer of raspistill released a fix that enabled information to be now stored in the jpeg's EXIF section.  I found a better Python script than mine that would reliably link into the gpsd daemon.  Someone also had released a independent Python code to control the RPi camera.  Time does not stand still in the Raspberry Pi world.

  1. Add a buzzer
  2. Keep time sync'ed via NTP and the GPS unit
  3. Sync RPi OS date/time against the GPS datetime.
  4. Add GPS info into a jpeg photos EXIF metatdata section
  5. Convert photographing shell scripts into Python

Here are the above points in a bit more detail:

1) The buzzer was the easy part.  I found a small 3-5V piezo buzzer from Altronics, Perth and mounted it on GPIO Pin 10.  After listening going berserk for 5 minutes during a debug stage, I quickly added a jumper so I could isolate it as needed.  It all functions via the Python wireingpi2 module.

2) Keep time sync'ed via NTP and the GPS unit.  This was an interesting challenge. Most RPi websites that are listing using a GPS to sync with NTP are using the PPS signal to help in their accuracy.  I don't really need anything very accurate.  With a bit of experimenting, I found it would work sometimes and not other times. 

The answer was kind of obvious, in that NTP will take a really long time to sync a large timer difference.  I wanted to be able to re-sync my RPi OS clock from a difference of perhaps days or weeks.  For this reason, NTP wasn't really a practical method for this.  This then leads onto the next step.

3) Sync RPi OS date/time against the GPS datetime.  The Raspberry Pi computer doesn't have a Real Time Clock on board.  When the RPi boots up, it will take a date and time from when it was last running.  To re-sync the time and date to the current period, why not just grab a valid GPS date and time value and force that into the Linux Operating System.  It took a bit of time to figure out how to do that reliably, but it seems to work ok.  The only change I had to do was to add an arbitrary 4 minute time-out, so I could regain control of the console if there was no GPS unit attached, or if it working inside with no GPS signal.  The Python script is kicked off via /etc/rc.local

4) As I have mentioned previously elsewhere, there was a bug in raspistill that refused to update the EXIF metadata.  This was fixed around August 2013.  I did some testing with some shell scripts, then Python scripts that would take the GPS data and embed the info into the jpeg EXIF metadata section.  It all seems to work well and I am happy with the results.  Each photo now has the correct date-time and GPS coordinates of when and where it was taken. 

5) I started calling the raspistill binary from within Python.  Then I found the very adaptable Picamera Python script to take my photos and to embed my GPS info into the jpeg EXIF metadata section.  It all seems to work well and I am happy with the results.   

 The PiPole was now ready for another test run out in the bush.

Note: I will attach the Python scripts at a later stage.