Archive for the ‘Raspberry Pi Camera’ Category

PhotoBooth for Pi

Posted: May 6, 2014 by schoolpiclub in General News, Raspberry Pi Camera

School Pi Club wanted to work on a project that in future could involve the whole school. We often have charity fundraising days in school where we organise different events. We came up with the idea of turning the Raspberry Pi into a PhotoBooth.

With the help of twitter and David Whale (Software engineer/Essex Schools Liaison Officer) aka @Whaleygeek we put together some code to create a Raspberry Pi PhotoBooth.

The photos are taken automatically every few seconds and the students can see their image immediately on screen. The code also contains fun captions which are picked at random.

If you would like to try PhotoBooth for Pi yourself below is a link to the Python code.

Python Code – PhotoBooth for Pi

If you haven’t already done so you may need to install the Picamera module onto your Raspberry Pi. Instructions on how to do that can be found here

Streaming Raspberry Pi Camera

Posted: February 1, 2014 by schoolpiclub in Raspberry Pi Camera

One thing we have talked about at School Pi Club is how to stream the Raspberry Pi Camera via the web. Founder member JW would like to use it to check on his dog remotely.

Here are the instructions to set up streaming a Pi Cam.

1. After booting up your Raspberry Pi you need to install MJPG Streamer using LXTerminal.

# Make and change into directory.
sudo mkdir /opt/mjpg-streamer
cd /opt/mjpg-streamer/

# Install the following packages.
sudo apt-get install libjpeg8-dev
sudo apt-get install imagemagick
sudo apt-get install subversion

# Download MJPG Streamer into the current directory.
sudo svn co .

# Run make.
sudo make


2. Now for the fun bit – streaming the video from your Raspberry Pi Camera. Please note you will need to scroll along to see some of the code below.

# Make a directory to store the temporary images.
sudo mkdir /tmp/stream/
# Make the directory writable.
sudo chmod a+rw /tmp/stream/

# Start capturing.
# See what the raspistill options are.
raspistill --help
# You see the record light turn on after executing the following line.
raspistill -w 640 -h 480 -q 5 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 -n &

# See what the MJPG Streamer options are.
/opt/mjpg-streamer/mjpg_streamer --help
# Run the following to start up the MJPG Streamer streaming webserver.
LD_LIBRARY_PATH=/opt/mjpg-streamer/ /opt/mjpg-streamer/mjpg_streamer -i " -f /tmp/stream -n pic.jpg" -o " -p 9000 -w /opt/mjpg-streamer/www" &


3. If everything went smoothly you can open up a web browser and go to:


There you have it. To access your streaming webserver remotely you will need to enable port forwarding on your router. Since every router is different we cannot explain how, but the PortForward site can guide you. 

4. To stop streaming you need to kill the processes. First do ctrl+C to get the command prompt.

# To kill MJPG Streamer
killall mjpg_streamer

# to kill Raspistill
killall raspistill


This weekend I thought I would try to set up my Raspberry Camera and try to take photos remotely.

Firstly I install the iOS BerryCam app onto my iPhone, and typed the ip address for my Raspberry Pi into the app.

berrycam 2



I then created a file on my Raspberry Pi using the following code:-

#!/usr/bin/env python
#  BerryCam - Raspberry Pi Camera Controller for use with iOS devices
#  Created by James Moore on 22/05/2013.
#  Copyright (c) 2013 Fotosyn. All rights reserved.
#  Raspberry Pi is a trademark of the Raspberry Pi Foundation.
#  IOS is a trademark or registered trademark of Cisco in the U.S. and other countries and is used by Apple Inc. under license.

import SimpleHTTPServer, SocketServer
import urlparse
import os

PORT = 8000 # CHange this if you wish to listen on a different port

