Start Here !

Welcome to my website. Find articles, presentations, tutorials, experiments on various technologies.

You can get in touch with me anytime at

r o m i n . i r a n i @ m i n d s t o r m s o f t w a r e . c o m

I am also active on Twitter (do follow me) and on Google+.


December Tech Talks : GDayX Mumbai & DevFest Ahmedabad

December has been a busy month for talks. Among the various talks that I did, a few of them stood out for the audience, topic and size of the event. Also enclosed are the presentations for each of those talks.

GDayX Mumbai , December 13 2014

This was the first GBG Mumbai (Google Business Group) meeting that I was attending and GDayX Mumbai 2014  was a superb event. More than 15+ talks across the day where one entrepreneur after another gave us practical advise on how they are going about doing business. I learnt a lot from this event.

I did my little part by speaking on “Wearable Computing”. The talk was titled “Getting Business Ready for Wearables”. The talk gave an overview on the current state of the wearable market, the areas in which wearable computing is making a splash, the business factors to consider before bringing in wearables into your organization and user experience.

Google DevFest Ahmedabad, December 14 2014

GDG Ahmedabad always rocks! And I was glad to be a part of DevFest Ahmedabad this year. The event was attended by more than 250-300 developers and held sessions across 2 tracks : Mobile and Web. I gave 2 talks at the event:

  • Powering your Apps via Google Cloud Platform : This talk gave an overview of Google Cloud Platform and then zoomed into developing REST APIs using Google Cloud Endpoints with a final demo showing how we used Arduino, Python and Google Cloud Platform to not just record temperature but also push it into the Google Cloud and use Google Big Query eventually for Analytics.
  • Gradle –> Your friend in Android Studio : This talk addressed 2 important tools that I believe all Android developers will eventually have to learn : Gradle and Android Studio. My goal in the talk was to explain the concepts of Gradle (almost following the 80:20 rule) and how it all fits within Android Studio (multi-module projects, product variants and more).

I wish to thank the chapters (Google Business Group Mumbai and Google Developers Group Ahmedabad) for giving me the opportunity to speak and meet up with fellow professionals.

Please reach out if you have any questions and would like to get more details.

Book Review : RESTful Java Patterns & Best Practices

This is a book review for Packt Pub’s RESTful Java Patterns & Best Practices.


REST Services are the glue that modern day web applications are built on. Often it is easy to get carried away and design a REST endpoint in any which way you want because the HTTP protocol makes that possible. But given the fact that APIs are becoming important and that clients expect high quality REST Endpoints that implement the correct RESTful style taking all the HTTP verbs into action, it is critical that you adhere to best practices. And this is where this book fits in perfectly.

The author, Bhakti Mehta is a founding member of GlassFish Open Source Application Server and all the experience is packed into the book with patterns and best practices in various areas of RESTful Services.

The first chapter gives a quick overall review so that you are on the same ground and then the later chapters deal into each important area of RESTful API design. The areas include:

  • Resource Design : This goes through URI patterns, Content Negotiation and one of my favourite topics i.e. API versioning
  • Security and Traceability : This talks about the current and emerging standards when it comes to securing your endpoint. I found this section a little bit hollow on implementation details.
  • Designing for Performance : This section talked about Caching, Partial Updates and designing APIs that in turn perform long-running jobs asynchronously.
  • Advanced Design Principles  : This section covers pagination, i18n, rate limiting and touches upon the highest form of the Richardson Maturity Model i.e. HATEOAS

There are also examples of popular public REST APIs from Twitter, Facebook, Paypal and more – so that the reader can look and relate back to the contents of the book. In that way, the book is practical to the core.

Overall, I will be keeping this book handy whenever I need to look up a particular aspect of RESTful Design and this is a great book to go through once you have deployed a few RESTFul APIs in Production and are looking to give them an extra edge.

Temperature Logger powered by Arduino +

This blog post gives an overview of how I created a simple IoT project using Arduino, a Temperature Sensor and the excellent Database as a Service.

First up, let me explain what the eventual goal is and how this is a first step in that process. The goal is to setup a series of low cost climate/environment modules that capture various types of data like temperature, humidity and more. Then take all this data and put it in the cloud where we can eventually build out dashboards, alerts and more. This blog post explains one single setup where we create a system comprising an Arduino Uno, a temperature sensor, a Python application that can read the data from the Arduino Uno (yes, I did not use an Arduino Internet Shield) and post that data to the cloud.

