Monthly Archives: September 2015

Timelapse with Intel Edison

# eddie-timelapse
[The following is pretty much the README of the git hub repository for the code of this project]


This is a small weekend project that I worked on to create a time-lapse video using an off the shelf LogiTech webcam and an Intel Edison board. The Intel Edison platform can trigger camera captures at regular intervals using cron linux utility – Once there is a capture, a nodejs or python program calls Temboo middleware APIs to upload them to Drop box.

Here’s the link to the video that I could get this this. It is pretty rudimentary but you get to know what it fundamentally takes to get a time lapse video.  A lot of patience and perfection :^)

Setup Notes

For Temboo, you will need to install the temboo python or node js SDK on the Intel Edison.  SDK  Setup is pretty simple – Just download the SDK, and unzip it to a directory on the Intel Edison – You can download the SDK from the below links

nodejs -
python -

Once the SDK is copied over, clone the repository. From the repo, Either of the main.js or can be used to trigger captures and calls to Temboo APIs to upload pictures to Dropbox.

3. Drop box and Temboo with OAuth

3.1 Create an App with Drop box

Go to -> App Console -> Check Dropbox API app On creation of the app, it will show you the AppKey and AppSecret which you will need to note down so that you can use it in the main() function to authenticate connection to Dropbox through Temboo API calls.

3.2 Temboo

Follow the setup instructions to Authorize calls to Drop box via . Once the InitializeOAuth and FinalizeOAuth Choreos are completed, you will see the ‘callbackID’ and ‘OAuth token secret’ that you can use in the main() function for authentication.

4. Cron Job

To set the interval, we will use cron job. On Intel Edison platform, you can use a utility called cronie to do trigger execution of scripts at a regular interval.

4.1 OPKG Install Cronie

Setup opkg repo – On Edison console, execute the following.

> echo "src all" >> /etc/opkg/base-feeds.conf
> echo "src edison" >> /etc/opkg/base-feeds.conf
> echo "src core2-32" >> /etc/opkg/base-feeds.conf
> opkg update
> opkg install cronie

4.2 Cronjob

Use the crontab to setup the job using the following command

> crontab -e

This will open up an editor (possibly via vi) to add in the statement to call the script
I used the following added

*/10 * * * * /usr/bin/python /home/root/sw/temboo/temboo_python_sdk/'

For more information on the cron formatsi and examples, refer

5. Creating the video

I used avconv to create the video from the images that were uploaded to Dropbox. One of the requirements would be to have a good numbering of the images while creating the image files. I used the time of the hour to create the images, but that wasn’t suiting avconv, so once I downloaded all the images, I ran the following command which will name the files in an incremental fashion, Run it in the directory where you have the files

> ls -ltr | awk 'BEGIN{a=0}{printf "mv %s eddie_%04d.jpg\n", $0, a; a++}' | bash

You can now use avconv linux utility to convert these images into an mp4video.

> avconv -y -r 20 -i eddie_%04d.jpg -r 20 -q:v 3 timelapse.mp4


Yocto Linux Image build for Intel Edison – Simple and Easy

I have not been successful to get past the Edison Image build process until yesterday!
Previously I have tried it on a Debian machine and it was taking painfully long with
all sort of hangs and crashes during the build. I recently came across a foil set by one
by one of my friends which had a pointer to a build on a virtual machine.

Here is what I followed but I wanted to list the BKM so that other people don’t
struggle with silly problems that I faced and these can rip your morale into pieces.

The beauty of this method is that it used Virtualization – Not just because
Virtualization is cool, the features that come with Virtualization are pretty cool!
I will get to that in a while – But here is a BKM that I followed and got it to work
on my Windows7 PC

Software Setup
I am on a Windows 7 PC with Cygwin installed on the same(git comes along with it)
a. Enable Virtualization/VTd in BIOS – Without this, I could only select 32-bit VMs.

b. Install Oracle VirtualBox

Download the 64-bit version depending on whether you have a 64-bit machine.

c. Vagrant –
Just install the Windows installable – don’t have to worry about Ruby gems etc.

d. Use Cygwin to cd into a local directory – C:/ would be mapped to /cygdrive/c/

e. Git clone the following repo which has the configuration file for Vagrant i.e
Vagrantfile and the file as well.

f) Start Vagrant virtual machine. Cd into the directory and start off with

> /cygdrive/c/HashiCorp/Vagrant/bin/vagrant.exe up


g) Now invoke the VirtualBox and you will see a virtual machine already running.


Get into the virtual machine and with following credentials

username: vagrant
password: vagrant

h) Use the shared drive to copy over the edison-src.tgz for Edison image build.
(Refer for where to download the source
files from.

i) Once you download the files, use command on the command line on the shell through Virtual box

> tar xvf edison-src-<date>.tgz -C ~

NOTE: Do not change any directories and extract the source at /home/vagrant/ itself.

j) Now you can use the following commands to build the image

sudo apt-get install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib
> cd edison-src/
> mkdir bitbake_download_dir
> mkdir bitbake_sstate_dir
> ./meta-intel-edison/ –dl_dir=/home/vagrant/edison-src/bitbake_download_dir –sstate_dir=/home/vagrant/edison-src/bitbake_sstate_dir
> source poky/oe-init-build-env
> bitbake edison-image

Once build process is done, the image for edison is under `pwd`/out/linux/tmp/deploy/images

i) To get all the image files into a single directory. Delete the build directory in the edison-src directory
and create a softlink to the new directory – The Intel document uses edison-src/build as the directory
to fetch build images but looks like of late the images get built in the edison-src/out/linux64/build

ln -s edison-src/out/linux64 edison-src/build

The above script copies the relevant build files to edison-src/build/toFlash directory!!

How long would it take? Around 4 to 5 hours.

Network connectivity required? Yes, please do not switch networks. Will the process hang?
Yes, sometimes, the build log would update the number of tasks that are already run and total number of
tasks that will be run. If the number of task doesn’t update for long, (like more than half hour?) then its probably hung.
At this point, don’t panic – just Control-C and rerun bitbake edison-image and it should continue from where it
ended last time (pretty cool eh!!)

What I liked about this VM method?

a) It only requires about 30G of space allocated to the VM. If you are building on a native installation, 80G of free
space is required for this compilation.
b) Almost no hassles and errors on environment issues
c) VM goodness – My PC ran out of battery while I had the build running but the PC shutdown after a “save”, when
I powered it up again, the build exactly ran from where it had stopped.

Comment/Send me an email if you have questions, more than glad to help! And oh yeas – please
Share/Like the blog if it did help you.