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
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