A Framework for IoT Sensor Data Acquisition and Analysis

Abstract


Introduction
In recent years, the urban population growth is increasing tremendously.The global urban population is expected to grow 1.86% per year from 2015 to 2020.In between 2020 to 2025 years, this increase will be 1.63% and 2025 to 2030 it goes to 1.44% approximately by the World Health Organization (WHO).In an urban population, there is huge popularity for cars and a minimum of two cars owned by one family.The popularity of private cars getting urban traffic is more.Because of this, traffic is becoming one of the big problems in urban areas all over the world [1].The heavy traffic in urban cities is leading to congestion, accidents that * Corresponding author.Email:balakrishna.sivadi@pec.eduhave affected by the property loss, waste of time, environmental pollution, and sometimes it goes to the next level of man's death.Therefore, there is a big need for traffic monitoring and reduction system in urban areas to become Smart cities [2].The best approach to solve this problem using the Internet of Things and it provides a new trend to intelligent traffic management.To improve the acquisition and data analysis, this paper intends to use the IoT technology, Cloud computing, Raspberry Pi and data acquisition technologies.The actual scenario of this research is as follows: The information generated by IoT devices data collected from the roads through gateways can be presented to all travelers and users.After collecting the real-time sensor data, the system can recognize the current traffic, traffic flow conditions and can predict future traffic in urban areas.After that, sensor data monitoring and sensor data detection have been measure for analyzing and visualize the acquired data.Based on the systemgenerated data may useful to drivers for choosing optimal routes.Therefore, the system is dynamically administrative, control and monitor on moving cars.If constructions on intelligent traffic system using IoT, then there is a lot of benefits for users such as improving traffic conditions, less traffic jam and high reliability, traffic safety, management costs and independence of weather conditions.Bridges, roads, tunnels, vehicles, traffic signals and drivers these are some of the traffic elements in IoT.All these items will be connected to the web for monitoring and identification through different types of IoT devices like RFID, sensors, actuators, Global Position Systems (GPS) and laser scanners.As of late fame of private engine, vehicles are getting urban activity more swarmed.As a result activity, observing is getting to be noticeably one of the imperative issues in enormous smart city framework everywhere throughout the world.Some of these concerns are movement clog and mischances that normally cause a critical exercise in futility, property harm, and environmental contamination.Any kind of clog on streets, at last, prompts budgetary misfortunes.In this way, there is a pressing need to enhance traffic management.The presence of the Internet of Things (IoT) gives another pattern to canny traffic improvement [3].This exploration proposes to utilize the IoT, specialist and other advances to enhance activity conditions and mitigate the activity weight.Data created by movement IoT and gathered on all streets can be introduced to explorers and other clients.Through gathered ongoing movement information, the traffic monitoring system can perceive current activity operation, movement stream conditions and can foresee the future movement stream.The framework may issue a few most recent continuous moving data that helps drivers picking ideal paths.Thusly, the framework can absolutely administrate, screen and control on moving vehicles.Developing a smart framework in view of IoT has a number of advantages such as change of activity conditions, lessening the car influx and administration costs, high unwavering quality, traffic security and freedom of climate conditions.Such undertaking of an IoT must incorporate each component of traffic such as streets, spans, burrows, traffic signs, vehicles, and drivers.Every one of these things will be associated with the web for helpful ID and administration through sensor devices, for example, RFID devices, infrared sensors, worldwide situating frameworks, laser scanners, and so forth.Undertaking the IoT gives motion data accumulation and combination supports preparing an investigation of all classes of motion data on streets in an expansive territory and naturally.Hence, present-day traffic administration is developing into a wise transport framework in light of IoT [4].The term 'traffic' will play the key role in accessing the logistics and services available on the road, so the developed system will be more reliable and accurate towards traffic management.The IoT sensor data will be produced along with various sensor-based technologies.This movement is observing that applications should ensure to keep any type of security attack visit in urban cities.Therefore, there is such type of model executions can be found in and the Smart Santander EU venture.
The rest of this paper is organized as follows: section 2 shows the related work of this study.The proposed IoT sensor data acquisition and analysis framework have been described in Section 3. Section 4 shows the performance evaluation of proposed work and it includes the experimental results and analysis.Finally, section 5 concludes this paper and future enhancements are directed.

