Capture and query sensor data

You can use the data management service to capture tabular data from a connected component on your machine and sync that data to the cloud. Once you have synced that data, you can query it using SQL or MQL to obtain actionable insights.

For example, you might configure data capture for several sensors on your machine, or across sensors on multiple machines, to report the ambient operating temperature. You can then run queries against that data to search for outliers or edge cases, to analyze how the ambient temperature affects your machines’ operation.

Configure the data management service 1. Configure the data management service

First, create a machine if you haven't yet.

Then, add the data management service, and configure data capture and cloud sync.

Capture tabular data from a sensor 2. Capture data

Next, capture tabular data from a component on your machine, such as a sensor. With cloud sync enabled, captured data is automatically uploaded to the Viam app after a short delay.

You can view your synced data in the Viam app from the Data tab.

Configure the data management service 3. Query data in the Viam app

Once your data has synced, you can query your data from within the Viam app using SQL or MQL.

For example, this query limits returned results to show data captured by the my-ultrasonic-sensor component only, and with a maximum of 5 results.

Viam App Data Query tab with a SQL query shown
Configure the data management service 4. Query data from a compatible client

If you prefer, you can also query your data directly from an MQL-compatible client, such as mongosh or MongoDB Compass, using SQL or MQL.

SQL query in mongosh filtering by machine, component, and specific data readings

Next steps

Have questions, or want to meet other people working on robots? Join our Community Discord.

If you notice any issues with the documentation, feel free to file an issue or edit this file.