class BerryCamHandler (SimpleHTTPServer.SimpleHTTPRequestHandler):

   def do_GET(self):

       # Parse query data
       parsedParams = urlparse.urlparse(self.path)
       queryParsed = urlparse.parse_qs(parsedParams.query)

       # Add 'berrycam' prefix to URL to perform query
       if parsedParams.path == "/berrycam":

          awb = "'" + queryParsed['awb'][0] + "'" # Set AWB mode
          mm = "'" + queryParsed['mm'][0] + "'" # Set metering mode
          ev = queryParsed['ev'][0] # Set EV compensation
          ex = "'" + queryParsed['ex'][0] + "'" # Set exposure mode
          sh = queryParsed['sh'][0] #  Set image sharpness 
          br = queryParsed['br'][0] # Set image brightness
          co = queryParsed['co'][0] # Set image contrast
          sa = queryParsed['sa'][0] # Set image saturation
          #iso = queryParsed['iso'][0] #  Set capture ISO - NOT YET IMPLEMENTED        
          ifx = "'" + queryParsed['ifx'][0] + "'" # Set image effect
          #cfx = "'" + queryParsed['cfx'][0] + "'" # Set colour effect - NOT YET IMPLEMENTED IN BERRYCAM
          #rot = queryParsed['rot'][0] # Set image rotation - NOT YET IMPLEMENTED IN BERRYCAM
          filequality = queryParsed['fquality'][0]
          filewidth = queryParsed['fwidth'][0]
          fileheight = queryParsed['fheight'][0]
          filefolder = queryParsed['ffolder'][0]
          fileseq = queryParsed['fseq'][0]
          hflip = queryParsed['hf'][0]
          #exifmake = queryParsed['exifmake'][0]

          #filewidth = 2592 #- ((2592/4)*filesize) # Take the values passed, divide by 4 and multiply to get new size
          #fileheight = 1944 #- ((1944/4)*filesize) # Take the values passed, divide by 4 and multiply to get new size

          #Exposure mode options :

          #AWB mode options :

          #Image Effect mode options :

          #Metering Mode options :

          directory = 'berrycam/' + str(filefolder)
          if not os.path.exists(directory):

          # Build up a raspistill command line string
          command = "raspistill -v" # Initiate command for Raspicam
          command += " -awb " +   str(awb) # Define WB
          command += " -mm " +   str(mm) # Define Metering Mode
          command += " -ev " + str(ev) # Define the Exposure Adjustment
          command += " -ex " +   str(ex) # Define Exposure Mode
          command += " -sh " + str(sh) # Define Image Sharpness
          command += " -br " + str(br) # Define Image Brightness
          command += " -co " + str(co) # Define Image Contrast
          command += " -sa " + str(sa) # Define Image Saturation
          #command += " -ISO " + str(iso) # Define Image ISO - NOT YET IMPLEMENTED          
          command += " -ifx " +   str(ifx) # Define Image Effect
          #command += " -cfx " +   str(cfx) # Define Colour Effect - NOT YET IMPLEMENTED IN BERRYCAM
          #command += " -rot " +   str(rot) # Define Image Rotation - NOT YET IMPLEMENTED IN BERRYCAM
          command += " -q " + str(filequality) # Define Image Quality
          command += " -w " + str(filewidth) # Define output image width
          command += " -h " + str(fileheight) # Define output image height
          #command += " -o /berrycam/" + str(filefolder) + "/IMG-" + str(fileseq) +".jpg" 
          command += " -o berrycam/" + str(filefolder) + "/IMG-" + str(fileseq) +".jpg" 
          #command += " -x IFD1.Make=" + str(exifmake)  #Define Make for ESIF Data 'Raspberry Pi'

          if hflip == "1":
              command += " -hf "
              command += ""


          # Default to serve up a local file 

   def processRequest(self, query):


httpd = SocketServer.TCPServer(("", PORT), BerryCamHandler)

print "B E R R Y C A M -- Listening on port", PORT
print "Please ensure your BerryCam App is installed and running on your iOS Device"


Using terminal I typed the following command

sudo python /home/


My Raspberry Pi was plugged in in another room in the house but I was able to connect to the camera remotely using the BerryCam app.

For more information on the set up of the BerryCam app  visit 





Christmas Tree Timelapse

Posted: January 5, 2014 by schoolpiclub in General News, Raspberry Pi Camera

Thought we would make use of the Raspberry Pi Camera over the festive period, so we made a timelapse  video whilst decorating the Christmas Tree.

The Raspberry Pi infrared camera module ‘Pi NoIR’ is now available.

Just found this timelapse video that has been taken of a lawn. Check out the speedy slippery slugs!

Raspberry Pi on iPad

Posted: October 13, 2013 by schoolpiclub in General News, Raspberry Pi Camera
Tags: , , ,

Raspberry Pi on iPad

It’s easy to set your iPad as a screen for your Raspberry Pi using VNC (Virtual Network Connection). Your Raspberry Pi will need to be connected to a network, either by ethernet or wireless.

1. First of all find out the IP address of your Raspberry Pi. I am using a Wi-Pi dongle to connect to the internet so I opened up the WIFI config and that told me my IP. You can also type the following into LX Terminal and that will reveal your IP.

sudo ifconfig

2. Install a VNC server program on your Pi. You can do that with the following commands:

sudo apt-get update
sudo apt-get install tightvncserver

You will be prompted to confirm installation by typing “Y’.

3. After you successfully installed VNC server you can now start a VNC server session with the following line:

vncserver :1

You will be prompted to enter and confirm a password. It would make sense to use “raspberry” for this, but passwords are limited to 8 characters, so I used “raspberr”. Note that this is the password that you will need to use to connect to the Raspberry Pi remotely.

You will also be asked if you want to create a separate “read-only” password – say no.

From now on, the only command that you need to type within your SSH to start the VNC server will be:

vncserver :1

The VNC server is now running and so we can attempt to connect to it via an iPad.

4. On your iPad you need to install the ‘Mocha VNC Lite’ app which is free to download. Once installed you need to configure it.

  • Select ‘New…Add a configuration’
  • In the VNC Server address type in your Raspberry Pi’s IP address.
  • Change the VNC Server Port number to 5901
  • Enter the VNC Password ‘raspberr’ (or which ever you chose)
  • Now select ‘connect on the left hand menu
  • Then choose click the Raspberry Pi’s IP

Your Raspberry Pi’s desktop should now be displayed.

Raspberry Pi on iPad 2

Apple Timelapse

Posted: October 13, 2013 by schoolpiclub in General News, Raspberry Pi Camera

When an apple is sliced or bitten into and exposed to the open air, chemicals within it combine with oxygen and make the apple turn brown. Here is our timelapse video of an apple turning brown.

Apple Timelapse

We set the Raspberry Pi camera to take a picture every 5 seconds for 30 minutes, which is a total of 360 photos.

raspistill -o myimage_%04d.jpg -tl 5000 -t 1800000