Wednesday, 30 December 2015

Introduction to the Internet of Things: What, Why and How

Content

     

 1. Background

There are several articles, infographic and tutorials that defines and explains internet of things. But then the question is why to write another article on the subject. As a developer when I look around internet to find more information about IoT, I get plenty of "conceptual" articles of what IoT is but very few elaborates the details from a developer perspective. Also it does not get immidiately clear as to what kind of hardware and devices, software and services falls under IoT. Also what basic and migration skills a developer needs in IoT are also not clear from the basic articles. So in this article, I would focus to elaborate IoT as a developer perspective and would try to narrow down the more generic topic into specificities. I would also try  to elaborate upon the basic tools you require to start with IoT development. So if you are a developer looking to know about IoT, this might just be the right article for you to bookmark. But if you are a marketing guy wanting some information for your presentation, save your time.

2. What is Internet of Things (IoT)?

2.1 Embedded System

Wikipedia says 
Quote:
The Internet of Things (IoT) is the interconnection of uniquely identifiable embedded computing devices within the existing Internet infrastructure.
So Internet of Things or IoT basically is connecting Embedded System to internet.  So before we understand IoT, let us understand Embedded System a little.
 The heart of the embedded system is a RISC family microcontroller like PIC 16F84/Atmel 8051/ Motorola 68HC11 and so on. Most important thing that differentiate these microcontrollers with microprocessors like 8085 is their internal read/writable memory(EPROM). So You can develoop your light weight program ( in Assembly language or using Embedded C with software like Keil) and "burn" the program into the hardware. These programs keep on running in a loop. 
Interestingly in most embedded system a single program is burn with several subroutines. So unlike your PC, microcontroller device in an embedded system runs a single program infinitely.
You can connect several input and output devices with these microcontrollers which are either memory mapped or IO mapped. These simple hardware includes LCD display, buzzers, keypad (numpad) or even a printer. You connect several sensors through A/D interface. The devices can control Higher Power/Voltage/Current rating devices like fans, motors, bulbs using drives devices like relay-optocoupler and so on.
Figure 2.2 Shows a typical Coke vending machine and it's internal embedded system.
You can clearly see the switches, LCD and relays in the figure on the right.
Form simple DIY robots to more commercial systems like washing machine, ovens, AC controller, Cars,Hand held ticket printers, Hotel Mini Bill printers embedded system is everywhere around us. 
So why  such embedded systems are attractive?
1) Autonomous: That means you can build a system specific to a particular application. For instance some standard peripherals and a specialized program can turn a microcontroller unit into washing machine controller or an oven controller. Also embedded systems can be built specific to the requirement. Unlike a PC which you can not work with without a monitor, an embedded system may not mandatorily need a display unit.
2) Low Cost: The cost of the microcontroller unit is magnitude scale lower than a full fledged computer.
3) Low Space: Obviously figure 2.2 shows that an embedded system takes way too little space when you compare it with even the sleekest of laptops. So you can put such a system in your hardware system quite efficiently.
4) Low power: Most of the common microcontrollers out there which are popular choices for embedded systems operate at 5V and often need 5v regulated power supply which can be provided through a simple 9v standard battery with voltage regulator or directly from main by using a voltage rectifier with filter circuit. 
There are many other factors which includes I/O speed and cost, energy consumption par instruction and so on. So we get a fare deal of understanding of what an embedded system is and what contructs an embedded system.
But when you look at the miniature embedded system on right of figure 2.2, you see no keyboard. So how such microcontrollers are programmed? This is generally done by interfacing the microcontroller with PC. The kit is commonly known as "Programmer Kit" or "Burner". A typical atmel kit is shown in figure 2.3
Figure 2.3: Programmer kit for Atmel Microcontrollers
From device to device such a kit or the hardware required for burning a program in the microcontroller varies, but their general structure remains same. So the microcontroller of the system is put in the slot and interfaced with PC. Then a MC burning tool like Keil . We can use an Assembly program or Embedded C to write and burn program in the microcontroller. Finally we can connect and solder the other components in the final pcb to get the system working.
Well, that's how a general embedded system worked and probably will continue to do so.  
The important takeaway from the above discussion is that Microcontrollers in an embedded system needs PC interfacing for buring the program. But can the program itself communicate with PCs?
Most of the Modern microcontrollers are capable of Serial Communication. That is they can have a half duplex communication with PC using Serial port over either RS-232 or with USB port if a USB driver circuit is added.The advantage of such a connection is that data from the microcontroller can be logged also microcontroller can now communicate with more advanced programs like Java or C#.Net as most of these advanced programming languages supports serial communication.
For example suppose you are building a simple temperature display embedded system with fire alarm. A LM-35 sensor is connected with the microcontroller through 8 bit ADC. Microcontroller is connected with a 16-pin dual line LCD as seen in figure 2.2. So it keeps measuring temperature and displays in the LCD. Once the temperature exceeeds certain threshold, it triggers an alarm.
With the help of PC interfacing the temperature can now be displayed in PC monitor and periodically can be logged into a file or database for the the values to be analyzed at a later stage.
 So even certain basic operation like getting a bare embedded system to work needs extra hardware as the core microcontroller is just a single chip. The MC needs power circuit, ADC circuit, interfacing circuit and so on.
