Bringing Modular, LEGO-thinking to the Internet of Things

4 min read Anmol Agrawal on Apr 16, 2015

This a guest post from Anmol Agrawal, an India-based UX/UI & Interaction Designer, and Full Stack Developer with Rails. Over the week, we’ll be publishing Anmol’s RubyBits, a blog series on hardware programming and the Internet of Things using Ruby.

Prolonged time pass with LEGOs has morphed my mind in such a way that most of the times, I absorb information in chunks.

As it is said, one of the best ways to solve a problem or understand anything is to break it into smaller pieces. Let’s face it, all the inventions and discoveries were made in this approach. Edison didn’t have a light bulb moment and invented the lightbulb, he didn’t EXACTLY invent it. He bought a patent of already existing electric light, formed a R&D team and created a bulb that was available commercially on large scale.

This approach is called modular design.

Coming to the point, what is RubyBits? RubyBits is a series created by me to teach about hardware programming (or hardware hacking/ Internet of Things stuff), starting from the basics, in modular design way, both software and hardware aspect.

Why Ruby?

1000px-Ruby_logo.svgI started working with Ruby a couple of years back. As soon as I saw that, I was like ‘this is it, this is my type of language’. Also, I came across Poignant Guide to Ruby, which is a comic book on Ruby programming language. Never thought I would see a day when comics and programming language manual would become one.

Here are the reasons I chose Ruby for this series:

  1. It is one of the easier languages to learn.
  2. Learning Ruby is a stepping stone to Ruby on Rails.
  3. Ruby knowledge is in demand. It is one of the top 10 most popular programming languages right now.
  4. Ruby community is very welcoming. There are existing codes that one can levarage called RubyGems. Most of these packages are well updated and documented. It is the language that is taught in most of the bootcamps like General Assembly. Plus you have access to plenty of books, screencasts etc.

So I started learning Ruby. There are tons of resources out there to learn Ruby, so you can choose whatever you want. I learned by taking two courses from Lynda: one on Ruby and another on Ruby on Rails.

It’s the programming language in LEGO form, right?

Why LittleBits?

littleBits tutorialsBy degree I’m a Mechanical Engineer, but I enjoy programming and UX designing. To get started with Internet of Things, I realized, I need to understand the electronics, and that was a bummer! The idea of understanding all the fundamentals of electronics, absorbing it and then getting started with IoT wasn’t pleasant. It was simply too much of learning curve in that approach and I didn’t know if I could sustain my motivation for that long.

I needed to get started quickly, do some rapid prototyping, gather some quick wins, get my motivation higher, and if everything went well, I might go deeper into electronics.

While I was in San Francisco and was volunteering in a Startup Weekend event, I came across the products from a company called LittleBits. At first glance, it looked like toys but as I spent more time with it, I realized “this is mind-blowing”. LittleBits have electronic parts in form of modules which stick together through magnets at their ends. No soldering, no breadboarding, where most of the time is wasted. It made rapid prototyping even faster. TED talk by Ayah Bdeir cemented my mind to get one of these:

This was hardware in LEGO form!

Where does PubNub come in?

I have always loved creating MVPs (Minimum Viable Products). While I loved the simplicity of combining Ruby and LittleBits, I wanted to show the complexity that could be achieved and what could be a better way than adding real-time feature to your projects. PubNub is the perfect solution as it has 70+ SDKs including Ruby, modules for different use cases like data stream, presence, security etc. Their documentation is super simple and their customer support is really awesome.


I thought Ruby and LittleBits are made for each other, a match made in heaven. I submitted my proposal at Garden City Ruby Conference 2015, Bangalore, India on the topic “Fun with Ruby and Arduino”. It got selected and then I had two months to prepare for it.

The Ruby community is not really into Internet of Things, so most people are not really aware of it. I had to introduce them to IoT and really take them through every step of development from the start. That’s why I took simple examples of working with LEDs but still increasing the complexity.

The plan is to continue writing more posts to learn and teach about work with RubyBits, build some projects on practical applications. If you guys have any ideas on what you want to do or see, some projects you wish to build or have built, feel free to share it with me. I will be more than happy to spread the word for it in the community.