If you have read my other project where I created a Raspberry Pi photo frame, then this could help you extend the functionality by automatically downloading your images. You could however use this to synchronize any files with your Raspberry PI. For this project i am just going to synchronize my sideshow photos from Dropbox.
- First open a Terminal window sand enter curl -L https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh | bash
- Once this has finished you are ready to configure Rclone
- Enter the command rclone config
- Enter n (for a new connection) and then press enter
- Enter a name for the connection (i’ll enter dropbox) and press enter
- Enter 8 for “Dropbox” and press enter
- Press Enter for client ID
- Press Enter for client Secret
- Enter n for advanced config
- Enter y for “use auto config”
- A browser window will then pop up and you can log into Dropbox.
- When you have entered your details, the next screen will appear asking you to allow access. Press the Allow option.
- You will receive a screen saying “Success”.
- Close the browser window and return to the terminal.
- Press y to complete the setup.
- Close the terminal window
- Now we have set up the connection however we still have to synchronize(download) the folder to the raspberry PI. to do this we will write a simple .sh script and set it to run at a set time.
- If your comfortable with a text editor you can enter this string into leafpad on the raspberry pi and save it as sync.sh rclone sync -v dropbox:images /var/www/html/slideshowimages (This sync command will make the Pi folder the exact same as the folder in Dropbox, ie it will delete any folders not in Dropbox) You can also change “/var/www/html/slideshowimages” to “/home/pi/Pictures” if you like.
- If you have used different names to me, replace dropbox with your connection name and replace images with your folder name(this is the folder name in your Dropbox account). You can also change the path, this is where the folder is synced to.
- If you don’t want to make the file yourself you can download the version at the end of this project already completed, You will just need to unzip it
- Either way you do it put the file in the /home/pi/Documents on your Raspberry Pi
- This file will call the connection and download any new files from Google Drive. This is good however we need to set it to run automatically.
- Only follow if your Pi doesn’t have a Desktop installed (Headless) or you have installed Raspian Buster– Run crontab -e in the terminal
- Select 2 for nano
- Enter the following string – 0 * * * * /home/pi/Documents/drive.sh
- Save the file ( usually Ctrl + O to save and Ctrl + X to exit) ,then skip to step 30
(Depreciated, Gnome Schedule has been removed as of Raspian Buster. Only use if you have an older version. Use step 22.1 if you have Raspian Buster or newer)Next we will install a tool to set the script to run automatically. Open a terminal and enter sudo apt-get install gnome-schedule (This is just a cron job interface, so if you are familiar with cron you can skip this app)
- Enter your password and once the installation is completed close the terminal
- Open the Raspberry Pi menu and under System Tools open Scheduled Tasks
- Select New and then A Task that launches recurrently
- Enter a Description if you like. In the command box enter /home/pi/Documents/sync.sh
- Next you can enter the times for synchronization, i’m going to leave it as default; which syncs every hour. Feel free to change this to your liking
- Then Click add
- Thats it! Restart your Raspberry Pi and add some photos to your Dropbox
PS. You can also use this for many other types of drives and the process is very similar. Just choose a different number in step 6.
This file syncs images to “/home/pi/Pictures”