Therefore standard kits were developed which has this standard set of hardware embedded into a single board which can be used readily without having any external hardware.

2.2 Embedded Boards 

In order to standardize the hardware and associated software and provide basic and bare minimum hardware units required to have an embedded system work, standard embedded boards are developed with on board hardware components like voltage regulator, USB FTDI chip, A/D converter and so on. Different boards supports different Micrcontrollers and different CPU architecture. These boards are tailored made for particular applications like medical electronics, gaming and so on. Have a look at the image below for some sample boards.
Figure 2.4 Some Common Embedded Boards ( source :www.eurotech.com)
IDE ( integrated development environment) were developed for easy burning, debugging and developing software and firmware for production level system. So instead of dealing with single microcontroller unit and debugging and maintaining hardware in the chip level, you can now have more compact kits ready for more complicated needs.
However the kit that truely revolutionized Embedded Kits and given a wing to DIY guys was Arduino.  Though in this Article we will not try to teach anything about Arduino, we will acquire some basic understanding of Arduino which will help us understand IoT embedded boards at large.

2.3 General Introduction to Arduino Boards

Quote:
Arduino is an open-source electronics platform based on easy-to-use hardware and software.
Arduino is an architecture that combines Atmel microcontroller family with standard hardware into a board with inbuilt bootloader for plug and play embedded programming. Arduino Software  comes with an IDE that helps writing, debugging and burning program into Arduino. The IDE also comes with a Serial Communication window through which you can easily get the serial data from the board.

Figure 2.5 A Typical Arduino Board (Dicimilia)
This board has everything starting from ADC to USB controller to PWM ports. So you can now control relays or connect LCD into the digital ports on the top and directly connect the output pin of the sensors to analog ports in the bottom. 5v or 3v power required to drive different sensors can be directly taken from the power port on the bottom left side. The board can be powered either by USB or by connecting 9v battery in pin Vin. You can also drive the board with a standard 9v adapter. The pins are such that you can actually connect several hardware without any soldering just by inserting the wire or inserting sensor/device pins into Arduino pin holes.
Arduino can communicate with PC using USB cable and it is configured as slave device. Multiple Arduinos can be interfaced togather by making them connect through serial communication ( see pin 0 and pin 1 on top right. They enable Arduino to communicate serially with other device). Arduino can also become master to other peripherals like Fingerprint sensors which can be connected to Arduino through Tx-Rx pins.  
 I have developed several hobby and prototype projects using Arduino. You could sometime checkout myYoutube Channel's Arduino playlist 
Due to it's open hardware and software architecture you can really build your own board with your own requirement. However different boards of different size, architecture, power requirement and utility are already available in the market. Take a look of wide range of Arduino boards in figure 2.6.
Figure 2.6 Different Arduino Boards
We are not really trying to learn Arduino in this tutorial, but rather our aim is to understand IoT with the help of Arduino.
So with this knowledge that basic embedded system can be provided as a board with certain plug and play capabilities, we are more or less  ready to understan IoT has a whole.

