Now in the age of Internet of Devices, almost everybody is making electronics stuff integrating internet with their electronics. There already are new IoT devices ready to use in the market. But what is the case with our old controllers?
Well, they also are catching up with the latest SoC designed and developed under such a low cost to gear up and act as an internet node.
In one of my recent project, I have to update data and statistics in XML files and excel sheet over the LAN and also over the WAN. LAN problem was easily solved as by running a SAMBA server and ftp client in the LAN network. File sharing was not big thing by using Single Board Computers(ARM based).
One of the problem statement in the project was to update data and the nodes i.e. the server and the assumed client are on WAN i.e. no LAN setup exists. Also, the cost of affording a personal web server and its maintenance is going a big high. Dedicated & Static IPs are problematic and are rearely deployed in a product because it is highly unlikely that the consumer is going to have it. So the product is to have something PLUG n PLAY type thing.
So either one can use personal cloud or shared cloud service. Personal cloud may be costlier to maintain, so a general purpose cloud sharing service like Dropbox comes handy in such situations. One can use Dropbox for central server which stores files and both the nodes can update the “GLOBAL” variable file and will get sync automatically. Obviously the Dropbox manages “mutex & semaphores” ‘s Police work and hence the locking over the files and multiple open & write hazards are of no worry to us.
Now the problem comes, Dropbox gives its applicaiton for Intel architecture but Alas! it ain’t there for ARM architecture and no ready to use things exists for all the different Single Board Computers out there. But Dropbox do provide APIs for its use and synchronization purposes.
One can simply use these API bind with python and automate the synchronization process.
All thanks to @andreaFabrizi for such an awesome script
1. Get the git folder
git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
just in case, you already don’t have git, install it first.
Debian: sudo apt-get install git-core
Others actually don’t really need that, Downloading & installing from the source. always works glib for us.
2. Change your directory to it.
Now, you are going to see “dropbox_uploader.sh” file in the directory listings.
Invoke the script and it will prompt you for further actions.
**Not working??- well, have you already made the script executable. To do that : sudo chmod +x ./dropbox_uploader.sh
3. Running the script will ask you for the
Now, all these things you are going to get by hitting the address that is given in the script that you just executed, this is the address :
Then login to your account, and Create an APP there
Give some name and then create the APP, the next page will contain your app specific details.
(FOR hiding my keys, I used: http://www.online-image-editor.com/ )
once you get the details here, just put them on the SBC’s terminal.
There are chances that you may have used Serial Terminal or SSHd into the Single Board Computer and may face difficulty in copying & pasting into dre.
You are done with Setup!! Yayy! 🙂
The syntax for usage & details from the Documentation page goes here :
./dropbox_uploader.sh COMMAND [PARAMETERS]...
./dropbox_uploader.sh upload /etc/passwd /myfiles/passwd.old ./dropbox_uploader.sh upload *.zip / ./dropbox_uploader.sh download /backup.zip ./dropbox_uploader.sh delete /backup.zip ./dropbox_uploader.sh mkdir /myDir/ ./dropbox_uploader.sh upload "My File.txt" "My File 2.txt" ./dropbox_uploader.sh share "My File.txt" ./dropbox_uploader.sh list
Awesome automation can be done by using it in Python script like this,
- from subprocess import call
- myfile = “/home/pi/Dropbox-Uploader/dropbox_uploader.sh upload /home/pi/abc.jpg abc.jpg”
- call ([photofile], shell=True)
Now, automate things remotely when you can edit your files anytime on your mobile dropbox
Do some Image Processing based on the Pic you just clicked on smart fone and uploaded on Dropbox.
Think of more hacky ideas & if you do, don’t forget to tell me too 😉