top of page

Real time analysis in the cloud platform using Internet of Things (IoT)

Do the lights of your room turn ON as soon as you enter? Do you like to wear smartwatches? Have you seen the smart devices?

Have you pondered on how it works? What is the technology behind these devices?

It is the 'Internet of Things' - which in short is termed as 'IoT'. It has become one of the most prominent technologies of the 21st century.

What is the Internet of Things (IoT)?

We can see IoT being used in our day to day lives. We can connect electronic appliances, cars, thermostats, etc — to the internet. The physical world meets the digital world and they cooperate. The devices deployed in the physical surroundings collect the data & seamlessly communicate between people, processes, and things.

Kevin Ashton coined the term 'Internet of Things' in the year 1999. By definition, the Internet of Things (IoT) is the network of physical objects or "things" embedded with electronics, software, sensors, and network connectivity, which enables these objects to collect and exchange data.

By means of low-cost computing, the cloud, big data, analytics, and mobile technologies, physical things can share and collect data with minimal human intervention. In this hyperconnected world, digital systems can record, monitor, and adjust each interaction between connected things.

Lifecycle of IoT

The lifecycle of IoT basically depends on four phases - Collection, Communication, Analysis and Action. No matter what function they serve for users, these devices must have the following components for them to properly operate as parts of their respective IoT systems.

1) Collection: This serves as the first step of the lifecycle of IoT. The data is being collected from the environment for the IoT system to begin processing. It is collected by the sensors in devices that are being deployed in the physical surroundings. The sensors can measure and report the changes observed in the environment. E.g: A sensor say DHT11 measuring the temperature and humidity of a particular region where it is being deployed.

2) Communication: This serves as the second step of the lifecycle of IoT. Here we need to send the data collected (from step 1) to some destination say a cloud platform, a server, etc and for this communication to have any meaning, a device must have a unique identifiable presence on the internet, accomplished through its own IP address.

3) Analysis: This serves as the third step of the lifecycle of IoT. The data that is being received at the destination can be further analyzed through various representations or by building the reports. The technology called 'Data Analysis' can be applied to the data for drawing out significant results.

4) Action: This serves as the last step of the lifecycle of IoT. IoT devices should be able to take action based on data from their sensors and the subsequent feedback from the network. Here it also throws light on the actions being taken in sending important notifications & alerts based on the information and data that is being received. E.g: A valve in a smart factory can automatically open or close according to data gathered by its sensors along the production line.

Applications of IoT

The ability of IoT to provide sensor information as well as enable device-to-device communication is driving a broad set of applications. The following are some of the most popular applications.

  • Home automation - Different aspects of a connected home can also be remotely accessed and controlled by homeowners through a smart device.

  • Medical and Healthcare systems - Smart devices especially during this pandemic of Covid19 have emerged out from the researchers/students. IoMT (Internet of Medical Things) is the new term acknowledged for medical systems under IoT.

  • Environmental monitoring - Monitoring the conditions of the environment and receiving real-time data through the sensors deployed in the environment.

  • Energy management - Devices that can inform the household about the power consumption of the electronic appliances OR devices that can lower the power consumption by the appliances.

  • Smart Cities - IoT plays a significant role in smart cities. Improvements have been done in energy distribution, streamline trash collection, decrease traffic congestion, etc with the help of IoT.

  • Automobiles - Autonomous vehicles use different sensors in combination with advanced control systems to assess their environments and consequently drive themselves.

  • Better quality of life - An ease of world-class services is possible for the people through IoT. E.g., Smart devices that can alert the elderly to take their medicines on time or robots enabled with IoT bringing the medicines near to them on the scheduled time.

Communication channels in IoT

The four communication channels used by the IoT demonstrates how the connectivity of IoT devices takes place and adds quality to the overall user experience:

1) Device-to-Device: This communication channel shows how devices connect and communicate directly with one another. It is usually achieved through protocols such as Bluetooth, Z-Wave, and ZigBee.

2) Device-to-Gateway: The devices are communicated to the cloud via a gateway. Gateways can translate protocols and add an additional layer of security for the entire IoT system. Devices that have different communication protocols can be connected to a single gateway and work together.

3) Device-to-Cloud: IoT devices connect to the cloud allowing the storage of the data that is being communicated through Wi-Fi or ethernet. The cloud platform allows users and related applications to access the devices remotely as well as push necessary updates to the device software.

4) Back-End Data-Sharing: This is an extension of the device-to-cloud model that lessen issues with data portability. In this model, users gain access to and analyze a collection of data from different smart devices.

Let us have an insight on the cloud platforms.

The cloud platform is where all the data from the different devices is stored and processed. The data can be visualized through visualizations, graphs, and widgets and it is further analyzed for significant results. Popular cloud service platforms are Google cloud platform (GCP), Amazon web services (AWS), Microsoft Azure, etc. Although here we are using ThingSpeak - which is a free open source IoT cloud platform.

Integration of sensors with ThingSpeak

Let us start our journey to fulfill the objective of this blog.

Before starting to write your script, follow the steps mentioned below:

1) Download Arduino IDE and install it as per your system requirements.

2) Follow the installation guide for Node MCU (ESP8266) here

3) Visit ThingSpeak and sign in to create your account. Create your channels in the cloud platform as per your choice and objective. Add widgets to showcase the visualization distinctly.

4) Open Arduino IDE > Include library > Manage libraries > type 'ThingSpeak' in the search bar. Install all the libraries filtered out there.

If the libraries are successfully installed in the IDE, we shall see a different color in the words such as 'ThingSpeak' and 'ESP8266WiFi'

We will use the microcontroller Node MCU (ESP8266). Here we will measure the temperature and humidity of a region using a sensor. The data collected from the sensors will be stored and further showcased/analysed using ThingSpeak - the cloud platform.