2.4 Formal Introduction to IoT

Recall that we defined IoT as embedded devices which could be connected with internet. Having understood what an embedded system is and what a modern embedded board is all about it is not too difficult to perceive the idea of IoT.
Consider the following schematic of a temperature sensor being connected to Arduino
Figure 2.7 Schematic of Temperature sensor LM-35 Connection with Arduino
So using Arduino's IDE we can establish a Serial communication with the device and can read temperature value. Right? Or we can interface a LCD display to display the temperature. But how about checking out the temperature from any part of the world using internet? 
How about getting the temperature information in your mobile phone? or Getting the temperature as a tweet after certain interval?
Doesn't the scheme looks attractive? Yes it surely does. If you can connect your embedded device into internet, you can get sensor information online which can be viewed in wide range of devices including your tablet and mobiles. You can also control devices over internet. You can actually have several home appliences connected to your embedded system and the embedded system being connected to internet with unique ip address. Then you can actually instruct the device to yurin on or off certain peripheral devices by generating the instruction online. 
So Internet of Things or IoT is an architecture that comprises specialized hardware boards, Software systems, web APIs, protocols which togather creates a seamless environment which allows smart embedded devices to be connected to internet such that sensory data can be accessed and control system can be triggered over internet.
Also devices could be connected to internet using various means like WiFi, Ethernet and so on. Furthermore devices may not needed to be connected to internet independently. Rather a cluster of devices could be created ( for example a sensor network) and the base station or the clusterhead could be connected to internet. This leads to more abstract architecture for communication protocols which ranges from high level to low level.
Following diagram explain what is IoT all about.
Most interestingly, these devices must be uniquely discovered. For unique discovery of the devices in a Network, they need to have unique IP address. As number of IoT devices online is expected to supress 20 billion mark and that IPv4 can only support upto 4Billion unique addresses, IoT devices essentially have IPv6 addressing scheme. All these devices have either fixed or Subnet masked IP addresses of type v6.
Unique IP addresses makes IoT devices discoverable in the internet as independent node. This is the most important concept to have in mind to understand IoT.

 

3. What Devices Make it to IoT

Before we see what devices make it to IoT, we need to clarify a few more things here. So far we have seen that IoT are essentially emedded systems and smart objects connected to internet with unique IP address which can be discovered and communicated over internet. We have also seen that the IoT devices may have external peripheral like Actuators and Sensors.

3.1 Are Mobile Phones IoT devices?

One of the most common we see in day to day life are mobile phones. Mobile phone is essentially an embedded system with a processor at the core having display and keypad. They support wide variety of sensors like Ambient light Sensors, Accelerometer, Gyroscope and so on. They are connected to internet. Mobile phones gets IP addresses, can access internet. In other words it virtually fits every description of IoT. So can we call mobile phones IoT devices?
This doubt was clarified at a keynote event during Sept 2011's Mobile World Congress in Barcelona by Qualcomm Chairman and CEO Dr. Paul Jacobs.
Paul Jacobs talked about how mobile technology could be used to connect non-phone, non-tablet devices called IoT devices and objects to the Internet. In this future where everything is Web-connected, mobile phones will serve as the hub, or the remote control, for Internet of Things.
So IoT is internet connectivity of smart objects and embedded system other than mobile phones which can be connected with external hardware and Mobiles, Tablets, Laptops and PCs are remote control/access center of IoT. 

3.2 What are Smart Objects?

We find the mention of "Smart Objects" and "Smart Devices" quite often in general defination and description of IoT alongside network connectivity of embedded system. But what exactly are smart object?
Quote:
A Smart Object is an object that can describe its own possible interactions. 
  Any object which not only has a state, which has certain data associated with a state but an object which can also determine nature of connectivity, duration of connectivity and connectivity protocol are called smart objects.
