picamera-pusher
Python script that takes pictures at a certain interval with the Raspberry Pi camera, then save them to a web server and publish the URL to a Pusher channel so an iOS app can show them in a realtime photo feed.
You can follow the tutorial to build this application or jump straight to the code.
Getting Started
- Make sure you have all the development dependencies installed in your Raspberry Pi by executing
sudo apt-get install build-essential libssl-dev python-dev libffi-dev
. - Install a web server.
- Create the directory
photos
under/var/www/html/
and give it permissions (by changing the owner):sudo mkdir /var/www/html/photos
sudo chown -R pi:pi /var/www/html/photos
- Clone this repository and
cd
into it. - If you didn't have virtualenv, install it with
sudo pip install virtualenv
. - Create virtual environment for the project with Python 3
virtualenv -p python3 env
. - Activate
virtualenv
withsource env/bin/activate
. - Install requirements with
pip install -r requirements.txt
. - In another terminal, execute ngrok with
ngrok http 80
and copy the URL with HTTPS. - Modify the file
camera.py
to enter your Pusher credentials and ngrok URL. You can also change the time to take photos. - Execute
python camera.py
. - When your done, stop the program with
Ctrl-C
and deactivate your virutal environment withdeactivate
.
Prerequisites
Built With
- Pusher - APIs to enable devs building realtime features
- Python - A programming language that lets you work quickly and integrate systems more effectively.
Acknowledgments
- Thanks to Pusher for sponsoring this tutorial.
License
MIT