Friday, January 4, 2013

VBot - Arduino based Quadbot

For a Software engineer who is busy writing code all through the day, working on real world objects is really a cool thing to do. Its fun to control the world around you with the code you write. I have been playing with Arduino for quite sometime and have built few hardware hacks based on that. Check out my hardware hacks here. The latest one in that series is VBot. VBot is a four legged robot which can walk, stretch and even dance. Video. There are different ways in which the bot can be controlled. The bot can receive IR signals and can be controlled using an IR remote. I have also built an Android app for controlling the bot. I have ported the firmware to JavaScript and there is a REPL interface to control to the bot from Node.js app. Fork the project on github. This project has increased my interests on hardware hacks significantly. Hoping to do more in the coming months. 

VBot - Android app

-- Varun

Sunday, September 23, 2012

Arduino tweet notifier built with Johnny-Five!

If you have been following this blog, or following me(@varunkumar) on Twitter, by now you would have found out that I am a big fan of JavaScript. JavaScript is everywhere. You can use it to write web servers. You can run it on your mobile devices. You can even use it as a build tool. And, of course, you can use it in its original home, the browser. But, what about running it on embedded devices? Can we control robots with JavaScript? Yes, developers have been successful in controlling robots with JavaScript. Read this interesting article on JavaScript robotics: "The Rise of JS Robotics". In the rest of this post, I will talk about Johnny-Five, a cool JavaScript framework for interfacing with Arduino boards. I will also show how easy it is to build a Tweet notifier (LCD display connected to an Arduino board displaying the count of mentions from Twitter).

What is Johnny-Five?
Johnny-Five is a JavaScript Arduino programming framework written by the awesome JavaScript developer Rick Waldron (@rwaldron). The framework which can be installed as a node module uses Firmata protocol to communicate with Arduino boards. Firmata is a generic protocol for communicating with microcontrollers from software on a host machine. Johnny-Five is a JavaScript implementation of the Firmata protocol which provides easy-to-use modules for interfacing with Arduino boards. Check it out here. Video

Getting started

  • Preparing your Arduino board. The first thing you need to do is to flash your Arduino board with Firmata. You can do it from Arduino IDE (File > Examples > Firmata > StandardFirmata). I tried it out on a Mega ADK board. Now, one end of your communication is ready. Software on the host machine will communicate this board using Firmata protocol. 
  • Installing Johnny-Five. As mentioned above, Johnny-Five is a node module and can be installed using npm (npm install johnny-five). johnny-five depends on node modules firmata and serialport. Note: You might have to build serialport for your environment using "node-gyp configure build".  
  • Writing Hello, world! In the context of Arduino, writing a hello world is nothing but glowing an LED. You have to write a Node.js JavaScript file and include johnny-five module. 

Arduino Tweet notifier
This is just a fun hack I have built with Johnny-Five (This is just for demo. You can do much more with JF). I have connected a 16x2 LCD display to an Arduino Mega ADK board (pins 8-13) and was writing data on it using Johnny-Five. Then, I have employed nTwitter module to get the stream of mentions from twitter. Whenever someone mentions @varunkumar on twitter, LCD will display a notification for the same. Check out the code here.







References:
Johnny-Five. Link.
Arduino & LCD getting started. Link.

-- Varun

Saturday, September 15, 2012

Animated doodle in CSS!

If you are following the developments on web browsers, you must be knowing the kind of changes CSS is going through. Lots of new features are getting added to CSS3 and you can do lots of stuffs with CSS. Here is a short post about an animated doodle which I had built purely using CSS3. I built this animated logo few months ago for a hackathon we had at our workplace. The speciality of this logo is that it is built only using CSS3 - even the circles and rounded corners are built with CSS and no images are used. You can verify the same with the help of any web inspectors. You can hover over the little guy and see him flip his ears, eyes, teeth, arms and legs. I have employed CSS transitions, CSS transforms and others to get the work done. The implementation is complex and not optimal. But, it is built just to demonstrate the power of CSS. Browser support: All latest browsers. The CSS used in this experiment can be found here. If you are not able to view the logo inline, check it out here. Have fun with CSS!! :)

-- Varun

[How to] Install Linux on Android?

As both the Linux and Android OS are open sourced, developers have enjoyed success in porting Linux on to Android and vice versa. Lots of efforts are still going on in this space. Canonical has been busy working on Ubuntu on Android which enables Android devices to run Ubuntu. “Linux on Android” is another awesome project which helps you to install and run a wide range of Linux distros on your Android device. An Android app has been released as part of this project which will guide you through the installation process. I tried it out myself on my Galaxy S2 and the process was very straight forward. Using this app, you will be able to install any distro as this just ‘chroot’ into the Linux image. This technique will run a virtual Linux on top of the Android OS without disturbing your Android OS. You could still use other apps installed on your Android device. We could replace Android with Linux completely but then you wouldn’t be able to use your Android phone as a phone anymore.