Here we are using a DHT11 sensor that measures the temperature and humidity of the region whereby it is deployed. The sensor will be connected to the pins of the ESP8266 microcontroller. As seen from the image of DHT11 below, it consists of 3 pins. We connect the middle pin to 'D0' of ESP8266, whereas the first and the last pins are connected to the source and ground respectively (using jumper wires).

These are the pictures of the microcontroller (ESP8266) on left and DHT11 sensor (on right)

Login to ThingSpeak after creating your account. Go to the section of Channels > My Channels > New Channel. Create your new channel by giving a name relevant to your objective, choose the number of fields, and name them accordingly, whereby we will showcase the data collected from the sensor. Here we will choose two fields - to visualize the real-time temperature and humidity data. Save the channel after successfully including the topics. Your channel will have unique ID and API keys that will be used to write/read the data.

We can also make the data here public or private depending on our need by changing the settings of the channel.

Now, connect your PC/Laptop to a wifi network, the same network's ID and password are to be provided in the code since the microcontroller contains an inbuilt wifi module, and hence it will communicate to the cloud using the network. We write the code in the Arduino IDE which will integrate the sensor data with the cloud platform through the gateway.

Let us now begin to write the code in Arduino IDE:

1) The code can be found here for the integration of the DHT11 sensor with ThingSpeak cloud platform

A brief explanation of the above code & results

The above code connects to the WiFi network of the device after the SSID and password is matched. The code shows that a server is built which has enabled the communication. As soon as the connection is established, the sensor starts collecting data. The data that is being collected by the sensor will be printed on the serial monitor. Also, if any circumstances the connection is lost, the microcontroller will try to re-establish the connection.

Now, we have given the credentials of ThingSpeak that has enabled us to connect to the platform via the gateway. We have assigned the header files and defined the pin for DHT11 sensor. The data collected is being stored onto the variables and subsequently being sent to the cloud into two different fields via the gateway. Field 1 represents 'Temperature' whereas field 2 represents 'Humidity'. Real-time data is being updated on intervals there - that is being analyzed and stored. The figures below showcase the data printed in the Serial Monitor of Arduino IDE and visualization in ThingSpeak.

The above figure is from the serial monitor of Arduino IDE which prints the data as well as the IP address, once it is connected, whereas the image below demonstrates the data of ThingSpeak.

The channel feeds collected or stored can further be downloaded in different formats such as JSON, CSV, XML etc

2) The code can be found here for the integration of the DHT11 sensor with ThingSpeak and HTML page (locally hosted)

A brief explanation of the above code & results

The above code is the same as the previous code just we have introduced a new segment here with the help of HTML. The interface enables a user to view the data locally. The interface is being hosted locally and will be updated at regular intervals. We are able to get the IP address post executing the code - on browsing that we get the interface. The interface can also be viewed by mobile phones if it is connected to the same network.

The interface is shown below. Here the IP address that we have got after hosting it locally is The image below shows the HTML page with real time data.

Till now, we have been visualizing everything privately, now let's go a step forward and view publicly in ThingSpeak.

We can give the public access to the limited people as well to everyone depending on the need. In order to do that we need to change the public view and Sharing settings in the channel. The image in the left side shows the available settings.

I had shared the public access to one of the team members via email, the image below shows the data being updated in his account. The general public is also able to visualize the updates through some API links generated by the platform.

Security challenges in IoT

With more devices predicted to go online in the coming years, there are also some issues that is being faced in this technology.

1) Standards and Regulations: Standardisation and regulation issues can range from technical problems to legal matters. It affects the overall quality of services that IoT technologies render. Different smart devices may use various wireless communication protocols like Bluetooth, Wi-Fi, ZigBee, and 5G, hindering communication within IoT systems. On the other hand, lack of regulation highlights existing internet-related issues, as well as adding another layer of complexity to these issues.

2) Privacy: With the increase in the rate of personal information being shared over the internet, privacy becomes a concern for everyone. Since the IoT works better by getting as detailed a view of environments as possible, it presents a trade-off between user privacy and quality of service. Determining the points where data collection should be limited, or even stopping the collection of data altogether on account of user privacy concerns, is also difficult to achieve, especially with the automated nature of most IoT systems.

3) Security: The IoT adds its own security challenges with its access to a wide variety of personal information and its close integration into individual and organisational activities. These characteristics of the IoT make the technology a viable target for cybercriminals. In addition, any breach, attack, and vulnerability with a single IoT device or system weaken the overall security of the networks concerned.

How to solve security issues?

Different security practices may apply to different types of IoT devices and systems. Strong security features can be integrated from the design phase by manufacturers, while service providers can make sure that security is sustained by pushing updates and patches when necessary. Adequate cybersecurity solutions can add multiple layers of defense against unforeseen risks for all of the stakeholders. Taking a collaborative view on the safety of the IoT does not only protect things like personal and company assets but also has an extended effect of making the connected world more protected.

Future advancements

As per the reports on IoT, by 2020, it is estimated that there will be 20.4 billion devices connected to the IoT and by 2021—35 billion IoT devices will be installed worldwide, whereas the industrial IoT market size should reach $124 billion.

In a conference recently held at IIITDM Kancheepuram, Prof. Mischa Dohler who is a well recognised expert in Wireless Technology says After Mobile Internet & IoT, ‘Internet of Skills’ will be the next major tech breakthrough. Internet of Skills will enable us to transmit skills through the Internet.

References & Excerpts added from:

All photographs used here are compiled from different sources. We do not reserve any copyrights.

Please share your view in the comments. Drop a like if you really enjoyed this blog. Connect with me on LinkedIn
94 views0 comments

Recent Posts

See All


bottom of page