Things used in this project

Hardware components:
Pi 3 02
Raspberry Pi Raspberry Pi 3 Model B
×1
GPS Module U-blox NEO-6M with 3m Active Antenna (STM32 51 )
×1
PNY 7800 PowerPack
×1
Chdhs 101 main4
GoPro HERO Series Camera
×1
GoPro 3-Way
×1
Software apps and online services:
Raspberry Pi Raspbian

Schematics

This project does not have schematics.
This is a drawing on how the components interact with each other.
Screen shot 2017 06 11 at 12 23 05 am bujvnz593h

Code

LondonGPS.pyPython
This script runs on start up and polls to check my coordinates against a list of coordinates I've pre-selected.
#Import all necessary libraries
import time
import gpsd
import math
from goprocam import GoProCamera
from goprocam import constants

#Need this to calculate the where I am 
earthRadius = 6371

#Wait for the Pi to boot and get the GoPro Wifi
time.sleep(20)

#Connect to the local gpsd
gpsd.connect()

#Initialize the camera object
camera = GoProCamera.GoPro()

#Saved Locations for this trip: 
#Platform 9 3/4: 51.5322° , -0.1240°
#Abbey Road: 51.5321° , -0.1781°
#Buckingham 51.5014°, -0.1419°
#Big Ben 51.5007° , -0.1246°
#Tower of London 51.5081° , -0.0759°
#Tower Bridge 51.5055° , -0.0754° 
#Shakespeare Globe 51.5081° , -0.0972°
#Sweetings 51.5125° , -0.0928°

#Create location arrays: 
latitude = [51.5110, 51.5322, 51.5321, 51.5014, 51.5007, 51.5081, 51.5055, 51.5081, 51.5125]
longitude = [-0.1863, -0.1240, -0.1781, -0.1419, -0.1246, -0.0759, -0.0754, -0.0972, -0.0928]

# Main loop to check the coordinates that I am at 
# and the coordinates I’ve saved.
while True:
       received = False
       try:
               packet = gpsd.get_current()
               received = True
       except Exception:
               print("No signal")
       if received == True:
               #get my current position
               currentPost = packet.position()
               currentLat = currentPost[0]
               currentLon = currentPost[1]
               for location in range(len(latitude)):
                 
                       # The angles need to be in radians to pass 
                       # to trig functions
                       dLat = math.radians(latitude[location] - currentLat)
                       dLon = math.radians(longitude[location] - currentLon)
                       
                       # I used the ‘haversine’ formula to calculate 
                       # the distance between two points over the 
                       # earth’s surface. 
                       # a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)
                       # c = 2 ⋅ atan2( √a, √(1−a) )
                       #d = R ⋅ c
                       a = math.sin(dLat/2) * math.sin(dLat/2) + math.cos(math.radians(latitude[location])) * math.cos(math.radians(currentLat)) * math.sin(dLon/2) * math.sin(dLon/2)
                       c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a))
                       d = earthRadius * c
                       
                       # d is distance between the two sets of coordinates
                       # if distance is less than 10m unit of d is in km, 
                       # take a picture
                       if d < 0.01:
                       camera.take_photo(0)
       
       #we need to sleep so it doesn't infinitely poll
       time.sleep(1)

Credits

Screen shot 2017 06 10 at 10 47 33 am gi1gzy0dh0
Estefannie Explains It All

Software Engineer, Maker, and YouTuber

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Face Detection Using OpenCV With Raspberry Pi
Intermediate
  • 3,172
  • 31

Protip

In this project, we are going to detect faces using OpenCV with Raspberry Pi.

Creating an IoT Server with Home Assistant and MQTT
Intermediate
  • 3,554
  • 20

Protip

This guide will help you set up Home Assistant. Access it from any web browser and automations.

Home Automation Using Wiscore and OpenHab
Intermediate
  • 262
  • 2

Protip

This project will help you setup your very own Alexa controlled Home Appliances using the wonderful Wiscore Module from RAK Wireless.

DIY Smart Assistant Speaker/Lamp (Google Home or Alexa)
Intermediate
  • 1,923
  • 5

Full instructions

DIY build using 3D printed enclosure and parts, a recycled Bluetooth speaker, a Raspberry Pi, and a Philips Hue light bulb.

Adding RC Transmitter/Receiver to Control Mecanum Bot
Intermediate
  • 521
  • 6

Full instructions

We previously showed our Mecanum Bot being controlled by a wireless Xbox controller, now we added RC transmitter/receiver.

One Button Restart of a Stalled Raspberry Pi Zero W
Intermediate
  • 2,208
  • 15

Protip

Avoid SD card corruption on a non-responsive RPi using an Arduino to log into the serial console and restart your RPi from the root account.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login