This guide will explain step by step how to set up your Raspberry PI to run the pimotion application.
The camera module is required for this application to run. For the installation of the hardware I refer to the official guide.
I recommend the [operating system name] OS, this is the OS that the pimotion application has been developed on.
There are 2 ways of enabling the camera module:
-
During the OS installation During the installation of the operating system, you will be promted for additional actions to take. In this menu, one of the options is to enable/disable the camera module.
-
After installation If your Raspberry PI already has a running operating system you can call up the same setup menu by running the following command:
$ sudo raspi-config
Select
Enable camera
and hitEnter
, then go toFinish
and you'll be prompted to reboot.
Make sure your Raspberry PI is connected to a monitor/tv with an hdmi cable and login to the shell. Make sure to login on the PI itself, not through SSH.
In the shell, run the following command to trigger the preview window of the camera:
$ raspistill -d
You should see a preview window for a couple of seconds which closes by itself. If you see this, your camera module is working correctly.
In case the preview does not show or you receive an error, refer to the troubleshooting guide on the Raspberry PI website.
Run the following command to install the required system packages:
$ sudo apt-get update
$ sudo apt-get install -y python-dev python-pip imagemagick libffi-dev libssl-dev git
Confirm that python is installed on the system.
$ python --version
Python 2.7.3
Run the following command to pull the latest version of Pimotion:
$ mkdir ~/projects
$ cd ~/projects
$ git clone https://github.com/citrusbyte/pimotion.git
In the pimotion folder run the following commands to install all the dependent python packages:
$ sudo pip install http://effbot.org/downloads/Imaging-1.1.7.tar.gz
$ sudo pip install -r requirements.txt
Create the tmp folder that will hold the captured images:
$ mkdir ~/projects/pimotion/captures
Make a copy of the provided settings.cfg.example
configuration file:
$ cd ~/projects/pimotion
$ cp settings.cfg.example settings.cfg
Open up the settings.cfg
file in your favorite editor and update the configuration values.
cloudapp:
- username: Your CloudApp username
- password: Your CloudApp password
m2x:
- api_key: Your master API key or the device specific API key
- device_id: The Device ID
- stream: The name of the stream in your M2X device
Make sure you are in the correct working directory:
$ cd ~/projects/pimotion
Start the application with the following command:
$ python pimotion/main.py
Example output of a correct running pimotion application:
$ python pimotion/main.py
Waiting 2 seconds for the camera to warm up
Started recording
Started working on capturing
Captured detected-01.jpg
Captured detected-02.jpg
Captured detected-03.jpg
Captured detected-04.jpg
Captured detected-05.jpg
Captured detected-06.jpg
Captured detected-07.jpg
Captured detected-08.jpg
Captured detected-09.jpg
Captured detected-10.jpg
Captured detected-11.jpg
Captured detected-12.jpg
Captured detected-13.jpg
Captured detected-14.jpg
Captured detected-15.jpg
Generating the montage
Finished capturing
Public URL: http://cl.ly/image/*******/download/montage.jpg
Posted URL to M2X channel motion-photos