Radio Frequency Identification (RFID), Bluetooth Low Energy (BLE), and Near Field Communication (NFC)  makes it possible to use our phone as readers. We can extract information from certain objects just by tapping it or bringing our device close to it. RFID tags does not have any embedded system nor does a NFC tag has. But data can still be brought to internet by reading through a reader. These are called smart objects.  Non-processor entity whose data can be acquired and migrated over internet falls under these category. 
Short-range low-energy sensor technology has given rise to smart objects. So say a T-Shirt comes with a smart tag. We can tap our phone over it and we get information about the quality of material, it's size, other color varients, dye information and so on which helps us making our purchase decision. As the information is acquired, it can be passed as a search query to obtain similar results where we can compare the price-quality for similar tags.

3.3 IoT Devices

If you keep track of the Sillicon Vally news then you are sure to know that IoT is the latest buzz. So many of the startups now are focussing towards IoT. Therefore when we are talking about IoT, we are basically talking about infinite possibilities, hardware and software platform. So when you try to find a list of IoT devices in internet, you might end up getting frustrated purely because it's is difficult to provide such list.
Therefore research of this particular subsection has taken significant time. Finally I have put togather somemost common and popular technologies in IoT to give you an overview of what devices are we really talking about.
We divide the IoT devices into two braod categories: The wearable ones and Microcontroller/Microprocessor driven embedded IoT devices. Some of the Embedded devices like Arduino Lillypad are minisque and you can further utilize them to make your own wearable solution. But in wearable I have included hardware which are pretty standard and IoT has only software scope for the developer.
I have also put some list oof common peripheral hardware that you might have to learn while working with IoT hardware in embedded level.
Figure 3.1 Common IoT devices and Technologies
So if you are not a hardware geek you can start with Wearable and start making apps for popular wearable platforms. If you are a hardware enthusiast, you can start with Embedded IoT platform. You may select any of the broader technologies like Raspberry Pi, Arduino or Galileo and startup with IoT development.
I am personally an Arduino fanboy and have done huge number of hobby as well as commercial projects in Arduino. I have also worked with PI. I can say that if your application is more "core hardware centric" ( means using actuators and sensors) Arduino is a great bet, but if your application is more data centric ( like creating a file server or a media server) then Raspberry Pi beats all other hands down. Galileo uses the same IDE as that of Arduino. So if you can learn Arduino, Galileo is an easy migration.  I am not ashamed to say that I have very much zero experience about the other hardware platforms.

4. IoT Platforms

At this stage we divide our IoT development into two parallel technologies: Wearable and Embedded. Developers can build apps for custom wearable devices like Peeble, Samsung Gear or can opt to create their own platform using Embedded solution and then can develop app for that platform.

4.1 Wearable Pltform

Tizen is fast becoming one of the most popular platform for Mobile and wearable devices. Tizen SDK comes ported with wearable emulator which makes it easier to develop wearable solutions for Tizen platform.
As fifure 3.1 suggests, a large Android Wear devices are now being made and marketed. Smart watches are getting popular by every day. Android Wear apps can be developed and tested in Eclipse. This Android Developer Guide helps you in setting up Android Wear development environment in Eclipse.
Salesforce is another platform which is coming up with awesome development environment, APIs in wearable technologies. Their solution is extended from Peeble to Google glass. Salesforce is really worth a try if you are planning to have a serious go at wearable technology as a career option. Checkout Salesforce Wear page.

4.2 Embedded Pltforms

