Product
October 21, 2024

IoT sensor data: How to navigate and use it effectively

Written by
Hazal Mestci
Developer Advocate

As IoT ecosystems expand, sensor data has become a crucial element in monitoring, automation, and analytics across various industries. Understanding how sensor data is collected, processed, and used is essential for anyone working in IoT development or data analysis.

This blog explores what sensor data is, how it functions within IoT systems, and how businesses can use this data to drive actionable insights and decision-making.

What is sensor data?

Sensor data refers to the information collected by devices that monitor physical conditions or activities, such as temperature, humidity, motion, pressure, or light. These devices, often embedded within IoT systems, generate data continuously and communicate it over networks to provide insights for various applications.

Common types of IoT sensors

  • Temperature sensors: Used in HVAC systems and environmental monitoring to track climate conditions.
  • Motion sensors: Present in security systems or automation for detecting movement.
  • Pressure sensors: Employed in manufacturing for monitoring equipment status.
  • Environmental sensors: Found in environmental sustainability projects for monitoring water quality and detecting pollution levels or air quality assessment in smart cities.

These sensors generate various types of data—ranging from simple numeric values to complex image and audio files—that power IoT applications in industries like manufacturing, home automation, and sports and entertainment.

The importance of IoT sensor data

IoT sensor data is fundamental to enabling automation, real-time monitoring, and predictive analytics. Here's how sensor data enhances decision-making across industries:

  • Automation and efficiency: IoT sensor data allows systems to operate autonomously, adjusting parameters like temperature or machinery speed without human intervention. For example, in food and beverage manufacturing, automated systems use temperature and humidity data to maintain ideal production environments.
  • Predictive maintenance: In manufacturing, sensor data from machinery can indicate wear and tear or other issues before they cause equipment failure, reducing downtime and maintenance costs.
  • Real-time monitoring: Industries like marine use sensor data to track water depth, ocean temperature, and potential storms, ensuring smooth operations and quick response to potential issues. 

Challenges in managing IoT sensor data

Despite its potential, managing sensor data in IoT systems comes with challenges:

  1. Data volume and overload: The sheer volume of sensor data can overwhelm storage solutions and analytics systems, making it difficult to extract relevant information efficiently.
  2. Data integration complexity: Data comes in various formats and from disparate sources, including structured and unstructured data, sensor data, image data from cameras, and data from IoT devices. Integrating and analyzing these diverse data sources can be complex and time-consuming.
  3. Real-time analysis requirements:  In today's fast-paced business environment, there is a demand for real-time insights to make timely decisions. However, performing real-time data analysis requires robust infrastructure and advanced analytics capabilities.
  4. Ensuring data accuracy and privacy: Data accuracy is critical, especially in sensitive applications like food and beverage manufacturing, where precise environmental control is essential for product safety and quality. Moreover, the widespread use of IoT devices raises privacy concerns, as personal or sensitive information could be vulnerable without proper security measures.

Fortunately, Viam’s platform streamlines IoT data management, integrating diverse sources, enabling quick insights, and ensuring privacy through advanced encryption for sensitive industries.

Real-world example: How to manage sensor data

To illustrate how IoT sensor data can be managed, consider a laundry machine monitoring scenario using Viam’s platform. Let’s say you want to:

  • Track the machine’s status
  • Detect malfunctions before they happen
  • Analyze its overall performance

Viam’s platform allows you to gather real-time and historical data to predict maintenance needs and set up alerts, such as notifying you when a wash cycle is complete. 

You could use a camera to track time remaining or, as we'll focus on here, a gyroscope to monitor movement changes.

Step 1: Set up the sensor

The first step would be wiring the sensor, then creating a machine in the Viam app, and adding the sensor. 

Interface showing laundry-monitor in Viam app
The laundry-monitor smart machine in Viam's dashboard.

This is how the configuration of the gyro would look like in the app: 

The configuration for the washer-movement sensor within the Viam app.
The configuration for the washer-movement within the Viam app.

Step 2: Collect data from your machine

Add the data management service to your machine and configure the data capture and cloud sync.

