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:
- Aggregation – Building an IoT device to capture the data (this blog post)
- Analytics – how do you process and analyze the data
- Action – how do you monetize the data
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:
- 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.
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.
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.
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…
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.
- 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.
- HTTP – RESTful APIs via HTTP/HTTPS to a server
- Websockets – this creates an open connection between the device and an endpoint to allow streaming of data
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:
- Arduino IoT Cloud
- Adafruit IO
- Bosch IoT Suite
- IBM IoT Platform
- Intel IoT Platform
- Particle Cloud
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.