Manufacturing at Scale: MongoDB & IIoT

Gabriela Preiss

#IIoT

In recent years, we’ve seen a massive shift in digital transformation. As people, we’re all “connected”, by our smart devices, smart homes, smart cars, smart cities, and so on. We interact with smart devices because of the convenience it offers us- automating daily tasks and giving insight into daily movements, from how much pressure is in each car tire to whether we left our stove on before leaving the house.

The reasons we use smart devices is mirrored in why businesses are adopting IoT and IIoT (Industrial IoT) on a much larger scale- for convenience, insight, predictive maintenance, automation, and productive efficiency. IoT is becoming increasingly more critical in manufacturing and engineering, connecting thousands of sensors and actors of devices in the processes before, during, and after fabrication. The implementation of IoT within manufacturing processes, from raw materials to the product or smart products has only just begun and is destined to evolve into a key differentiator for successful manufacturing companies throughout the entire supply chain.

The digital transformation in IIoT comes down to data at its core and how data is generated, stored and analyzed. IIoT requires data to be collected and processed at massive volumes in real/ near real time to provide accurate and live business insights for better decision making. Shop floors are continuously optimized as new components, sensors and actors are introduced to improve OEE (Overall Equipment Effectiveness), increase quality and reduce waste. With almost every new device, additional data variety is introduced and thus requires a flexible, highly available and scalable data platform to store and analyze this data.

Furthermore, with the increasing convergence of IT and OT, even more complexity and diverse data needs to be integrated and processed, which adds higher complexity to the picture. MongoDB’s general purpose data platform, allows manufacturers to store OT / time series data sets in MongoDB together with recipes or digital twins for a complete real time end-to-end picture from edge to cloud and onto mobile devices for insights and control anytime and anywhere, online or offline.

A connected factory model

The Industry Solutions team at MongoDB set out to demonstrate how easily MongoDB can be integrated to solve the digital transformation challenges of IIoT in manufacturing with its flexible, scalable, data platform.

Using the small scale model of a smart fabrication factory, from Fischertechnik, the team collects and sends data via MQTT and processes it in MongoDB Atlas and Realm. Similar to a full scale physical factory, the smart factory model demonstrates how easily IIoT use cases can be built on top of MongoDB’s data platform to enable and accelerate digitalization of manufacturing processes in any industry.

Model of a factory

The Fischertechnik model factory itself is often used to train engineering students in the field of what a manufacturing fabrication would look like, as well as a model for manufacturing companies to plan for the very real setup, building, and investment of their factories . So, what initially looks like a toy in robotics gets serious quite quickly.

The model factory operates as the foundation of an IIoT use case. It is made up of several components- a warehouse, multiprocessing station, and sorting area. The warehouse is where raw material is stacked and stored, and when triggered, the raw material is retrieved and moved to processing by a mobile crane. From there, the items are sorted by color (i.e. red, white, or blue), to be sent to the correct outbound destination. The process covers ordering and storing of raw material to ordering and manufacturing of end products. Throughout these processes, there are multiple sensors detecting the type and color of the items, as well as environmental aspects like temperature and how much inventory is in stock. A surveillance camera detects motion and sends alerts including photos via MQTT. This simulates the wide variety of data a smart factory would emit in real time for track and trace, monitoring and visualization, alerts and as input for machine learning algorithms.

The factory's infrastructure

Out of the box, the Fischertechnik factory comes with a few dashboards connected to the Fischertechnik cloud, established via a WLAN router integrated in the factory. These dashboards include a:

  • Customer View: A webshop interface, where a product can be ordered to trigger the supply chain processing

  • Supplier View: A visualization and display of the ordering process of raw material

  • Production View: A visualization of the factory status, production process, and sensor values from the camera and NFC/RFID readers.

To emphasize and explain how MongoDB can be leveraged in this picture, the MongoDB team developed additional apps, using JavaScript, ReactJS, and Realm, to integrate and streamline data flows and processes on top of the MongoDB data platform. This included a:

  • MongoDB Realm Order Portal: A ReactJS web application to order new products and track the process of orders.

  • Data Visualization: A visualization of the different data types collected in MongoDB and visualized via MongoDB Charts for insights.

  • Alert Management App: A mobile app leveraging MongoDB Realm and Realm Sync for alert notification and management offline and online.

