IoT Aggregation – Building an IoT Device

This is the 2nd of a 4-part series on the Internet of Things (IoT). As I mentioned in my first post, there are 3 parts to the IoT architecture, in what I call “Triple A” IoT architecture:

IoT Triple A – Aggregation, Analytics & Action

Aggregation is the process of collecting data from sensors and storing it into a cloud provider like Amazon Web Services (AWS), Google Cloud Platform (GCP) or Microsoft Azure. For data aggregation there are 5 components:

  • Sensors
  • Microcontrollers
  • Wireless Connectivity
  • Data Transport
  • Cloud Providers


The sensors are the most basic part in an IoT device. Without a sensor how do you measure the air quality, the temperature or energy consumption to name a few examples. Suppose you are building an air monitoring device, the first thing you would is a sensor that can monitor PM2.5 levels.

One of the more popular sensors is the inovafit SDS011 from China (of course, where else from!). There are probably 100s of air quality sensor models you can pick from to fit the specific use case.


These sensors need power and also a place to send their data. That’s where a microcontroller comes into play. Not, microprocessor but a microcontroller which includes a processor, memory and input/output (I/O) peripherals on a single chip. You would never use a microcontroller to run Windows 10 or macOS since they are not fast enough or have enough memory on board. Some of the companies that produce these chips are Cypress, Microchip (which acquired Atmel), NXP, ST Microelectronics and Texas Instruments.

Microchip ATMega32

But the company that has really come on the microcontroller scene is Espressif and their ESP8266 and ESP32 microcontrollers. Their chips come with built-in WiFi which has become the de-facto standard for many IoT devices connecting to the internet.

However just because you bought a microcontroller and a sensor you can’t really do much. Because as you can see from the image above the ATmega32 microcontroller is just a another chip. That’s where development boards play a big part in the maker community to create cheap IoT devices quickly, almost like rapid prototyping.

Espressif ESP32 microcontroller (MCU)

You might have heard of Arduino, it’s an open source platform that sells dev boards and software to create IoT devices. The other big company selling dev boards is Particle which just raised $40 million to further expand their IoT offering. Another company that recently started to play in this space is Rasberry Pi, which launched their Rasberry Pi Zero which is a cheap dev board to compete with Arduino and Particle. And there are 100s of other dev board makers which is one of the reasons the IoT space is growing so rapidly because of the ability to build prototypes so quickly.

Along with the microcontroller you will need some firmware/software to run on it. All the MCUs have their own software but you can load other open source versions such as Arduino, FreeRTOS, MongooseOS, MicroPython or NodeMCU for example. The biggest constraint for these software options is the amount of memory available on the microcontrollers.

Wireless Connectivity

Since we are talking about IoT devices that implies it will be connected to the internet. Which means old school technology like an RS-485 serial connection is out of the question. Don’t get me wrong, I’m sure someone has created an RS-485 to WiFi module that speaks TCP/IP but if you are building a device from scratch, RS-485 or ethernet is probably out of the question. Although many older IoT devices have ethernet support, I’m willing to bet moving forward we will see less and less of them.

So that leaves us with all the wireless options which there are many. As always, it depends on your specific use case. So for example, an activity tracker could probably get away with Bluetooth connectivity since it just needs to connect to the phone and then the fitness app on the phone will upload the data to the cloud.

For most other devices it will come down to WiFi, GSM (2G/3G), LTE (4G) and 5G. Since 2G/3G networks no longer exist in many countries that further reduces the options. Narrow Band IoT (NB-IoT) which is a subset of 4G is another option for IoT devices since it supports low bandwidth devices. Jio the telecom giant created by Reliance is planning to rollout their NB-IoT network starting in 2020 in India.

Of course, the real push is for 5G since it can handle large amounts of data from billions of devices. The idea of having millions of high-definition 5G enabled cameras streaming to a cloud provider is the ultimate use case. If the network can handle large media streams then it can easily handle billions of smaller IoT data streams from cars, buildings, lamp posts, industrial machinery, etc…

Data Transport

Taking our IoT example, so far we have picked the air quality sensor and connected it to an ESP32 microcontroller. For the firmware we will use Arduino and since the ESP32 supports WiFi we will connect to an access point to get internet access.

The air quality sensor will be generating data and sending it to the microcontroller. Whichever firmware/software you select there are 3 ways to get the data from the microcontroller to your cloud provider.

  1. MQTT – MQ Telemetry Transport is the preferred method for sending low bandwidth information. MQTT is based on the pub/sub network protocol that transports messages between devices. It was created by IBM in 1999 and is open-source.
  2. HTTP – RESTful APIs via HTTP/HTTPS to a server
  3. Websockets – this creates an open connection between the device and an endpoint to allow streaming of data

Cloud Providers

Now that the data is in transit it needs to go somewhere. Luckily there are many cloud providers that can easily ingest all this data. There is of course the 3 biggest public cloud providers with their IoT offerings:

  • AWS has IoT Core
  • Google has Cloud IoT Core
  • Microsoft has Azure IoT

In addition, there are a host of IoT specific cloud providers that focus on the business of taking in all that data from IoT devices. Some of them include:

There you have it, we have gone through the steps of creating an IoT device from scratch and sending that data to a cloud provider. The next blog post will be about analyzing the data once it has reached the cloud provider.

Startups and Microfinance

