Tag Archives: technology

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 - http://temboo.com/sdk/nodejs
python - http://temboo.com/sdk/python

Once the SDK is copied over, clone the https://github.com/ghanashyamprabhu/eddie-timelapse repository. From the repo, Either of the main.js or main.py 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 https://www.dropbox.com/developers -> 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 https://temboo.com/library/Library/Dropbox/OAuth/ . 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 http://repo.opkg.net/edison/repo/all" >> /etc/opkg/base-feeds.conf
> echo "src edison http://repo.opkg.net/edison/repo/edison" >> /etc/opkg/base-feeds.conf
> echo "src core2-32 http://repo.opkg.net/edison/repo/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/main.py'

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



Emacs: macro within a macro

It has been around 4 years now that I am using Emacs and it feels awesome. You are an RTL engineer, probably you are no good to me without Emacs. Recently a friend of mine Anil Godasi (I call him the walking encyclopedia of HDL, you name the language he knows it and knows it __right__), asked me about an emacs query on how do we have nested macros on it. The answer was quite short, rename your last keyboard macro and you could call the macro as is. I am assuming he could not find it when he Google’d it and here is how we do it.

  1. Define the first macro
    C-x (
  2. Start your macro operations and finish defining the macro
    C-x )
  3. The macro is now defined, but then it is stored as the last-kbd-macro in emacs.
  4. So we rename the last-kbd-macro
    M-x name-last-kbd-macro
  5. Gives you a prompt to define the name for the macro as my-macro1
    Name last kbd macro : my-macro1
  6. Now get to defining the second macro and start your second macro.
  7. Call the first macro by
    M-x my-macro1
  8. Finish defining the second macro with a
    C-x )
  9. Execute the second macro with a
    C-x e
  10. This still calls the last macro and the last macro being defined was your second macro. You could still rename the second macro and call the nested macro in another third macro.


Documents are meant to be beautiful

I come across some really shitty documentations and some really nice document formats. Formats are important to documents, some might disagree that content matters more. But seriously aesthetics is what attracts you and what holds you on to something… That is why there are two words ugly and beautiful! So some documentation tips

  • A simple terse heading on the cover page with Author name, revision and date. — Just like one would not want to meet a crowd at once, one who not want showers of text information at the beginning of a page.
  • A small footer with Footer/Header in plain text colour, a slightly smaller font — It is the frame for the document Not a rough area to scribble tonnes of information
  • Insert a Table of Contents at the beginning of the document with Cross referencing
  • No Justified text for heavens sake, its like giving the reader a text to read on convex mirror
  • Use of inbuilt Heading formats
  • Do not increase indent as you go on with sub-headings. There is not point wasting so much indent space.
  • Bold Arial Headings and Regular TimesNewRoman(Arial) paragraph text
  • Use ‘captions’ options for Figures and Tables
  • Use Cross Referencing in paragraphs to point to Tables and Figures
  • Create inline diagrams. Do not insert .bmps or jpegs or cropped pictures.

Here is a document that I am maintaining for my usage, can be freely distributed and used. Git-SVN-Workflow and Moving to Git

Suggestions and more tips invited.