The machines of the factory are controlled by TXT controllers, Linux-based computers which use MQTT to communicate between each other and also with the cloud based applications. There are basically two types of data sent and received via MQTT- commands to trigger an action and streaming of event and time series sensor data. The main TXT controller runs a MQTT broker and replicates selected topics to a HiveMQ MQTT broker in the HiveMQ cloud. From there a redpanda kafka container collects the data streams and inserts them into MongoDB. The data persisted in MongoDB is then visualized via MongoDB Charts for real-time insights.

Diagram of Factory layout connected to data infrastructure
Factory layout connected to data infrastructure

The MongoDB Order Portal uses the Realm Web SDK and the serverless GraphQL API. GraphQL is used to pull data from MongoDB Atlas and the web SDK is used to add new orders (insert new documents) into a MongoDB cluster. When a new order is inserted into the Atlas database, an Atlas trigger is executed, which then sends a MQTT message directly to the HiveMQ MQTT broker, alerting the factory to process the order. The HiveMQ broker then replicates the order to the factory for processing.

Diagram of data being sent to the factory
Sending data to the factory

Receiving data from the factory is just as simple. The Factory provides a large amount of live data that can be streamed from the factory. In order to receive the data, HiveMQ and Kafka are used. The factory has an MQTT broker, which is bridged to a cloud HiveMQ broker. From the HiveMQ broker Kafka Connect with an MQTT source and a MongoDB sink connector the data is moved into MongoDB Atlas.

Diagram of data being received from the factory
Receiving data from the factory

MongoDB & IIoT

Digitalization in manufacturing means connecting IT and OT, mixing and meshing data from both domains and providing access to people and algorithms for higher levels of automation, increased efficiency and less waste. MongoDB’s data platform optimized for large varieties and amounts of data with a powerful query language for better decision making across a large volume of data. All easier said than done. However, Atlas helps solve these complex requirements with its ecosystem of functions, including:

Real Time Analytics: As IIoT continues to boom with a surge of connected devices, limits are pushed each day with increased volumes of data. Atlas scales seamlessly, capable of ingesting enormous amounts of sensor and event data to support real time analysis for catching any critical events or changes as they happen.

Dynamic Scalability: MongoDB Atlas and Realm provide automated scalability allowing you to start small and dynamically adapt your clusters with increasing/decreasing demand. Especially as sensor data gets colder over time, you can automatically offload cold data into object stores, such as S3, while maintaining the ability to query the hot and cold data through a single API.

Time-Series: MongoDB 5.0 supports Time-Series Data natively through optimized storage with clustered indexes and optimized Time-Series query operators to analyze trends and identify anomalies quickly. The combination of time series data with other data structures such as digital twin models within the same data platform dramatically reduces complexity, development efforts and costs by avoiding additional technologies, ETL processes and data duplication.

The MongoDB database can also be deployed next to the shop floor for data collection and analysis, making the shopfloor independent of the cloud. Pre Aggregated or raw data can then be seamlessly replicated or streamed into the public cloud for global views across factories.

Additionally Realm, the serverless backend on top of MongoDB Atlas provides easy application and system integrations through REST / MongoDB Data and GraphQL APIs as well as synchronizing data with mobile devices for offline first use cases such as workforce enablement use cases.

Diagram of Atlas, Realm, and IIoT
Atlas, Realm, and IIoT

IIOT is an exciting realm (no pun intended) right now, with a massive opportunity for growth and innovation. The next level of innovation requires a resilient multi-functional data platform that reduces complexity, increases developer efficiency and reduces data duplication/integration while scaling elastically with your demand.

What the MongoDB team scratched by quickly syncing the smart model factory with Atlas and Realm and iterating on top of that is just a fraction of the innovation we can support within manufacturing use cases. Learn more MongoDB Atlas and Realm, and how major enterprises are using these solutions for their manufacturing and IIoT needs here.

Read Part 2 of this IIoT series from MongoDB’s Industry Solutions team.

Update March 12, 2024: The MongoDB Atlas GraphQL API feature has been deprecated and the End of Life date is set for 3/5/2025