I know, I know what do startups and microfinance have in common? And the last time this was tried it failed miserably…remember SKS Finance? I do and I wrote about it 8 years ago.

So what’s changed for me? A couple of things…first, I had the chance to meet Prof. Yunus at an event in Alibaug with about 100 other people. In 2006, he won the Nobel Peace Prize for founding the Grameen Bank and pioneering the concepts of microcredit and microfinance. Yes, that Prof. Yunus.

Prof. Yunus in Alibaug

The event was hosted by Nishith Desai Associates at Imaginarium AliGunjan their Blue Sky Thinking and Research facility in Alibaug. To say this facility is world class is an understatement! Prof. Yunus talked for about an hour about microfinance and what the future holds by talking about snippets from his new book – A World of Three Zeros.

Before I went to the event I Googled “Three Zeros” to understand the overall construct of the book. The one thing that stuck in my mind was, “how can he say have zero unemployment”. That seems so far fetched and out of touch with reality. Lucky for me, Prof. Yunus covered it very well and he is so clear in his thoughts it’s scary.

Essentially he says, we grow up in a system that makes us want to get a job and then when we don’t have a job we are unemployed. Why even go down that path of working for someone and instead be an entrepreneur then you are never unemployed. At this point he should have done a mic drop.

That was the first point, the second point was a question that was asked by Eric Maimon (yes, a New Yorker based in Bombay). His question was what can we do NOW and not wait for the future when Prof. Yunus and others were planning to gather in June 2020 in Munich.

That got me thinking, what if startups and other mature businesses got into microlending from a corporate social responsibility (CSR) initiative? The idea is that microlending would not be the main function of the company but as a way to help others.

The current trend in the Indian startup scene is funding startups that facilitate peer-to-peer (P2P) loans and SME lending which is just another name for microfinance. YourStory wrote an article about SME lending a couple of months ago and I’m sure since then, another 50 new startups have entered this space. But, I feel many of them will end up in the same situation as SKS. When you have margin expansion, hyper growth revenue targets and KPIs to achieve, you will just screw it up.

So for example, suppose you have a B2B SaaS platform that is used by kirana stores. Over time you can run some algorithms on the data and gauge their credit worthiness. And the interest rate you charge can be based on a benchmark like the State Bank of India FD rate for 1 year + 50bps to cover administrative costs. Yes, I know there is a tendency to say “let’s just charge as much as possible and make a ton of money.” However this activity should be thought of as a CSR activity and businesses will flock to these lower rates…imagine the stickiness of your platform. In the end, everyone benefits and that’s the whole point of what Prof. Yunus has been preaching since the 1970’s.

Introduction to IoT Devices

Initially, this was going to be a simple blog post about building an internet connected device more commonly referred to as Internet of Things (IoT) device. But, as I was gathering information I soon realized there is a lot that goes into building a device. So I decided to break this up into 4 blog posts over the next few months:

What is an IoT Device?

An IoT device is a piece of hardware with a single sensor or multiple sensors that transmits the data from the sensor to the cloud via the internet. Some examples of IoT devices are a fitness tracker, smart door locks, proximity badge readers, etc…

In an industrial setting they are called IIoTs (Industrial Internet of Things) and used to monitor the efficiency of machinery, room temperature and humidity, predictive maintenance, etc… In an industrial setting they have had sensors and systems for decades but that is all old school technology using RS-485 connections which means the data is usually stored locally.

There is a big trend called Industry 4.0 which is the “fourth industrial revolution” and part of that is to have these sensors connect via TCP/IP (the protocol of the internet) and send the data to the cloud where it can be aggregated and analyzed.

It’s easy to find reports on how large the IoT market is and all the big consulting companies will roll out their 2020 and 2025 future trends reports. But, I like to look at what the programmers have to say and what do they think of the technology and space. Below is a graph from the latest HackerRank 2019 Developer Skills Report and you can see IoT is at the top of what technology people feel is the most real emerging technology.

2019 Developer Skills Report – HackerRank

Even in a consumer setting the growth of IoT devices is explosive. Using a Nest Thermostat you can control the temperature of your home from anywhere. Using an August door lock you can literally open the door to your home from anywhere in the world. The Canary camera is a security camera that also monitors the air quality, temperature, and humidity in your home. All these devices have sensors that send data back to the cloud and then using an app you can control the various settings when you are not physically in your home.

The Market Potential of IoT Devices

Why is the market getting bigger and do we really need all these devices? I will not bore you with potential market size numbers but instead give you some examples of how the space is growing and why.

Take the above example I gave of the 3 IoT devices for a home, imagine you have listed your house on Airbnb those 3 devices make it so much easier to manage and understand the usage of your property. Without them putting your house on Airbnb would seem risky.

As I mentioned the industrial complex has always had sensors to monitor equipment but the data was always stored locally. With an IoT device the company can now aggregate all their data and make better predictions and spot trends much easier from a centralized team of machine learning experts.

Lastly, IoT is replacing repetitive tasks that previously were handled by humans such as energy meters. In India, the electricity bill you get every month has energy usage that has been collected by a person that visits every meter and takes the reading. Today, it’s a manual process in the future it will be replaced by an IoT sensor – that can detect the energy consumption, send that data to the cloud and then your bill will get generated.

The next post in this IoT series is about Aggregation, building an IoT device to capture the data and sending it to the cloud.