Related Work
IoT sensor data acquisition and analysis are one of the biggest problems in this present living world.So many researchers have dealt and put their effort on this problem, as a result, several types of approaches have developed.Bhadra et al [5] have applied agentbased fuzzy logic technology involving multiple approaches and vehicle movements for traffic control situations.Based on a fuzzy neural network, has been proposed a traffic flow prediction mechanism in chaotic traffic flow time series.The authors Anupama Mallik et al. [6] developed various strategies for integrating dynamic data into Intelligent Transport Systems (ITS).P. Pyykonen et al. [7] applied in enterprise services for effective integration of Service Oriented Architecture (SOA) and Internet of Things (IoT).Due to the revolution in IoT, many of the researchers shifted their attention.Zhang et.al, proposed the more needful and convenient environment for sensor data collection and analysis in smart city applications.Ubicomp [9] and FeDNet [10] are different Internet of Things (IoT) systems for communication using message-passing techniques.The authors D. Bandyopadhyay and J. Sen et al. [10] proposed various applications applied in different domains like smart city, smart home, smart metering, smart transport and healthcare.D. Singh et al. [11] discussed the existing status of the smart city transport management system, the researchers have been move on real-time transport systems using the Internet of Things (IoT).X. Yu et al. [13] proposed a technique for choosing movement blockage on roads using picture getting ready techniques and a display for controlling activity motions in light of information get from streets taken by a camcorder.We isolate activity thickness, which thinks about to total range controlled by vehicles all over the place similar to the total of pixels in a video layout instead of figuring a number of vehicles.We set two parameters for yield, variable activity cycle and weighted time for each road in perspective of activity thickness and control movement lights, successively it is extremely time unpredictable and in addition sweeping.Therefore, M. Mazhar Rathore et al. [14] the opportunity has already come and gone for limited to manage the road turned parking slot issue.There are diverse systems open for traffic organization, for example, video data examination, infrared sensors, inductive circle acknowledgment, remote sensor framework, and so on.Each one of these procedures is effective procedures for sharp activity organization.However, the issue with these systems is that the foundation time, the cost caused for the foundation and support of the system is high.From now on, another development called Radio Frequency Identification (RFID) is introduced A.P. Plageras et al. [15], which can be joined with the present hailing structure that can go about as a key to splendid traffic organization constantly.Use of this new development will incite diminished traffic monitoring.Bottlenecks recognized early and thus early preventive measures can take in this way saving time and cost of the driver.Q. Liu Qiang Liu a et al. [16] presented display called dynamic movement observing framework.It implies that different influencing factors are ought to check.Sharmad Pasha [17] developed that GPS based vehicle ensuing framework.It gives to diminishing the short separation traveling's and in addition to the same substance is concentrated on different variables are to be thinking about convenient information submitting by utilizing VSNs vector remove directing calculation and gives the high dependable correspondence.It covering the range extreme separation fire gathering information.Akbar Adnan et al. [18] made an RFID based conceptual model on insight into motion control framework.It controlling movement stream, decreasing mischances in rush hour gridlock spots and remote area transmission.Therefore, after careful observation of all these literature surveys, there is a need for acquisition and analysis of IoT sensor data in an efficient manner.
These are the following contributions made on this proposed approach: 1. To propose a novel framework for IoT sensor data acquisition and analysis by obtaining real-time data.2. To analyze the gathered sensor data on providing some relevant feature extractions to show the daily and weekly wise sensor density conditions.3. To find the accuracy, precision, recall, and f-measure of the proposed framework.4. To compare the obtained results with existing the most relevant state of the art schemes in an efficient way.

A Framework for IoT Sensor Data Acquisition and Analysis
In this paper, to develop an Internet of Things (IoT) based smart real-time traffic monitoring system, used a ThingSpeak, Raspberry Pi 3 Model B, and a webcam to analyze traffic on a busy highway.Then connect the Raspberry Pi device to the machine for deploys and configure traffic-monitoring algorithm.ThingSpeak-a cloud aggregator used to store the data, analyze and visualize the data online.
In the Internet of Things (IoT), the analytics are used anywhere: 1.The edge node 2. Offline on the desktop 3.In the cloud Here we have shown how to monitor the real-time traffic data on the busy highway and how the realtime data collected on the cloud.After storing, the aggregated data on the cloud can perform analytics for the edge device and finally perform analysis on the cloud data.The Fig. 1 illustrates a framework of workflow analysis and perform online analysis on the stored cloud data.In this framework, uses ThingSpeak for both storage and analysis.
The proposed framework based on Internet of Things may consist of four layers as shown in Fig. 1 Those are the Sensing layer, Data processing layer, IoT sensor data analysis layer, and Application layer.

