AnnouncementIntroducing MongoDB 8.0, the fastest MongoDB ever! Read more >>Introducing MongoDB 8.0, the fastest MongoDB ever! >>

Building an IoT data hub for smart manufacturing

Use streaming data from edge devices to power machine learning models and smart applications by integrating MongoDB Atlas with Microsoft Azure IoT.
Start Free
Illustration of hands typing on a laptop.
Solution Overview

The modern factory floor is full of unique machines and widgets, each producing its own sets of data, and interconnecting with each other to make a complex system that supports complex manufacturing processes and produces countless goods.

Being able to understand how the system is operating, and how to troubleshoot errors and bottlenecks, is critical to driving operational efficiency and building smarter manufacturing applications.

This solution shows how MongoDB Atlas can be used to radically simplify an IoT landscape, taking data from disparate edge devices and using that data to power smart applications for a variety of data consumers.

Other Applicable industries and use cases:
  • Automotive: Automotive is a subset of manufacturing. Car makers need to develop efficient production factories and manage a complex inventory of parts and services in order to maximize throughput of finished cars.

  • Healthcare: The healthcare industry is proving to be one of the largest industries affected by IoT. Wearable and connected devices are critical for providing care both within medical institutions and increasingly in other areas, such as within a patient’s own home and on their personal devices.

  • Telecommunications: Telecommunications is at the heart of edge and IoT as more people around the world conduct their lives and businesses through mobile and connected devices.

Reference Architectures
Without MongoDB:

It’s common in many manufacturing environments to have unique systems running their own proprietary software, often with a relational database in the background, or a niche database covering time-series and graph use cases.

The challenge with this approach is that as the number and type of databases becomes unmanageable, architectural complexity increases, and it becomes more difficult to move data between disparate systems and connect them to newer, smarter applications.

Reference architecture without MongoDB illustration.
With MongoDB:

With MongoDB Atlas, architectural complexity is reduced, as the versatility of the document model allows teams to structure data in any way their application needs. The expressive API and indexing also allow teams to query data any way they want.

Reference architecture with MongoDB illustration.
Data Model Approach

Sensors in a factory may be streaming time-series data for multiple machines, capturing the following data points:

  • Product Type
  • Air Temperature (K)
  • Process Temperature (K)
  • Rotational Speed (rpm)
  • Torque (Nm)
  • Tool Wear (min)

In a relational database, you would likely have to create multiple tables to effectively store this varied data. But with MongoDB and the flexible document data model, you can use a single collection to store all sensor data coming in using time-series collections. For example:

We can then use the MongoDB aggregation framework to easily query time-series data. For example, we can group documents by the date of the sensor measurement and return functions like average.

Building the Solution

This solution showcases how you can build a smart manufacturing hub using MongoDB Atlas and Azure IoT Edge. The example use case is sending sensor data from CNC machines to Azure IoT Hub, with selected data streamed to MongoDB Atlas for use in a variety of data consumers, such as factory workers with mobile devices, and analysts using MongoDB Charts.

To illustrate this solution in practice, we will create a machine learning model that will predict the root cause of machine failure based on sensor data. The detailed guide and associated sample data, functions, and code can be found in this solution repository.

1. Train your ML model

You can use MongoDB as a feature store to train ML models, and once models are trained, those binaries can be converted and stored in another MongoDB collection for analysis. Refer to this notebook to train your ML model, and once your models are trained, use this model to make predictions using Azure functions.

2. Set up Azure IoT Hub

We use Azure IoT Hub to connect, monitor, provision, and configure IoT devices. Use this link to set up IoT Hub in your Azure account, and when you’re ready, register a new device.

3. Simulate IoT data

To generate data for our sample solution, we built this web app to simulate data flow to Azure IoT.

4. Serve data to Azure Stream Analytics

Once data is in Azure IoT Hub, it can then be served to Stream Analytics for filtering, then pushed into MongoDB. Follow these instructions to set up a Stream Analytics job, then add IoT Hub as an input for that job.

5. Use Azure functions to push data to MongoDB Atlas

Now that data is in Stream Analytics, you can push it to a time-series collection in MongoDB Atlas using this function to serve a variety of use cases and data consumers. You can also run your machine learning model to get failure inferences using this function.

6. Use MongoDB Atlas to turn data into insights

Once your machine failure data is in MongoDB Atlas, you can easily put it in the hands of users through MongoDB’s platform services. You can build a mobile app using Atlas Device Sync to send notifications and alerts to floor supervisors, or you can use Mongo Charts to create visualizations for BI teams.

Technologies and Products Used
MongoDB developer data platform:
Partner technologies:
Key Considerations
  • This solution walks you through a simple configuration to learn how to generate IoT data, use it to run machine learning models, and store that data in MongoDB Atlas to use in business applications.
  • MongoDB is a great choice for IoT applications because it is a highly scalable document-based database that can handle the high volumes of data that IoT applications generate.
  • MongoDB’s flexible document model makes it well-suited to handle the different types of data structures needed to store a wide range of IoT devices and ML models, without requiring separate databases for different data types.
Author
  • Diana Annie Jenosh, MongoDB
  • Utsav Talwar, MongoDB
  • Dr. Humza Akhtar, MongoDB
Related resources
general_content_developer

GitHub Repository: IoT Smart Hub with MongoDB

Create this solution yourself with the associated sample data, functions, and code.

cloud_iot

MongoDB for Internet of Things (IoT)

Learn how MongoDB’s developer data platform supports the entire IoT data life cycle.

general_content_blog

Solving 3 Major IoT Data Challenges

See how MongoDB Atlas addresses common IoT challenges across a variety of industries.

general_content_play

How Toyota is Creating Smarter Factories

See how MongoDB’s next-generation developer tools are being used to build smarter factories and warehouses.

Get started with Atlas today

Get started in seconds. Our free clusters come with 512 MB of storage so you can experiment with sample data and get familiar with our platform.
Try FreeContact sales
Illustration of hands typing on a laptop in the foreground and a superimposed desktop window and coffee cup in the background.