Category Archives: Raspberry Pi

Dropbox + Motion on the Raspberry Pi

Raspbian, the recommended default operating system of the Raspberry Pi, does not come with a native Dropbox package. The hacks I saw online were all pretty sloppy, with many showing how to bounce files from your raspberry pi to another device like a desktop PC that has dropbox installed, then using that PC to sync files. I wanted Dropbox synchronization for only a single folder, and for one purpose: to collect the photos my webcam takes when using the motion software.

(Motion is a pretty cool program that can give advanced motion sensing capabilities to a number of webcams, and live stream your webcam and/or automatically record video or take pictures when motion is detected. See:

I decided to use Dropbox’s Python API to create a script that could save my security footage. I had a number of uninvited painters scheduled to come to my apartment while I was away at work and needed something that would save to a remote location. The code that follows is tailored to the motion program. Since motion can automatically execute a program or script upon writing a file (ie: saving a photo or video triggered by motion), I decided to take advantage of this and upload each file individually as opposed to running an additional script that continually monitors the filesystem for changes.

(Will make that later… check back in a week or two). Update: more important things have cropped up like building a sous vide machine!

How to do it:


  • You have a dropbox account
  • You have python and motion installed
Step 1: Download droppi script files

Accessible here

Step 2: Install Dropbox SDK Python module & create new dropbox app

Install the module:

sudo pip install dropbox

Create new app:


Create App > Dropbox API app > Files & Datastores > Yes

Name your new app whatever you like.

Step 3: Copy down newly created app key and app secret

Paste your app key and app secret into the “keys” file downloaded in There should be one key per line with app key on the first line. ie:


Step 4: Run to allow dropbox API access so we can upload to dropbox


Follow the directions in the console, you will need to click the link to allow API access. You’ll also need to paste the code received into console. This will be the last key you will need to use the script. The rest of the keys and tokens are generated automatically for you and will be inserted into the “keys” file.

You can tell if it worked by checking your dropbox account. Do you see a new folder that bears the name of your app (may be located in a new “App” folder)? Is there a “test.txt” inside of it? If so, you’re all set for step 5.

Step 5: Configure Motion

Open the motion configuration file found at /etc/motion/motion.conf (always a good idea to make a copy). If you don’t have a configuration file, I used this sample one.

Disable video

I disabled video recording on mine because the dropbox account I’m using for motion is a new account with only about 2 gb of space in it. I disabled video recording by changing



ffmpeg_cap_new off

Set working directory

Choose the directory on your local machine where you would like to save your pictures and/or videos. /tmp is a good option if you don’t want long term storage. Make sure your directory is writeable by user motion.

target_dir /tmp

Add droppi upload

If you are saving images, modify the following the following (use absolute path for the file, ie: /home/pi/, and be sure to remove the semicolon at the front of the line)

on_picture_save python %f

If you are saving videos:

on_movie_end value

Step 6: Enjoy your dropbox enabled surveillance system!

Save the motion.conf file, start or restart the motion daemon

sudo service motion restart

Dance in front of your camera and check your dropbox!

Coming soon: Real time Dropbox folder syncing for Raspberry Pi

This motion dropbox script was a quick proof of concept hack and was made overnight because I needed it to keep an eye on these seedy painters that were coming into my apartment while I was out all day.

Hello painters!

 05-20140109084638-00 05-20140109084641-00(1) 05-20140109084503-00 05-20140109084259-00

What’s next

A python program that continually monitors a directory for changes should not be much more difficult to create. Stay tuned…

Quick and Easy Wireless File Sharing With the Raspberry Pi in Linux

Fed up with the commandline and just want to drag and drop some files on to your network connected raspberry pi? Look no further than the oft-forgotten FISH protocol.

No, not that kind of fish

Fish is a simple and easy to use SSH file transfer protocol that can be used in Dolphin and Konqueror file managers/browsers. It allows you to share files between computers (including raspberry pi, woohoo) securely through SSH, all from the convenience of your GUI file manager.

To use it, simply open Dolphin or Konqueror, and type in the address bar:

fish://[raspberry pi username]@[local ip address]
ie: fish://pi@

Assuming you have all the basic dependencies like openssh, you should get a prompt that has you input the raspberry pi user password. Once entered, you’ll be on your way to easily swapping files without having to resort to running ftp servers, using scp, rsync or moving things manually to the SD card.


Obviously, this feature isn’t limited to just the raspberry pi. You can use it for transfers between other SSH accessible computers as well.