Hardware Setup
In order to develop a proposed framework, we used Raspberry Pi 3 Model B and a USB webcam.We placed a USB webcam near a window on the second floor of house building that overlooks national highway road 2, Tirupati, India.To get a clear view of vehicles places the webcam may place both sides of the highway.

Deploying the Algorithm to the Hardware
In order to develop the traffic monitoring algorithm, we used following a list of parts available in MATLAB 2016a.The USB cam placed for a particular region of highway and vehicles is moving from left to right.The USB webcam connected to one USB port of the Raspberry Pi captures video with a selected region.Next, authors are used the ForegroundDetector for estimating low vision and pixels of a video sequence captured by the USB webcam as shown in Fig. 3.It estimates mainly using Gaussian mixture models and produces the appropriate results on moving cars.
To avoid and remove the unwanted noise in the ForegroundDetector mask post-processed by using MedianFilter for analyzing the Post-processed data used the Blob Analysis block-that computes centroids of the blob containing the cars.The Car Density block counts the number of vehicles travelling both eastbound traffic and westbound.Traffic direction in that video frame.This Car Density Block divides the video capturing region into two sections along with the highway median.
After that, the real-time traffic streaming data sent to ThingSpeak-the data aggregator for analyzing & visualizations.Here individually we sent vehicle count value to each eastbound and westbound region.We send both eastbound traffic and westbound traffic values to ThingSpeak (Channel Id) and store the westbound value in field1 and store the eastbound value in field2.
In our earlier work [1], we have focused on accuracy detection and presented an approach to address traffic challenges.In this paper, we improve our initial approach to make it generic for heterogeneous IoT sensor data acquisition and analysis, finally extend our experimental evaluation and implement it using open source components, which were optimized for large-scale IoT data streams.
A Framework for IoT Sensor Data Acquisition and Analysis Output: Generating high traffic load or low traffic load.

Analyzing Data on ThingSpeak
The traffic-monitoring model done by using Simulink deployed into Raspberry Pi hardware device.Then we can start analysis on real-time disseminate data stored in the ThingSpeak cloud aggregator sent by the Raspberry Pi 3 Model B fetching from ThingSpeak.

Reading one week of data into MATLAB
Already we discussed that ThingSpeak allows receiving data from Raspberry Pi once every 15 seconds.In addition, it retrieves approximately 40,000 data points only.In a single read operation, ThingSpeak allows only 8000 points.Therefore, we need to create for loop to gather the real-time sensor data in batches.Here each iteration divides into two vectors namely all traffic data and timestamp and then append the traffic and time.
Plotting traffic data and next, we need to plot the graph as well as label the graph.From the raw data, the daily fluctuations in traffic are clearly visible.Daily fluctuations are hardly changing from weekdays to normal days.We can observe a different pattern on the weekdays (18/12-22/12) compared to weekend days (16/12 and 17/12).Due to communication traffic, the weekdays show stronger in morning and peaks in the afternoon.

Viewing at Day-to-day Mean Bulk for Eastbound and Westbound Traffic and Plotting
In order to visualize (or) measure the traffic density each day, first, we can average the traffic density observations.A bar chart used to visualize data.We observed that Monday traffic is higher than both Sivadi Balakrishna et al.

EAI Endorsed Transactions on
Internet of Things Online First eastbound traffic and westbound traffic that follows the weekend.
For visualize a one-week density data using both eastbound and westbound traffic information use GMM model.If you observe the Fig. 4, the total number of moving vehicles is to be counted on both westbound and eastbound traffic density information on the starting date as 16 th December to ending date as 23 rd December.The corresponding traffic counting using eastbound and westbound traffic density shown in Fig. 5

Taking a closer look at individual days during the week and on the weekend
Look at traffic on the individual days, to gain more insight into traffic data.For that, we can take each day, specify a start time, and stop time as parameters.

Fetch each individual day in a loop
We retrieve all the 7 days data from ThingSpeak and down sample the real-time traffic data to remove short-term fluctuations.To find times and plot where the traffic density is the highest use the findpeaks function and observe for each day.We look at the eastbound traffic data for simplicity.

