Web-based interface to configure the Phenotiki device (Raspberry Pi for plant phenotyping)
Python Mako Other
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 5 commits ahead of TimJuni:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
raspistillweb
CHANGES.txt
LICENSE
MANIFEST.in
README.md
autostart.sh
development.ini
production.ini
raspistillweb.sqlite
run
setup.cfg
setup.py

README.md

raspistillWeb

Small Python web interface for raspistill to take photos with the RaspberryPi in the browser. I used the pyramid framework for site generation and bootstrap for fancy mobile-first layouts.

alt text

Important notice: this version of raspistillWeb is a fork of the original project by Tim Jungnickel (tim.jungnickel@gmail.com). This fork was created and is maintained by Massimo Minervini (minervini.massimo@gmail.com) with the purpose of adding features relevant to the Phenotiki project (http://phenotiki.com) for plant phenotyping applications.

Requirements

For a successful installation you need:

  • a RaspberryPi with raspbian installed (other os not tested, but should work too)
  • a RaspberryPi Camera Kit

Installation Notes

I'll provide a guide to install raspistillWeb based on the tutorial from the pyramid framework to install raspistillWeb in a seperate python environment, so that your systems python environment is not effected.

  1. Make sure that your raspbian and your camera is working. Try to make a photo with raspistill to verify that your camera is working.

  2. Install python3-dev (if not already on your system), setuptools and exif and virtualenv via pip:

  • sudo apt-get install python3-dev python3-pip python3-setuptools exif
  • sudo pip3 install virtualenv
  1. Create a virtual environment for python (sudo not required and not recommended):
  • mkdir ~/Development (Or another directory)
  • cd ~/Development
  • virtualenv --python=python3 env
  • cd env
  1. Install raspistillWeb
  • git clone https://github.com/TimJuni/raspistillWeb.git
  • cd raspistillWeb
  • ../bin/python3 setup.py develop (this may take some time)
  1. Initialize the database
  • ../bin/initialize_raspistillweb_db development.ini
  1. Run raspistillWeb
  • ../bin/pserve development.ini
  • surf http://<adress of your pi>:6543

Updates

To update your Version of raspistillWeb, simply go into the raspistillWeb Directory and type:

  • git pull
  • ../bin/python setup.py develop

Please notice, that you may need to install new dependencies (for example exif via apt-get)

Example Configurations

Running raspistillWeb over ssh

If you run raspistillWeb over ssh, you cannot quit your ssh session, because the raspistillWeb process will be killed. One easy way to start raspistillWeb (and let it run even when you are logged off) is to use screen:

  1. Install screen
  • sudo apt-get install screen
  1. Create a new screen
  • screen -S cam
  1. Start raspistillWeb
  • ../bin/pserve development.ini
  1. Detatch the screen
  • simply hit ctrl + a + d

At this point you can quit your ssh session and raspistillWeb will continue serving files. If you later want stop raspistillWeb, you can attach to the screen by: screen -r cam

Running raspistillWeb behind a Reverse Proxy (with Authentification)

If you want to use to raspistillWeb from the internet, you can set up an apache reverse proxy to restrict the access to the application. Therefore you have to open port 80 in your router for your pi and follow these instructions:

  1. Install Apache Web Server
    • sudo apt-get install apache2
  2. Enable Apache Proxy Mod
    • sudo a2enmod proxy_http
  3. Disable Default Site
    • sudo a2dissite default
  4. Create a new Virtualhost
    • sudo nano /etc/apache2/sites-available/raspistillWeb and add the following content:
<VirtualHost *:80>
  ServerName mydomain.org
 
  <Location />
    AuthType Basic
    AuthName "raspistillWeb Login"
    AuthUserFile /usr/local/passwd/passwords
    Require user guest
  </Location>

  ProxyPreserveHost On
  ProxyRequests off
  ProxyPass / http://localhost:6543/
  ProxyPassReverse / http://localhost:6543/
 
</VirtualHost>
  1. Create a password file

    • sudo mkdir /usr/local/passwd
    • sudo htpasswd -c /usr/local/passwd/passwords guest
    • Enter a password
  2. Enable the Virtualhost and restart the Webserver

    • sudo a2ensite raspistillWeb
    • sudo /etc/init.d/apache2 restart

When you surf http://<adress of your pi> you should be asked for a username (guest) and a password (see step 5).

Run raspistillWeb on startup

  1. Create a startup script
  • sudo nano /etc/init.d/raspistillweb
#!/bin/bash
cd /home/pi/Development/env/raspistillWeb
../bin/pserve development.ini
  1. Make the script executable sudo chmod 755 /etc/init.d/raspistillweb
  2. Register the script to be run at startup sudo update-rc.d /etc/init.d/raspistillweb defaults

Future Work

This is my first project with python and pyramid. Feel free to leave a commend or a feature request.