Pre-requisites:

  • Android 2.1 or higher. You need to have at least 3.5 GB of free space on your SD card. You can run Linux from internal SD cards as well.
  • Root access. You must have an Android device with Root access.
  • Support for Loop devices. Your Android OS must support loop devices. The stock image on Galaxy S2 didn’t have the support for loop devices. I have flashed the MIUI ROM with a kernel which supports loop devices. 

Steps to install Linux on Android

  • Download and install “Complete Linux Installer” app from Play store. Also, install VNC Viewer and Terminal App from Play store.
  • Launch the application “Complete Linux Installer”. This will guide you through the download links for different Linux distros.
  • Download the image and place it on your sdcard. By default, the launcher looks for the image directly on the sdcard (for ex: /sdcard/ubuntu). This can be configured from the launch menu. You can create a new launch configuration by specifying the image location and a name to it.
  • Select the configuration which you want to launch. This will open up the Terminal app with the chosen Linux image (say Ubuntu) mounted. If everything goes well, you should see this message “root@localhost:/#” on the terminal. This terminal will act like a Ubuntu command line. You can connect to the GUI from any of your favorite VNC viewer app (either on the same device or other devices).
    • You will be prompted for the root password, screen size and other options while mounting the Linux image.
    • If your kernel doesn’t support loop devices, you will get appropriate messages in this phase.
    • If you don’t have sdcard on your device, you might get some mount errors. You can ignore the errors (close the terminal) and re-connect to the mounted device again.
  • You are done. I have tried both LXDE and Unity desktops on S2 and both worked reasonably well.

Terminal Emulator with Ubuntu mounted

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device - LXDE desktop

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device - LXDE desktop

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device - Unity

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device

VNC Viewer running on Mac connected to Ubuntu on Android

VNC Viewer running on Mac connected to Ubuntu on Android

More information about “Linux on Android” can be found here.

-- Varun

Wednesday, August 22, 2012

JS Foo Bangalore 2012

HTML5 makes the web so powerful that we can do almost everything on the web. Till few years back, Flash was commonly used to build rich applications. Things have changed a lot with HTML5. Browsers are also becoming powerful day-by-day. Many desktop developers have already started moving towards web based application development. JavaScript is growing to be the most important programming language. In fact, the famous Khan Academy has chosen JavaScript as the first programming language to teach. As a developer, how do we keep track of the latest happenings? Though there are many online forums (like HTML5Rocks) to help us, the best way to learn is to hang out with fellow developers and the experts from the field. JS Foo is a tech event, organized by the good guys at HasGeek, which facilitates the interaction between JavaScript developers.

About JS Foo

JS Foo is India’s only conference on JavaScript, with editions in Bangalore, Pune and Chennai. It brings together JavaScript developers from different parts of the country, to share their learnings and help others transition to JavaScript. The highlight of the conference is its transparent system of public submission and voting on sessions. Participants have the control over the sessions to be part of the event. Yes, you can go to http://funnel.hasgeek.com/jsfoo/ to suggest a new session or vote for a session which you like. The schedule for the event will be prepared based on that.

JS Foo
About HasGeek

HasGeek is India’s first and only professional, community-focused technology event organizer. It was founded by Kiran (popularly known as @jackerhack) in 2010. HasGeek creates discussion space for geeks to collaborate. HasGeek has organized many successful events in the past like DocType HTML5, JS Foo, AndroidCamp, DroidCon, Meta Refresh, etc. I have personally attended some of their past events and really enjoyed them. Believe me, these guys are really awesome. :)

JS Foo Bangalore 2012

The fourth edition of JS Foo is happening in Bangalore on 19th -20th of October 2012. The theme for this edition is JavaScript everywhere. People are pushing the limits of what can be done with JavaScript on the server, in embedded devices, and in its original home, the browser. You can share your experience working with JavaScript and you can listen to the best practices in code and working style from the experts.

Date: Oct 19-20, 2012
Venue: NIMHANS Convention Centre, Dairy Circle, Bangalore
Pre-requisite: Basics of web development. You don’t have to be an expert in JavaScript.
Registration: http://jsfoo-2012.doattend.com/
Site: http://jsfoo.in (Site is still showing information about previous edition).

My Experience

I have attended the third edition of JS Foo in Chennai. It was an awesome experience. Learnt a lot of new stuffs. Check out my blog post to know about my experience at JS Foo Chennai 2012. You can also find the videos from previous editions here. I will be attending the event and might even give a talk on JS tools (http://funnel.hasgeek.com/jsfoo/). Hope to see you all at the event.

-- Varun
google-site-verification: googlea4d68ed16ed2eea6.html