Estimating Traffic density
The estimation of traffic density is based on DBN (Dynamic Bayesian Networks) for finding situation tracking in real-time.Algorithm 1 shows the total steps for measuring traffic.1. Detecting moving and non-moving vehicles: for finding the total count of vehicles in an appropriate video, have to use the GMM and SPP-net models.

Calculate the stopped vehicles and moving vehicles from total count of vehicles:
In order to calculate both stopped vehicles and moving vehicles, first, find out the velocity of the vehicles.If the velocity is zero in position, then the status of that vehicle is stopped vehicles C t sv, otherwise it is counted as moving vehicle C t mv.SPP-net model is used for finding the count of moving a vehicle is: C t sv= C t tv -C t mv, here t ranges between 1 less than are equal to n.

EAI Endorsed Transactions on
Internet of Things Online First

Downsample into 48 silos of approximately 30-minute masses of data and find heights
The generated real-time raw traffic data is hard to visualize and very spiky also.Therefore, do you want to see the highest volume in a particular time in a day then we need to look at the data on a time scale greater than 15 seconds do.For calculation of this divide, the 24-hour day into 30 minutes segments.Here each segment begins near the top of the hour and means while end time at 30 minutes later.Fig. 6 shows the individual date traffic information.

Weekend observations for Saturday, December 16
This is first-weekend day observation of traffic pattern and many peaks are scattered throughout the day but the maximum peak times occur at 1:52 and 3:51 time.This is not surprising as the highway connects many big industries and data centers that frequented during weekend days only.

Weekend observations for Sunday, December 17
On Sunday, the traffic patterns are similar to Saturday.This day also having so many large peak times occurred, but maximum peak times occurred afternoon again at 1:52 and 3:51 pm.

Weekend observations for Monday, December 18
On Monday, we have been seeing a working day for all employees and for normal people communicates to their destination places to and from work.We observed the morning rush from 7:55 to 8:25 am and scattered as large peaks.Again evening also the employees are reaching their destination, so evening rush at 5:19 pm and 6:48 pm.We even see a strong peak time fluctuations at 12 noon as people go out for lunch or perhaps.

Online Analysis and Visualization: Creating Visualizations inside ThingSpeak
As of now, we had developed traffic monitoring algorithm using Simulink model and that has deployed onto the Raspberry Pi 3 Model B. Then we programmed for traffic monitoring algorithm and send the results to the ThingSpeak IoT Cloud platform for online analysis and visualizations.After that, we took one-week traffic patterns and performed some analysis on that and get results like when is the maximum peak times occurs and when is the low peak time occurs at daily wise.We used eastbound traffic and westbound traffic for measuring a number of vehicles are moving on both ends.It is easy to calculate the mean value for daily and weekly traffic data observations.To do this we set a threshold value for finding moderate or heavy traffic patterns based on our deep observations.This code will automatically update whenever the ThingSpeak IoT Cloud platform has viewed.So now, we can easily find the heavy traffic timings on this highway road as shown in Fig. 7.   1.The results shown in Table 1 of our proposed FSDAA is considered as 10 nodes.
Table 2 depicts the results of the various metrics by varying nodes with proposed FSDAA in percentage at the selected region of this paper.The number of vehicles or simply called as nodes are varying starting from 10 to 50.On average, the increase of TPR is 23% by changing the nodes from 10 to 50.Similarly, TNR is decreased from 86-53%, FPR has been decreased by 15-67%, and FNR has been decreased by around 18-75% from 10 nodes to 50 nodes simultaneously.The percentages of FPR and FNR is decreasing means an increase in success rate because the false value in decrease means the increase in the success rate.
The reasons behind the success of FSDAA scheme compared to the baseline approaches considered for analysis are due to the efficient use of Simulink model and testing samples induces more accuracy, true positive and true negative since they employ better combination for testing such that maximum alternatives are used for detecting the moving vehicles.
In addition to, the time complexity of FSDAA scheme is determined to be TComplex = O(MS) = O(n 2 ).This time complexity is initially derived as TComplex = O(MS) since the processing time majorly depends on the acquiring of input video sequence 'M' and the number of detected sensor data 'S' in each input video.Further, the number of optimal features influencing the decision making depends on the number of clusters 'C' formed from the input vector of size 'M', Thus S = O(N) and hence the total time complexity of FSDAA is TComplex = O(n 2 ).

