sadovnychyi / pi-helmet-cam

Software for a Raspberry Pi Zero W motorcycle helmet camera

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pi-helmet-cam

Software for a Raspberry Pi Zero W motorcycle helmet camera.

Automatically starts recording when powered on, removing old videos if necessary, and uploads everything on youtube (convenient private storage with no visible limits) when network is available.

Based on similar implementation from @nicolashahn, but with improved software (auto merging of video files and youtube uploads) and mounted inside of the helmet instead of outside (this could change, but it's nice to have such a small camera which could be mounted anywhere).

Necessary Hardware

  • Raspberry Pi Zero W
  • Raspberry Pi camera v2 with correct ribbon cable (Zero cable is different than full sized Pi's)
  • MicroSD card
    • get one of the 'high endurance' ones since this will be writing HD video constantly
  • Battery
    • Simplest solution is a smartphone external battery pack with magnetic microUSB cable (WSKEN X-Cable Round in my case -- make sure it connects properly by itself) and keep it in your jacket/backpack sample
  • Camera housing/mounting
    • Cover both raspberry and camera with epoxy to make them resistant to water with electrical tape on top of it img_20171217_193939 img_20171217_193957 img_20171217_201024
    • Velcro straps to secure the camera module, one glued on camera's back, another two strapped on helmet's velcro pads. One is "L" shaped in between the pads, another one on top of it to create "T" shape, and camera goes on top of "T". Could be impossible with your helmet though img_20171219_015646
    • Electrical tape for mounting raspberry to the helmet img_20171219_010251 img_20171219_010307 img_20171219_010328

Setup Instructions

  • Download Rasbian Lite and use etcher to install it on an SD Card

  • Create empty ssh file on boot partition created above to allow SSH access

  • Configure and copy wpa_supplicant.conf file to setup wireless network

  • Plug in the card and you should be ready to connect by e.g. ssh pi@192.168.1.4 (lookup the IP using arp -a or something) with default password being raspberry

  • Use sudo raspi-config to enable camera interface and change your password

  • Optionally copy a public key from your local machine ssh-copy-id pi@192.168.1.4

  • sudo apt-get update

  • Install git sudo apt-get install -y git

  • Clone this repo git clone https://github.com/sadovnychyi/pi-helmet-cam.git

  • Generate client_secret.json from Google Cloud Console (select 'Other' as application type) and click download JSON

  • Copy client_secret.json onto your raspberry in project folder scp client_secret.json pi@192.168.1.4:~/pi-helmet-cam

  • Run make from project folder – this will install dependencies and generate credentials based on your app secrets

  • Run sudo crontab -e and add this line to the bottom:

    * * * * * /sbin/fake-hwclock save
    @reboot /home/pi/pi-helmet-cam/camera.py > /home/pi/pi-helmet-cam/cron.log 2>&1

You can check cron.log (latest session only) or camera.log (full history) for troubleshooting.

About

Software for a Raspberry Pi Zero W motorcycle helmet camera


Languages

Language:Python 96.2%Language:Makefile 3.8%