Data management service set up in Viam app. The data capture and cloud sync are turned on.
The data management service configuration within Viam app. Notice, the data capture and cloud sync is turned on.

After syncing tabular data to the Viam app, you can view the live sensor data through the control panel and, under the Data tab, the Sensors sub-tab. Here, from the sensor, you get information about angular velocity, linear acceleration, and temperature in Celsius. 

Control panel in Viam app for laundry-monitor-main
Control subtab view for the gyro under the Fleet tab
User interface with control subtab view for the gyro
The sensors subtab view under the Data tab

Now that we have done sensor data collection and observed it in the app, it’s time to perform a query against that data using SQL or MQL. 

Step 3: Query the data retrieved from the sensor

With Viam, you can:

Let’s query tabular data in the Viam app. Navigate to the Query tab and select the query mode you prefer. 

Here are two examples of SQL and MQL queries. By running these, you get all of the readings from the washer-movement component (the movement sensor) we configured above in the app. The query limits the readings to the last five. 

SQL command with the corresponding response in the app: 

SELECT * FROM readings WHERE component_name='washer-movement' LIMIT 5

Response in app to SQL comment
The response you'll see within the app when querying your IoT sensor data.

MQL command with the corresponding response in the app:

[{"$match":{"component_name":"washer-movement"}},{"$limit":5}]
MQL command with response in Viam app

In the SELECT section, you can specify whether you want to see only the data itself and not when it is requested, received, the parameters, org information, etc. 


In SQL:

SELECT data FROM readings WHERE component_name='washer-movement' LIMIT 1
Response to SQL query in Viam app
Specifying the data you want to receive using SQL within the Viam app.

In MQL: 

[{"$match":{"component_name":"washer-movement"}}, {"$project": { "data.readings": 1}},{"$limit":1}] 
Response to MQL query in Viam app
The response to your MQL query within the Viam app.

You can get more and more granular if you keep adding details about which query you want to get. For example, if you don’t care about angular_velocity and linear_ acceleration and only want to get the latest temperature data, you can run the command:

In SQL: 

SELECT count(*) as temperature_celsius FROM readings WHERE component_name='washer-movement' LIMIT 1
Response to SQL query in Viam app, showing temperature_celsius
The response to a SQL query in Viam app, showing temperature_celsius.

Or in MQL: 

[{"$match":{"component_name":"washer-movement"}}, {"$project": { "data.readings.temperature_celsius": 1}},{"$limit":1}]
Response to MQL query in VIam app, showing temperature_celsius
The response to a MQL query in VIam app, showing temperature_celsius.


If you want to query the data directly from a compatible client, you can configure the query through the MongoDB Atlas Data Federation instance, where your machine’s synced data is stored. Once you have synced data to the Viam app and configured a database user, you can directly query that data from an MQL-compatible database client, such as the mongosh shell, MongoDB Compass, or one of many third-party tools. 

Step 4: Visualize and explore the data

The data you pull can be visualized using tools, like Tableau or Grafana, offering a clear view of the machine’s performance and providing alerts for maintenance needs.

Once visualized, you can identify patterns, trends, outliers, and relationships between variables to gain a deeper understanding. 

You can then take this a step further by:

  • Performing statistical analysis to quantify relationships, test hypotheses, and validate assumptions.
  • Building predictive models to forecast trends, detect anomalies, and categorize data accurately.
  • Generating actionable insights and delivering strategic recommendations from data analysis.

Tap into your IoT sensor data

Navigating sensor data within IoT ecosystems is essential for extracting meaningful insights and driving automation and efficiency across industries. While challenges like data overload, integration complexity, and real-time demands exist, tools like Viam offer solutions for effective data management and visualization. 

By using best practices and integrating advanced analytics, businesses can unlock the full potential of sensor data to optimize operations, reduce costs, and enhance decision-making.

Learn best practices and explore how Viam’s tools can help you build air quality monitors, optimize smart HVAC systems, or create interactive dashboards with Grafana or Tableau

Technical content review by: Nick Hehr,Vijay Vuyyuru and Tahiya Salam

On this page

Get started with Viam today!