Many Raspberry Pi projects require synchronization of files over more than just one device. Dropbox, which is a popular file-hosting service, can be used for this with ease. Synchronizing data between different devices may seem a little tricky, especially since the installation of Dropbox on you Pi is not as straight forward as you would expect. But it is worth the next few steps that you have to perform and over the long run can make quite an impact.
First we have to understand,
What is Dropbox?
Dropbox is a cloud storage service. This means that you can copy your files to the cloud and access them later, from any device device.
Dropbox is an easily accessible, low-cost cloud storage platform. The user interface is similar to Windows File Explorer, which makes understanding it for most people quite easy. Most of the functions and a decent amount of storage comes with its free version. So, in the case that you need it for just a project application, Dropbox checks all the right boxes.
Dropbox with Raspberry Pi:
Dropbox with Linux, and hence Raspbian is slightly winding. But, don’t sweat it! The method created by Alex Eames can be of much use when you want to view pictures you have taken using Raspberry Pi camera remotely. In addition to remote viewing, it reduces the space occupied on your Raspberry Pi.
Step-by-step process:
STEP-01 :Get a Dropbox account
If you have a Dropbox account prior to this, great! If not, go ahead and set one up. You can opt to use the free, or paid services as well. Go to their website and click Sign Up and enter your details.
STEP-02: Get Dropbox uploader
Next, we need to get the Dropbox Uploader on your Raspberry Pi. Once you start your Pi, open the terminal and use the following code to download the files.
git clone http://github.com/andreafabrizi/Dropbox-Uploader.git
After it completes, use your terminal to move to the folder by typing:
cd Dropbox-Uploader
You can now begin to install the files starting by entering:
./dropbox_uploader.sh
This will then prompt a request for your API key.
STEP-03: Find your API key
To find your API key, you need to go to the developers’ section of Dropbox. From here you can create a new app and receive a unique API key.
Click on Create App to start.
Since this is an individual application, we’ll chose Dropbox API rather than business. The next two options are left to your need: if you want to access full Dropbox, feel free to. However, keep in mind that it may be better for privacy and security reasons if you use only a specific folder on your Dropbox. Finally, name it whatever you want and click Create App.
STEP-04: Enter your API key
On the settings page for the app you created, there will be an ‘App key’ specified. Paste it in into the terminal that it asks for it on. You will then see a prompt for the ‘App secret’, which is right below the key in your settings page. Click on ‘show’ and then enter that. You will then have to confirm the type of permission given (full or just a folder). It will then drop a link to put in the browser to confirm. Press ENTER to finish the setup. In the case that everything went as requested, you will see a message confirming it.
STEP-05: Add a progress bar
In order to ensure that throughout using Dropbox, all functions are working properly we need a progress bar. This can be added to the project quite easily. To do so, open the installed file from the terminal:
nano /home/pi/Dropbox-Uploader/dropbox_uploader.sh
Identify the line that contains SHOWPROGRESSBAR in Default values. After this change SHOW_PROGRESSBAR=0 to SHOW_PROGRESSBAR=1
#Default values
TMP_DIR=”/tmp”
DEBUG=0
QUIET=0
SHOW_PROGRESSBAR=1
SKIP_EXISTING_FILES=0
ERROR_STATUS=0
STEP-06: Start uploading!
At this point, everything should be working for you to start uploading files. Since the Dropbox _uploader file is the key to uploading your files, keep in mind to write code within that folder.
Hence, to upload a file from terminal:
cd home/pi/Dropbox-Uploader
./dropbox_uploader.sh upload /home/pi/<name of file you want to upload><dropbox name>
Now that you know how to upload the files you desire to Dropbox, you can go ahead and create a network. Interconnected devices, that share data can be a powerful tool to build applications on. If you already have a project that could be advanced using this, Go ahead! Else, there is a world o possibilities and a head full of ideas waiting for you to get started. Go explore, and have fun!