Adafruit has a tutorial on how to diy a wireless camera with touch screen. There are also instructions on how to build a time-lapse camera.

This project mixs these two features, and aim to build a wireless time-lapse camera using Raspberry Pi, which is much eaiser than a wireless time-lapse camera in Arduino.


Development evironment

  • Raspian (OS for Raspberry Pi)
  • Python
  • PHP


1. Initialize Raspian

2. Setup Wifi

3. Setup remote server

I use a regular LAMP on my server.

Here is the PHP file that I ues to receive photos from Raspberry Pi:

Upload this HTML file, browse it in your browser to make sure your upload feature work properly.

4. Camera test

Make sure your camera work properly before you proceed:

raspistill -o cam.jpg  

You should see a photo captured in your home dir.

Implement python script

Instal python setup tool:

sudo apt-get install python-pip  

Install required python packages:

pip install picamera  
            pip install PIL  
            pip install requests  
            pip install urllib2  

Upload python files to your home dir on your Pi: simply takes one photo every 20s.

Here is what about to execute:

Indicate the remote server:

url = 'http://SERVER/camera.php'  
     use internet_on() to test the Ineretnet connection first. If the Internet connection is avaiable, weather or not it is WLAN or LAN, it uploads photos in the pic dir, and moves uploaded photos to uploaded.

It assumes that all photos are JPEG files:


And removes all file with 0 size in case photo files created mistakenly:

filesize = os.stat(path).st_size  
                if filesize > 0:

Comment out these lines if you don't have a rotation problem as I encountered, c

    im =
                out = im.rotate(180)

Then post it to the remote server:

r =, files=current_file)  

Comment out these line if you don't need any thumbnail images:

#save a thumbnail
            out = im.resize((128, 77))  
  '/home/pi/thumbnail/' +filename)  

5. Test wifi upload

Make sure your wifi network work properly.
Execute each python scripts:


You should see the latest photo appears on your sever side. Or error info to debug.

6. Setup crontab script

Create a file:

nohup python /home/pi/camera/ > log &  

Make it executeable:

chmod +x  

Lanuch camera on start:

sudo vim /etc/rc.local  

Add line at its beginning (do not add it in any IF-ELSE block):

/usr/bin/python /home/pi/camera/ >/tmp/camlog 2>/tmp/camerr &

Create a file:

python /home/pi/camera/  

Make it executeable:

chmod +x  

Run upload script on start:

sudo crontab -e  

Add line:

*/1 * * * * /home/pi/ >/tmp/upload 2>/tmp/upload.err

Setup autostart when device boot

Restart the device to test:

sudo reboot