Towards this goal, chosing Arduino as a microcontroller is a no-brainer though I do plan to look into other controllers in the near future. Once our system is collecting data, ,the important thing is where do I put this data. The Cloud comes up as a rational choice to eventually have all Temperature Sensor stations push their data and we can monitor and build dashboards from a single place. The choice was to build a backend using tools like Google Cloud Platform’s App Engine but that would mean quite a bit of extra work for something that is not immediately central to this project. I went with, a Database as a Service provider that makes it dead simple to funnel your data from sources into your database in the cloud, as the post will eventually show.

The Hardware Setup

I used the following:

  • Arduino Uno microcontroller
  • LM35 Temperature Sensor
  • Eventually we will have the Raspberry Pi that interfaces with the Arduino to read and transmit off the values but to validate things for now, the Uno was powered via a laptop/desktop with Python installed on it. The communication between the Uno and the PC is via serial port communication.

Arduino Uno + Temperature Sensor Setup

Here is how the LM35 sensor is connected to the Arduino Uno board.


Ofcourse, we used a breadboard to connect all this together but I am simplifying the diagram here so that you know what is connected to which pin. The LM35 has 3 pins. The first one goes to the 5V power pin on Arduino, the 3rd one is the GND and the middle pin is the VOUT where it emits out the values that we need to capture. We connect this to the Analog Pin (A0) on the Arduino. We can then write our Arduino code to read that value, as is shown next.

Arduino Code

The Arduino Code is straight forward as given below:

float temp;
int tempPin = 0;

void setup()

void loop()
 temp = analogRead(tempPin);
 temp = temp * 0.48828125;

You will notice in the loop that every 10 seconds, we are printing out the temperature value that was read from the Analog Pin (#0)

If you run the Serial Port Monitor that comes with the Arduino IDE and if the Arduino is powered up and connected as per the diagram shown, then you will find the Temperature value being printed on the Serial Monitor as given below:


Once this happens, we know that the Arduino setup is looking good and all we need to do now is to write a client program on the PC that interfaces with this Arduino, read the values via the Serial port and then push them to the Cloud (Database Service).

But first, let us take a look at the Database Service setup that we did. Setup is a Database as a Service provider. One of my reasons of going with is to eventually make use of their strengths in providing a solid REST API around your data. What this means is that I am just not interested in making sure that it is dead simple to store my data in the cloud. Eventually I will need an API that allows me to do sophisticated searches, time ordered events and more and fits that model.

One can get started for free with to check out their service and which is what I did. It gives you one application that you can create for free along with a 50K API calls limit / month, which is good enough for my prototype for now.

Once logged into, I created the Application by clicking on New Application. It popped up a dialog where we provided the Application name (Temperature_Log) and selected a data center as shown below:


That’s it. The Application is created and the next step was to just define the Collection. A collection is similar to a Table into which all the data records would go. Orchestrate will figure out from the data that you upload and create the schema accordingly for you. So all you need to do for now is to define your collection and which is what I did. 

Simply click on New Collection and then I gave my collection name as given below:




That’s all I needed to do to setup my Application and one collection in

If you go to the Dashboard, you will see the collection for your application along with the API KEY that we shall use soon. The API KEY will be used when posting data into Orchestrate from your client application and is used to identify yourself to the Orchestrate service.

Python Code

Now, let us move on to the Python code that interfaces over Serial port to read the temperature values from the Arduino setup and posts that data into

The steps are simple:

1) We initialize 2 things: the API Client using our Key. And then we initialize the serial port communication via which we will be reading the Temperature values that the Arduino unit will be emitting every 10 seconds. You need to figure out which Serial Port on your machine is interfaced to the Arduino.

2) Every 10 seconds, the code will read the value from the Serial Port. We can obviously build in more validations in the code, but this is good for now to demonstrate how all the pieces come together.

3) Once we get the data, it will use the REST service to post data into your Application data collection. To make things easier, has a solid list of client language APIs available that you can use to ease your task. I used the Python client library for To setup that library all one had to do was

pip install porc

The important thing to note in the POST to Service is the code. Here, all we are doing is specifying the collection (Temperature_Data) that we had created for our Application in and the Data. The Data is specified in JSON format and the fields that I am specifying are:

  • Temperature in Centigrade
  • Date of the recording
  • Time of the recording
  • Location Name (Weather Station Name).

