Dropbox Setup

Dropbox is a “cloud” file storage and syncing service. A basic account is free and offers two gigabytes of storage. We can leverage this as a means of getting photos off the Raspberry Pi onto other devices (desktop computer, etc.) without cables or swapping cards.

This pretty much requires a WiFi connection; trying to work a camera with an Ethernet cable continually attached would get tiresome. It also requires being in range of your wireless access point, with the Raspberry Pi suitably configured for access.

We’ll use this guide from RasPi.TV (with minor changes as Dropbox has evolved) to get Dropbox and the Raspberry Pi to work together. The steps include:

  • Set up Dropbox account if you don’t already have one.
  • Locate the Dropbox Uploader software on the Raspberry Pi.
  • Create a Dropbox app and get access credentials.

1. Create a Dropbox account if you don’t already have one.

A basic account (2GB limit) is free. Sign up at Dropbox.com.

2. Locate the Dropbox Uploader software

There should be a folder called “Dropbox-Uploader” in the pi user’s home directory. The camera installer script downloaded and placed it there.

cd ~/Dropbox-Uploader

3. Create a new Dropbox App through the Dropbox developer site

Visit https://www.dropbox.com/developers/apps and log in with your Dropbox account credentials.

Use the “Create app” button to begin the process…

Select “Dropbox API” and “Full Dropbox,” then assign your app a unique name (e.g. “Bob’s Raspberry Pi Camera”), then click “Create App.”

In the Settings tab for your new app, there’s a section with the heading “OAuth 2.” Look for the button “Generate access token.” This will give a long string of seemingly random letters — a unique identifier for tying your camera to your Dropbox account. (This is different from the “App key” and “App secret” — don’t use those — look for the long access token!)

This last step is easiest if you have SSH enabled on the Pi and are logged in through a terminal program, so you can just copy-and-paste rather than having to type in that whole string exactly…

4. Set up Dropbox Uploader

You should be inside the Dropbox-Uploader directory at this point (i.e. typing “pwd” should return “/home/pi/Dropbox-Uploader”).

Run the dropbox_uploader.sh script:

./dropbox_uploader.sh

You’ll be prompted to enter your access token that was generated in Step 3. This must be exact, which is why ssh and copy-and-paste is so helpful.

If you mess up this process, you can run “./dropbox_uploader.sh unlink” to clear out Dropbox Uploader’s settings and start over.

Let’s test it!

echo 12345 > foo.txt
./dropbox_uploader.sh upload foo.txt /

This will create a small text file (foo.txt) containing the string “12345” and will upload it to the root level of your Dropbox drive. If Dropbox is installed on your “main” computer the file should appear there after a moment, else use a web browser to log into your Dropbox account and you should see it there among your files.

If this works, then next time you run the cam.py script you can go into Settings and select Dropbox for storage. Photos will be saved both in the “Photos” folder and uploaded immediately to Dropbox.

This guide was first published on Jan 14, 2014. It was last updated on Oct 15, 2018. This page (Dropbox Setup) was last updated on Apr 12, 2018.