Datalogging to Dropbox With Arduino Yun




This instructable is an extension to the Datalogger for Arduino Yun. This lets you use the Yun to log your sensors to the SD card, and uses Python and the Dropbox API to store the logged data periodically so you don't lose your data to the elements.

The link to the Github repository is here :

Step 1: Setup Your Dropbox App

Create a Dropbox account if you don't have one already. You can do that here :

Next, go to the Dropbox Apps Console here :

Create an app with the options shown in the image.

Note down the app key and the app secret that you get when you create this, we will use it later.

Step 2: Setup Your Yun

Plug in your Yun and connect it to your local network and the Internet following the tutorial here :

Make sure you have plugged in your SD card to the Yun. It should show up at the location "/mnt/sda1" when you SSH into the Yun.

You can SSH into the Yun by typing

"ssh root@ip_address_of_your_yun"

in the Linux Terminal. Refer to if you are using it on Windows.

Step 3: Install Necessary Python Packages

openwrt on the Linux processor of the Yun comes with a lean Linux install and does not contain all the packages. Run the following commands after SSHing into the Yun to install the necessary packages for the Python script to work.

opkg update

opkg install distribute

opkg install python-openssl

easy_install pip

pip install dropbox

Step 4: Add the Upload Script to the SD Card

Download the zip file attached, unzip it, and upload the folder to the Yun using the scp command on the terminal as shown. This will upload the Python script containing the Dropbox upload code to the SD card. We will then be calling (running) the script from the Yun's micro-controller side.

The Python script uses the Dropbox Python SDK Core API

Step 5: Authenticate the Yun With Dropbox

SSH into the Yun, and edit the dropbox_auth.cfg files, entering the app key and app secret from the previous step. Do not include any special characters while editing.

Next, run the script as in the image, copy the URL to your web browser, and authenticate the app. Copy the key back into the terminal and press enter, and authentication should be done. Once that is done, you can use the access token until you manually deauthorize or delete the app.

Step 6: Setup the Arduino Sketch to Call the Python Script

Download the sketch attached and upload it to the Yun.

This is a modified version of the DataLogger example in the Bridge Library.

The code is well commented, but it polls the three analog sensors A0 to A2 one by one, constructs a text string and writes it to a file on the SD card on the Yun. Once that is done, we call the Python script that uploads the log file to Dropbox, replacing the previous log.

You can modify your sensors in the sketch code, and also the filename if you want to have a different file for every day or hour.



    • Fandom Contest

      Fandom Contest
    • 1 Hour Challenge

      1 Hour Challenge
    • Classroom Science Contest

      Classroom Science Contest

    14 Discussions


    3 months ago

    pip install dropbox fails...? anyone can help
    it says memory error but i am trying to install it on sd card of 16 gb



    i get the following message:

    /usr/lib/python2.7/site-packages/urllib3/util/ InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see



    I don't know how to solve this.

    2 replies

    Reply 2 years ago

    Hi Maurice, were you able to solve it? I'm having exactly the same problem when running

    pip install dropbox

    and I have posted the question at the Arduino Yun Forum, at the DropBox forum and got no answer from those.

    I would appreciate any hint on how to fix it.

    Many thanks in advance


    Reply 2 years ago


    No. It never worked. Now i am playing with the Raspberry Pi 3+. I installed Owncloud and it works fine.



    4 years ago on Step 5


    I can't pass the authorisation. It keeps telling me:

    Error.Cannot connect to Dropbox

    Please check app secret and key, and rerun script to get token

    I filled in the app secret and key.

    What am i doing wrong?

    6 replies

    Had the same issue. It's file permission issue on the SD card. The token can't be written to dropbox_auth.cfg.


    Reply 3 years ago

    You can put in your information into the "dropbox_auth.cfg" file before you copy it to the SD card if you are having permission issues once on the Yun. I find it easier that way, just edit the file in something like or notepad++.


    Reply 3 years ago

    You can put in your information into the "dropbox_auth.cfg" file before you copy it to the SD card if you are having permission issues once on the Yun. I find it easier that way, just edit the file in something like or notepad++.


    Reply 4 years ago on Introduction

    The problem is in the file.

    On line 7 it says :

    configfile = '/mnt/sda1/LogToDropbox/dropbox_auth.cfg'

    while it should be

    configfile = '/mnt/sda1/YunLogToDropbox/dropbox_auth.cfg'

    Or you could change the name of the folder to LogToDropbox



    Reply 3 years ago on Introduction

    Hi guys,

    Im trying to do this instructable but i got the same error. Did the steps one by one. Already checked the route in, but still the same result. Can you help me? Tks in advance.


    Reply 3 years ago

    Did you also generate the access token on the dropbox site. Its on the same page you get your key and secret from. Only difference is you have to click "generate access token"


    Reply 3 years ago

    In dropbox_auth.cfg replace the placeholder "app_secret", "app_key" & "access_token" with the ones you get from dropbox when you create your app before you run Step 5. If you don't you are just trying to authenticate to the authors dropbox app and not yours.


    4 years ago on Step 6

    Hi! Would this tutorial work as well for the Uno and Mega boards?