Conclusions and Future Directions
The data analytics are existing everywhere in the Internet of Things (IoT).The huge volume and variety of data are generating nowadays.Therefore, how to acquire the sensor data and performing analysis in the sensed data is a challenging task.In this paper, the authors have been proposed

1 .
Sensing layer: This layer is used to collect the data coming from different IoT devices.This is the lowest layer observed in the proposed framework.It captures the various heterogeneous types of data acquiring from heterogeneous IoT devices like sensors, actuators, protocols, and data formats, etc.The high amount of big data is transferred to the next level layer i.e., Data processing layer for performing the data analysis and processing raw data.2. Data processing layer: This layer is used for acquiring the needed data from the physical layer collected raw data.The data processing layer mainly consists of two sub -modules namely-Feature extraction, and Foreground Detector data.The feature extraction is used to extract raw data by applying the camera vision techniques like SPP-net and GMM to manage the real-time smart traffic data and detect the high traffic congested data on busy roads.The acquired data is sometimes may be simple or sometimes may be complex.Therefore, based on the representation of sensor data, both feature extraction and foreground detector data is transfer to the next layer i.e.IoT sensor data analysis layer for performing meaningful data as well as interpretation by providing Simulink and data integration approaches.3. Data analysis layer: This is the crucial layer for this proposed framework.The Simulink model has been applied to this layer.It will take the data after preprocessing applied on data processing layer to annotate the IoT sensor data.The ambiguity of the foreground detector data is minimized by applying the Simulink model.The ThingSpeak based domain knowledge systems have used the contextaware data to predict the real-time traffic data for reducing the traffic jams and unforeseen delay.4. Application layer: This layer is used to perform analysis and visualization of the acquired IoT sensor data to the users using ThingSpeak cloud platform.This layer is generates traffic alerts, count of vehicles in real-time situations.These analyzed and visualized data is applicable to IoT smart city applications of smart traffic, smart home, smart grid, and smart health etc.

Figure 1 .
Figure 1.The proposed framework for IoT sensor data analysis

1 . Simulink 2 .
Image processing Toolbox 3. Computer Vision System Toolbox 4. Simulink Support Package for Raspberry Pi 3 Hardware.The proposed algorithm is incorporated into a Simulink model and then exports the results for analysis and visualizations.It supports simulation, system-level design, automatic code generation, testing and visualization of IoT data.In this framework, we develop a model using Simulink and generated code that runs on the Raspberry Pi 3 model B. the following Fig. 3 shows the Simulink model for sensor data acquisition.

Figure 2 .
Figure 2. Simulink model for IoT sensor data acquisition

Figure 3 .
Figure 3. Estimating total vehicles count for sensor data analysis (eastbound and westbound traffic) Algorithm 1 depicts the usage of this Simulink model based on sensor data acquisition and analysis algorithm as shown below.Algorithm 1: IoT Sensor Data Analysis Input: A group of S snapshots along with input videos IV (Input Video).

A
Framework for IoT Sensor Data Acquisition and Analysis EAI Endorsed Transactions on Internet of Things Online First (a) (

Figure 7 .
Figure 7. Online Analysis and Visualizations on ThingSpeak3.8Create a dynamic visualization of traffic density: Viewing the data onlineUp to now, we have created a channel on ThingSpeak that delineates the crude movement thickness in both eastward rush-hour gridlock and westward activity bearings and assessments peaktimes of activity on day-by-day or week after week premise.The created channel has situated on ThingSpeak.We can play out some examination and perceptions at 24*7, conduct utilizing any web program and keep running on a machine or portable.With a specific end goal to see the movement conditions on the web, go to ThingSpeak IoT Cloud stage.
FSDAA mechanism for IoT sensor data acquisition and analysis.The proposed framework has implemented on ThingSpeak IoT cloud platform with Matlab code.Also developed a Simulink model for data analysis and visualisations of the sensed information in real-time.The FSDAA has evaluated with A Framework for IoT Sensor Data Acquisition and Analysis EAI Endorsed Transactions on Internet of Things Online First

Table 1 .
Comparison of the various state of the art schemes with proposed FSDAA in percentage.

Table 2 .
Results of the various metrics at different nodes with proposed FSDAA in percentage at selected region FPR value achieves the superior of 3%, FNR value achieves the superior of 5% when compared to the state of the art schemes mentioned in Table