Take a look at the Python client program below:

import serial
import time
from porc import Client

API_KEY = "Your API Key"
# create an client using the default AWS US East host:
client = Client(API_KEY)

# make sure our API key works

#Connect to Serial Port for communication
ser = serial.Serial('COM15', 9600, timeout=0)

#Setup a loop to send Temperature values at fixed intervals
#in seconds
fixed_interval = 10
while 1:
  #temperature value obtained from Arduino + LM35 Temp Sensor
  temperature_c = ser.readline()
  #current time and date
  time_hhmmss = time.strftime("%H:%M:%S")
  date_mmddyyyy = time.strftime("%d/%m/%Y")

  #current location name
  temperature_location = "Mumbai-Kandivali"
  print temperature_c + ',' + time_hhmmss + ',' + date_mmddyyyy + ',' + temperature_location

  #insert record
  response ='Temperature_Data',
                          "date" : date_mmddyyyy,
                          "time" : time_hhmmss,
                          "value" : temperature_c})
  print "Record inserted. Key = " + response.key
except ser.SerialTimeoutException:
  print('Error! Could not read the Temperature Value from unit')

Checking our data

The final step was to validate if our data was being transmitted successfully and into Orchestrate. All you need to do is to ensure that the Python code executes , you do get the Record inserted message.

A sample run of the Python code is shown below:


Once that is done, come back to Orchestrate Dashboard and visit your collection. A sample snapshot of the Search Query for my collection is shown below:


This validates the end to end working of the project.

In Summary

Arduino makes electronics prototyping fun. With languages like Python and services like, the process of collecting / transmitting  / saving the data in the cloud is made simple too. I hope to explore in more projects for their other powerful features like Time Events and Graphs.

You can use the steps outlined below to build your own version of a Data Collection IOT Project that uses the Cloud to store and analyze its data.

Till next time.



Android Studio Tips

The Android world is split in their choice between Eclipse and Android Studio as the preferred IDE. The momentum is definitely with Android Studio and in most of my talks this year, I have tried to push that message across to the developers that they need to start getting familiar with Android Studio. Yes, there would be bugs in Android Studio but get into the game while it is early.

Having said that, productivity definitely takes a hit if you have been in Eclipse land and coming over to Android Studio. This is because you are familiar with short-cuts (strange key combinations) that help you not just navigate your way, open files/classes, refactor code , be super productive with the editor and much more.

There is a great set of Android Studio tips that have been prepared meticulously with description and video by Philippe Breault. They have been even collected into a Github Repository for your reference. This is a fantastic collection of tips and one you should pick up one by one to get familiar and see the power of Android Studio.

Here are the 2 resources for your reference:


Android Wear Talks

In the last month, I have presented on Android Wear on two Google Developer hosted events in India. Android Wear is a popular topic among developers and any talk on this topic brings up curious minds wanting to harness what wearable technology can bring to the table.

  1. Google Developer Group Mumbai : This event was held on 12th October 2015 at IIT Bombay. I covered a 2 hour session that introduced participants to Android Wear and how to get started on Android Wear Development. More than 120+ participants were present at this event. This session was followed up by a session on Material Design by Faiz Malkani. Check out some pics from the event.
  2. Google Developer Group Indore : This event was held on 1st November 2015 (as part of 2-day Devfest Indore) and we had a full day event dedicated to Android Wear. The event had a introduction to Android Wear in the morning following by a Code Lab and a Design Sprint on Android Wear. More than 60+ participants were present for this event.


Android Wear – Presentations, Code – everything for you

If you are looking at conducting similar Android Wear events, I have put up the entire material on Github. Feel free to use the material.

The material includes:

  • Presentation Deck on Android Wear Introduction
  • Code Lab PDF and 3 sample Android Wear projects to try out

In addition to the above, do check out official documentation from Google:

I have also created other presentations / blog posts that could be useful to you:

Hope you find it useful. If you have any questions – reach out to me.

Quick Tip : Set Up an Android Wear Emulator

If you are planning on Android Wear Development, chances are that you probably do not have an Android Wear device and wish to setup a Wear Emulator.

So, the scenario is something like this:

  • You want to get started with Android Wear Development
  • You have the Development Tools (Eclipse or Android Studio) and the necessary SDKs in place via the SDK Download Manager
  • You have an Android Phone Device
  • You do not have an Android Wear Device and wish to use the Emulator for that

Continue reading