Carambola2 on Cloud (Dropbox)
Sometimes it’s overkill to use computer with 200W power consumption for 24/7 to do small task like upload picture from webcam to Dropbox every minute. In this article I will describe how save a lot of Watts and to have Carambola on Cloud!
Prepare
Key components for this setup are:
- Carambola2
- Dropbox
- Nice neat script called Dropbox-Uploader
- UVC webcam (optional)
This method to connect Dropbox is very safe. Connection to Dropbox account is encrypted over SSL. Password and username are hidden behind Dropbox API and should not be entered on Carambola.
First you need to prepare your firmware. I hope you are familiar with building OpenWrt custom firmwares, but if you are not, I provide my custom firmware with many video goodies enabled. And if you would like to build your own, you can read about it on 8devices wiki page.
Go to Carambola2 build directory type make menuconfig and select packages:
> Base System
> bussybox
> Coreutils
> stat
> Enable custom formats (-c)
> Utilities
> bash
> Network
> File Transfer
> curl
> wget (with ssl support)
To build firmware type make and wait until finished.
Flash firmware
In order to upload firmware connect to Carambola console and type
wget -O /tmp/fw2.bin http://www.lukse.lt/failai/carambola2_video_firmware/fw2_video.bin
sysupgrade -v -n /tmp/fw2.bin
Sure you can use alternative method to upload firmware.
Setup Carambola
After firmware upload is finished, type (make console less noisy, add dhcp to lan and restart lan interface):
dmesg -n1
uci set network.lan.proto=dhcp
uci commit
ifdown lan; ifup lan
Probably it will be even more convenient to work over wifi – read here how to configure it.
Download dropbox-uploader.sh script
After this, download dropbox-uploader script and make it executable
wget –no-check-certificate -O /usr/bin/dropbox_uploader.sh http://github.com/andreafabrizi/Dropbox-Uploader/raw/master/dropbox_uploader.sh
chmod 777 /usr/bin/dropbox_uploader.sh
Setup dropbox-uploader.sh script
There is glitch with certificates. You need to edit dropbox_uploader.sh and uncomment one line
#CURL_ACCEPT_CERTIFICATES=”-k”
Run dropbox_uploader.sh
Note applicatation name, which is MyUploader*******3 in my case
Go to Dropbox apps https://www.dropbox.com/developers/apps
Using
Using dropbox -uploader is realy simple. Here are supported commands
root@OpenWrt:/# dropbox_uploader.sh
Dropbox Uploader v0.11.7
Andrea Fabrizi – andrea.fabrizi@gmail.comUsage: /usr/bin/dropbox_uploader.sh COMMAND [PARAMETERS]…
Commands:
upload [LOCAL_FILE] <REMOTE_FILE>
download [REMOTE_FILE] <LOCAL_FILE>
delete [REMOTE_FILE/REMOTE_DIR]
mkdir [REMOTE_DIR]
list <REMOTE_DIR>
share [REMOTE_FILE]
info
unlinkFor more info and examples, please see the README file.
To upload picture as soon as it was grabbed from web camera try this command
fswebcam -d /dev/video0 -r 640×480 /tmp/output.jpeg; dropbox_uploader.sh upload /tmp/output.jpeg
Debug output of successful upload to console:
root@OpenWrt:/# fswebcam -d /dev/video0 -r 640×480 /tmp/output.jpeg; dropbox_upl
oader.sh upload /tmp/output.jpeg
— Opening /dev/video0…
Trying source module v4l2…
/dev/video0 opened.
No input was specified, using the first.
— Capturing frame…
Captured frame in 0.00 seconds.
— Processing captured image…
Unable to load font ‘sans’: libgd was not built with FreeType font supportDisabling the the banner.
Writing JPEG image to ‘/tmp/output.jpeg’.
> Uploading /tmp/output.jpeg to /output.jpeg…
######################################################################## 100.0%
> DONE
root@OpenWrt:/#
Issues
1. Glitch with certificates. Uncomment CURL_ACCEPT_CERTIFICATES=”-k” in dropbox_uploader.sh script
2. stat in openwrt has slightly different syntax than expected. It can be fixed very easily. Edit dropbox_uploader.sh, find
if [ “$OSTYPE” == “linux-gnueabi” ]; then
and replace with
if [ “$OSTYPE” == “linux-gnu” ]; then
Submitted issue to dropbox_uploader git repository. Probably in near future there will be no need to edit script anymore: https://github.com/andreafabrizi/Dropbox-Uploader/issues/55
Could you perhaps show us photo’s of the complete setup. Especially the enclosure you used.
JP – http://lukse.lt/nuotraukos/2013-06-03%2022.11.06.jpg That’s my setup.
Platorm support issue fixed.
the same thing could be achieved using a TL-WR702N or other small TP-LINK router which probably cost much less than the wifi module in this article… I picked up a few TP-link routers for around 20 bucks each
@jason
Sure you can… almost.
I wish you good luck getting any kind of support from TP-LINK hacking it’s routers :) Not mentionig many peripherals available on board, bigger memory, latest OpenWrt build and many more things.
It wasn’t that hard doing stuff with that router… there are many tutorials on setting up a webcam on it.. I was able to put on openWRT in about 10 minutes.. How much did that wifi module run?
I know TP-LINK is hackable. Good luck running commercial product on it. For prices look at http://shop.8devices.com – there are several options available.