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).
- 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
- Camera housing/mounting
- Cover both raspberry and camera with epoxy to make them resistant to water with electrical tape on top of it
- 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
- Electrical tape for mounting raspberry to the helmet
-
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 usingarp -a
or something) with default password beingraspberry
-
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 folderscp 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.