Carambola2 on Cloud (Dropbox)

2013-06-01 20:20 | Categories: In English, Užrašai, Video

carambola_dropbox_rSometimes 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!

 

 

 

 

 

 

cara_on_cloud_4 

 

Prepare

Key components for this setup are:

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

1_

dropbox-uploader.sh setup

Note applicatation name, which is MyUploader*******3 in my case

Go to Dropbox apps https://www.dropbox.com/developers/apps

9_

Create an app

2_

Enter application name and select Core API

3_

Select permissions (whole dropbox or dedicated directory)

4_

Copy App key and App secret keys

5_

And enter them to dropbox_uploader.sh window on Carambola

6_

Answer weather you have chosen to use App folder or Full Dropbox and confirm everything is correct

7_

Copy provided URL in your browser to confirm access, click allow

8_

Go back yo dropbox_uploader.sh window and press enter con finish setup. You should see Setup completed!

 

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.com

Usage: /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
         unlink

For 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 support

Disabling the the banner.
Writing JPEG image to ‘/tmp/output.jpeg’.
 > Uploading /tmp/output.jpeg to /output.jpeg…
######################################################################## 100.0%
 > DONE
root@OpenWrt:/#

 

10_

You should see uploaded picture as soon as it’s uploaded

 

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

 

Timelapse sample using this setup

  1. Saulius Lukšė
    2013-06-02 11:34

    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

  2. 2013-06-08 14:02

    Could you perhaps show us photo’s of the complete setup. Especially the enclosure you used.

  3. Saulius Lukšė
    2013-06-08 14:07
  4. Saulius Lukšė
    2013-06-08 17:54

    Platorm support issue fixed.

  5. jason
    2013-06-09 11:34

    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

  6. Saulius Lukšė
    2013-06-09 11:48

    @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.

    • jason
      2013-06-09 17:48

      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?

  7. Saulius Lukšė
    2013-06-09 18:56

    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.

You must be logged in to post a comment.
TOP