Arduino  is probably the best starting point for embedded based IoT. Basic Android boards don't come with Ethernet shield and for Arduino to be able to work as IoT device, you need to select Android with Ethernet shield. Android Yun on the other hand is a board that comes ported with ethernet shield. You can actually order a basic board of Arduino like Arduino Decimilia or Dueminolova and learn the hardware basics like connecting sensors, working with actuators, serial communication and then you can go for Ethernet shield and look for more web based application for Arduino.
Raspberry Pi is probably one of the best things to happen in DIY IoT.  A wide range of Data driven applications like Home Automation Server toHome Multimedia server, File Server can be developed withPi. PI like Arduino has general purpose IO pins. But seamless working with sensors is bit tedious in Pi.
Another efficient IoT board is Intel Edision which has integrated BLE, WiFi among host of other features. It supports wide range of Industry standard hardware ( over 30) through 70-pin interface. What is important is it supports wide range of platforms including Arduino and Node.js
Intel Galileo is another good offering by Intel which supports the same shielding that of Arduino Uno. So it can be said to be first Intel powered divice which is Arduino compatible. It has among other thing a USB host controller like Raspberry Pi which makes this an attractive hardware. Galelio also has ethernet shield in built.
There was a time when Microsoft used to dictate echnologies and trends. Industries used to follow. That is no more the story. With several companies gunning for a space in wearable sector, microsoft seems to be doing all the catching up and does not look too impressive at this moment. None the less Netduino is a .Net Micro Framework based plstform where hardware is simillar to Arduino. But Netduino has 12 bit ADC as against 10 bit Arduino ADC channels and uses 32 bit Controller. There are few more differences. But the reason why Arduino is a better bet for me than Netduino is that I get an Arduino Dueminolova for under $10 where as Netduino is about $60. Though Netduino really has better multitasking, cost is a big factor for DIY guy.

4.3 Cloud Platform for IoT

Let's rediscuss the possibilities to beverage vending maching once more in terms of sheer possibilities. In the conventional vending machine you need to press a button or put a coin to trigger the process of liquid flow, which stops after certain quantity. Now how about integrating paypal or Google money with the vending machine? How about a customer discovering the vending machine as "website" along with it's location and then pays online for a glass ofbeverage. Once payment is successfull he gets an access token. He can pass the token to the machine through NFC and bingo he gets his drink.
Now this logical possibility is very important for understanding IoT and IoT really can bring several services ( like online payment gateway), several hardware platform ( like embedded board of the vending machine) and smart objects and data like NFC, GPS into a seamless environment.
Now if you can integrate online payment into beverage vending machine, why not in for a community washing machine? If you are using location service for beverage machine, then whey not utilize the location and payment service for the toll gate? Why not get the data of a medical diagnesis like ECG ( acquired through another embedded board partaining to medical electronics) into cloud such that several doctors can view it and form a comprehenssive opinion about the patient's state?
Well, infact all of them are possible. A little understanding of web and software design would take your mind towards cloud. Just like Web of Machines, in a Machine to Macine ( M2M) or Machine to Objects ( M2O) or any simimlar communication several modules will be common and several modules demands data to be available for sharing. Cloud APIs comes in handy in this regrad.
For instance when you have to make a device discoverable in web, you have to assign a fixed IP address, maintain a router and follow several networking skills. You might not have the knowledge and infrastructure needed for maintaining a commercial sophisticated network for IoT.
Yaler is a great example of what services and cloud can bring to table. This provides connection as a service such that your device is easily discoverable and communicable over the web without much hassle and take care of underneath security.
Axeda Provides infrastructure for M2M architecture.
OpenIoT is an open source IoT platform that provides out of other services a unique Sensing as  a Service. 
Google has already integrated location services with it's cloud. Location extracted from your devices are silently put in your status updates in facebook and twitter and are also used for more personalized searches.
So cloud APIs has a great potential in IoT in all levels of architecture starting from firmware to hardware to more top level architecture.

5. What IoT means for the developers

There have been few paradigm shift in computer industry. From Text operating system to Windows 3.1, then Windows 95, then internet revolution, the Google search engine revolution, eCommerce, Mobile phone, iPhone, Android. Each of these technological changes has seen many new opportinities being opened up for those who is eager to adopt to the changes. IoT is one such paradigm shift knocking our doors. It is opening up host of opportunities at both hardware as well as software level and would open up more standards in coming years. Hardwares will boil down to handfull of good baords, wearable will include few killing devices and platforms will have it's own popular choice like Visual Studio.Net and Eclipse of current computing platforms.
So, IoT really means that there is no stangancy and some cool opportunities calling the smart minds who can see it coming and can be ready by the time IoT actually takes the next giant leap.

No comments:

Post a Comment

What should you required to learn machine learning

  To learn machine learning, you will need to acquire a combination of technical skills and domain knowledge. Here are some of the things yo...