Maker.io main logo

Edge Link

79

2026-08-17 | By Mukesh Sankhla

License: Public Domain 3D Printer 3D Printing Wireless UNO Q Dream Lab Arduino


GIF_optimized.gif

Industrial machines don't become obsolete just because technology moves forward. Factory floors are full of PLCs, controllers, and sensors that have been running reliably for years, quietly generating production data that never leaves the machine. That data is valuable, but it's often locked behind proprietary protocols and isolated industrial networks, out of reach of the cloud, IoT, and AI tools that could actually put it to use.

Edge Link exists to change that.

Built on the Arduino UNO Q, Edge Link is an industrial PLC/controller gateway and edge-AI platform that connects existing machines, no replacement required, to modern data and AI infrastructure. It talks to a broad range of industrial controllers and interfaces, including Modbus, RS-485, and other common industrial protocols, meeting legacy equipment exactly where it is.

But Edge Link doesn't stop at moving data around. It combines data acquisition, industrial connectivity, edge computing, and machine learning in a single system at the machine level. Rather than streaming raw sensor data to the cloud for every decision, it processes data locally and runs multiple ML models directly at the edge, cutting latency, reducing bandwidth use, and keeping critical monitoring alive even when the cloud connection isn't.

To put Edge Link through its paces, this tutorial builds and tests it against a simulated Digital LED Bulb Production Line - multiple manufacturing stations running under realistic operating conditions. We'll pull machine data from the process, structure it at the edge, and use it to build station-specific predictive maintenance models. Those models are trained in Edge Impulse and deployed in parallel on the Arduino UNO Q, so several stations can be watched simultaneously for early signs of wear or failure, with all inferencing happening on-device.

Underneath it all is a proper IoT/IIoT architecture built on MQTT and a Unified Namespace (UNS). Station and machine data flow through MQTT into a structured UNS, creating a single, consistent data layer that dashboards, analytics platforms, and cloud services can all draw from.

The result is a working example of what's possible without a rip-and-replace: existing machines connected, understood, and made smarter with AI - using the equipment already on the floor.

Edge Link turns legacy industrial connectivity into an intelligent edge.

DSC05642.JPG

Front View

Back

Supplies:

DSC05560.JPG

CAD Designing & 3D Printing the Enclosure

I designed the enclosure for the Edge Link using Fusion 360. The first step was to import the Arduino Uno Q CAD file into Fusion 360 as a reference. I then designed basic reference models for the other components, including the LEDs and the 6-pin terminal, to ensure that the enclosure would have the correct dimensions, clearances, and mounting positions.

IMG7.png

The enclosure was designed in three main parts:

1. Housing

The main housing contains all the internal components, including the Arduino Uno Q, LEDs, and 6-pin terminal. It includes dedicated openings for the USB Type-C port and the terminal connections. The housing was also designed with an integrated mechanism that allows the complete enclosure to be mounted onto a DIN rail.

2. DIN Rail Locking Latch

A separate DIN rail locking latch was designed to secure the enclosure to the DIN rail. The latch slides into position from the top at the back of the enclosure, allowing the enclosure to be locked onto or released from the DIN rail when required.

3. Cover

The cover is a simple snap-fit design that can be attached directly to the main housing. A small notch is provided on the cover to make it easier to open the enclosure when access to the internal components is required.

3D Printing

After completing the CAD design, I 3D printed all three parts using my Bambu Lab P1S. The parts were printed in PLA using the standard print settings. This allowed me to quickly verify the fit of the components, the snap-fit mechanism, the DIN rail mounting system, and the overall dimensions of the enclosure.

DSC05568.JPG

Terminal and Type-C Assembly

DSC05580.JPG

For the Terminal and Type-C assembly, the required components are the enclosure housing, 6-pin terminal, and Type-C extension.

1. 6-Pin Terminal Installation

DSC05588.JPG

First, take the enclosure housing and position the 6-pin terminal from the inside of the enclosure. Align the terminal with its dedicated cutout and press it into position until it snaps securely into place.

2. Type-C Extension Installation

DSC05590.JPG

Next, take the Type-C extension and remove the heatsink from the Type-C female connector side. Position the connector against the dedicated Type-C cutout in the housing, ensuring that it is properly aligned with the opening.

Once the correct position is confirmed, apply glue to secure the Type-C extension firmly to the housing.

DSC05593.JPG

Circuit Connections

After completing the terminal and Type-C assembly, the next step is to make the electrical connections between the Arduino Uno Q and the 6-pin terminal.

Circuit.png

The connections are made according to the wiring diagram shown above

The required connections are as follows:

  • Connect the Rx and Tx lines from the 6-pin terminal to the corresponding communication pins on the Arduino Uno Q.

  • Connect both GND terminals to the Arduino's ground connections.

  • Connect the VIN (7–24 V) terminal to the Arduino's input power connection.

  • Connect the 5V terminal to the corresponding 5V connection on the Arduino.

  • The Status LED connections from Pin-2 to Pin-8 are connected to the designated Arduino header pins, as shown in the circuit diagram. These connections allow the Arduino Uno Q to control the individual status LEDs for indicating different device or system states.

DSC05600.JPG

Arduino Q Installation

First, solder all the required wires to their respective pins on the Arduino Uno Q according to the circuit diagram.

DSC05601.JPG

Connect the male end of the Type-C extension to the Type-C input port of the Arduino Uno Q. Ensure that the connector is fully inserted and properly aligned.

DSC05602.JPG

Place the Arduino Uno Q inside the enclosure and align the mounting holes with the corresponding standoffs in the housing. Secure the Arduino Uno Q to the enclosure using four M3 screws. Tighten the screws sufficiently to hold the board firmly in place without applying excessive force.

DSC05605.JPG

Installing and Connecting the Status LEDs

DSC05610.JPG

Take all the LEDs and insert them into their respective slots in the enclosure. Follow the color order shown in the reference image and make sure each LED is seated properly in its slot.

DSC05612.JPG

Solder each LED to the corresponding exposed wire from the Arduino Uno Q that was prepared in the previous step. Make sure each LED is connected to the correct Arduino pin according to the circuit diagram.

DSC05614.JPG

Connect and solder the required terminal wires to their respective connections. Ensure that the terminal wiring is correctly connected and securely soldered.

Carefully route all the wires inside the enclosure. Avoid leaving excessive wire length inside the housing. Keep the wires as short and organized as practical, and route them neatly around the components so that they do not interfere with the Arduino, cover, or other connections.

DSC05617.JPG

Before closing the enclosure, inspect all solder joints and verify that there are no loose connections, exposed shorts, or unnecessarily long wires. Confirm that the wiring matches the circuit diagram and that all components are securely positioned.

Closing the Enclosure

DSC05619.JPG

After completing all the internal wiring and connections, take the enclosure cover and align it with the main housing.

Carefully press the cover onto the housing until all the snap-fit points engage securely. Make sure the cover is properly seated on all sides and that no wires are being pinched or obstructing the snap-fit mechanism.

DSC05621.JPG

The small notch provided on the cover can be used to open the enclosure later if access to the internal components is required.

Installing the DIN Rail Lock Latch

DSC05625.JPG

Take the DIN rail lock latch and align it with the guide on the backside of the enclosure.

Slide the latch into the enclosure from the top until it reaches its fully seated position. Make sure the latch moves smoothly along the guide and is securely held in place.

Once installed, check the latch mechanism by sliding it back and forth to ensure it can properly lock and release the enclosure from the DIN rail.

DSC05627.JPG

Software Configuration

Now that the hardware build is complete, the next step is to configure the software.

Understanding the Arduino UNO Q

image.png

Before configuring the software, it is important to understand the architecture of the Arduino UNO Q and why it is well suited for our Edge AI Data Logger.

The Arduino UNO Q is a next-generation board that combines a Linux-capable microprocessor (MPU) with a real-time microcontroller (MCU). This allows the board to perform advanced computing and AI/ML workloads while simultaneously handling precise, real-time hardware control.

It maintains the familiar Arduino UNO form factor, while adding significantly more processing capability for applications involving AI, IoT, connectivity, and multimedia.

Core Components

The UNO Q integrates:

  • Qualcomm Dragonwing™ QRB2210 MPU — Quad-core 2.0 GHz CPU with Adreno GPU, dual ISP for camera applications, and AI acceleration capabilities.

  • STM32U585 MCU — Low-power Arm® Cortex®-M33 microcontroller designed for real-time control and hardware interfacing.

  • Memory & Storage — Available with 2 GB or 4 GB LPDDR4 RAM and 16 GB eMMC storage.

  • Connectivity — Dual-band Wi-Fi 5, Bluetooth 5.1, and USB-C with power delivery and video output.

  • Expansion — Qwiic connector, MIPI CSI/DSI interfaces for cameras and displays, and GPIO headers.

  • Built-in Feedback — 8×13 LED matrix and RGB LEDs.

Development Environment

The UNO Q comes with Arduino App Lab, which provides a unified development environment for both sides of the board.

It allows us to:

  • Develop Arduino sketches in C/C++ for the MCU.

  • Run Python applications and scripts on the Linux MPU.

  • Integrate AI/ML models and modular components called Bricks.

  • Build applications where the MCU and MPU work together.

The board can be developed in several ways:

  • PC-connected — Connect the UNO Q to a computer through USB-C.

image.png

  • Standalone SBC — Connect a monitor, keyboard, and mouse and use the UNO Q as a standalone Linux computer.

image.png

  • Wireless — Communicate with the board through Wi-Fi or Bluetooth.

MCU–MPU Communication

One of the most important features for our project is the communication between the MCU and MPU.

The Router Bridge library provides a communication layer between the two processors. This allows the MCU to handle real-time hardware and sensor data while passing the required information to the MPU for more computationally intensive processing.

For example, the MCU can acquire machine data from sensors or connected controllers and send that data to the MPU. The MPU can then process the data, run an AI/ML model, and return the result to the MCU for further action.

Example: Blink LED with App Lab

As a basic introduction to the development environment, we can start with a simple LED blinking example using Arduino App Lab. This helps verify that the development environment is correctly configured and that we can successfully communicate with and control the hardware.

Why We Are Using the Arduino UNO Q

For this project, we do not want to use the UNO Q simply as an IoT gateway for collecting and transmitting machine data.

The main advantage of the UNO Q is its combination of an MCU + MPU on a single platform.

The MCU can handle real-time machine communication, GPIO, sensors, and other deterministic control tasks, while the MPU can handle higher-level processing, data management, cloud connectivity, and AI/ML workloads.

This architecture allows us to run multiple cascaded Edge AI/ML models directly on the device, alongside the data-logging and IoT functionality.

In our application, the UNO Q therefore acts as both:

  • A machine data acquisition and IoT gateway, and

  • An Edge AI computing platform capable of running multiple ML models locally.

This enables us to process machine data at the edge, identify patterns and anomalies locally, and perform predictive maintenance analysis without relying entirely on cloud-based processing.

Setting Up the Arduino UNO Q

Screenshot 2026-08-13 173108.png

Before we start developing the software for our Edge AI Data Logger, we first need to set up and configure the Arduino UNO Q.

1. Install Arduino App Lab

The first step is to install Arduino App Lab, which is the primary development environment for the Arduino UNO Q.

Once installed, connect the UNO Q and make sure that the board is detected correctly.

2. Update the Firmware

Before starting development, make sure that the Arduino UNO Q is running the latest available firmware.

It is also useful to know how to reflash the board's operating system if the installation becomes corrupted or if a clean installation is required.

For the complete firmware reflash procedure, refer to the tutorial:

How to Reflash the Operating System to Your Arduino UNO Q

For general UNO Q setup and configuration, the official Arduino user manual is also useful:

Arduino UNO Q User Manual

3. Using the UNO Q in Standalone SBC Mode

The UNO Q can be used directly as a standalone Linux computer without connecting it to a PC.

To do this, connect a USB Type-C hub to the UNO Q and connect a:

  • Monitor

  • Keyboard

  • Mouse

This allows the UNO Q to operate in Standalone SBC Mode.

However, my initial experience with this mode was somewhat frustrating. The user interface can feel slow, some features may not work as expected, and the overall experience is not comparable to using a modern desktop PC.

This is understandable because the UNO Q's operating system and software environment are still evolving.

Coming from a fast PC, the interface can initially give the impression that the board itself is slow.

But don't judge the hardware based only on the UI.

The UNO Q is significantly more capable than the initial desktop experience might suggest.

4. PC-Connected Mode — My Preferred Setup

For development, I prefer using the UNO Q in PC-connected mode.

Simply connect the Arduino UNO Q directly to the PC using a USB Type-C cable, without using a USB hub.

The biggest advantage of this approach is that we can use the familiar and much faster environment of our PC while still accessing and developing everything running on the UNO Q.

From the PC, we can:

  • Use Arduino App Lab

  • SSH into the Arduino UNO Q

  • Access the UNO Q file system through the terminal

  • Transfer files between the PC and UNO Q

  • Use VS Code

  • Use development tools such as Antigravity

  • Run and manage applications on the Linux side

  • Work with the Arduino environment without needing a separate monitor, keyboard, and mouse for the UNO Q

This gives us the best of both worlds: the computing power and comfortable development environment of our PC, while using the UNO Q as the actual target hardware.

5. Using SSH and the Terminal

Once the UNO Q is connected and configured, SSH becomes one of the most useful tools in the development workflow.

For example, we can navigate the Linux file system using commands such as:

cd
ls
mkdir

We can also transfer complete application folders between the PC and UNO Q using scp.

For example, to copy the ArduinoApps folder from the UNO Q to the PC:

scp -r arduino@192.168.1.11:~/ArduinoApps C:\Users\MAKERBRAINS\Downloads\

And to copy an application from the PC to the UNO Q:

scp -r "C:\Users\MAKERBRAINS\Downloads\LEDBulb\arduino-q-pm-gateway" arduino@192.168.1.11:~/ArduinoApps/

The exact IP address may differ depending on the network configuration.

6. Getting Comfortable With This Workflow

Initially, working with SSH, Linux commands, file transfers, and the UNO Q's different development modes can feel unfamiliar.

But once the basic workflow becomes comfortable, development becomes much easier.

Personally, I found the PC-connected workflow much more enjoyable because I can use the tools I am already comfortable with while still having complete access to the UNO Q.

And this is where the UNO Q starts to feel much more like a real development platform rather than simply an Arduino board.

We can write code, access the Linux system, transfer applications, run services, work with AI/ML models, and interact with the hardware, all from our normal development environment.

This is true development.

Note: With the Type-C extension installed, the Arduino UNO Q cannot be used in Standalone SBC Mode, because the USB hub needs to be connected directly to the Arduino UNO Q. The hub cannot be connected through the Type-C extension.

Understanding the PLC Simulator

Screenshot 2026-08-13 171404.png

The PLC Simulator is a Python-based web application that acts as a digital twin of a Siemens S7-300 PLC and simulates the complete LED bulb production line.

For this project, we will run our Digital LED Bulb Production Line on the PLC simulator and use it to generate realistic production, machine, sensor, alarm, and quality data. The simulator models the five production stations and communicates with the Edge Link gateway to create a complete end-to-end system.

The overall setup is:

PLC Simulator → Edge Link → Cloud + Edge AI/ML

The PLC Simulator and Edge Link communicate through a serial/UART connection. The Edge Link receives the simulated PLC data, processes it, and routes it to the appropriate destinations.

From there, the Edge Link performs two important functions:

  • Cloud Synchronization: Production and diagnostic data is sent to the cloud Unified Namespace using Google Cloud Firestore.

  • Edge AI/ML: Machine and sensor data is passed to the Arduino UNO Q co-processor, where the Edge Impulse predictive maintenance models can run locally.

This allows us to simulate the complete workflow without requiring a real production line:

Simulated PLC → Edge Link → Cloud + Edge AI/ML

The PLC simulator handles the production-line behavior, while the Edge Link acts as the IIoT gateway and provides the Edge AI computing capability.

This is the foundation of our complete Digital Twin + IIoT + Cloud + Edge AI setup.

Downloading and Running the PLC Simulator

GIF1_optimized.gif

The next step is to download and run the PLC simulator that we will use to simulate our LED bulb production line.

The complete project is available in the GitHub repository: PLC_SIM GitHub Repository

The repository contains the complete Siemens S7-300 Digital Twin, the five-station LED bulb production-line simulation, SCADA HMI, Edge Link gateway components, OEE calculations, energy monitoring, alarms, recipes, and the Arduino Q/Edge AI integration.

1. Download the Repository

First, download or clone the repository to your computer.

Using Git:

git clone https://github.com/MukeshSankhla/PLC_SIM.git
cd PLC_SIM

Alternatively, you can download the repository as a ZIP file from GitHub and extract it to a suitable location.

2. Install the Required Python Libraries

The repository includes a requirements.txt file containing the Python dependencies required by the simulator.

From inside the project directory, run:

pip install -r requirements.txt

Make sure that Python 3.9 or newer is installed on your computer.

3. Understand the Main Components

Before running the simulator, it is useful to understand what is inside the repository.

The main main.py file starts the S7-300 simulation and runs the PLC scan cycle. The plc/ directory models the PLC memory areas, including Data Blocks, Digital Inputs, Digital Outputs, Memory Markers, Analog Inputs, and Analog Outputs.

The stations/ directory contains the five production stations:

  • ST1 — PCB Pick-and-Place & Reflow Oven

  • ST2 — ICT / In-Circuit Testing

  • ST3 — Housing Press-Fit & Solder

  • ST4 — Diffuser Placement & Pneumatic Press

  • ST5 — Final Optical Chamber & Burn-In Test

The simulator also includes modules for:

  • OEE — Availability, Performance, and Quality

  • Energy — Power consumption, power factor, and energy usage

  • Alarms — Machine alarms, limits, torque faults, and pressure warnings

  • Recipes — Product-specific production parameters

  • Quality — Production quality and test information

  • Historian — Historical production data

  • Datasets — Simulation/data-generation related data

  • UI/Web — Web-based monitoring and control interfaces

4. Start the PLC Simulator

Once the dependencies are installed, start the simulator from the project root:

python main.py

The simulator starts the S7-300 Digital Twin and runs the PLC logic continuously.

The simulation follows a PLC-style execution model. It performs the initial OB100 cold-start sequence, followed by continuous OB1 cyclic scans. The current implementation runs the scan cycle at approximately 10 ms intervals.

During every scan, the simulator:

  • Reads the simulated digital and analog inputs.

  • Processes the five production stations.

  • Updates the station state machines.

  • Processes workpieces through the production line.

  • Evaluates production quality.

  • Calculates OEE and energy metrics.

  • Evaluates active alarms.

  • Generates telemetry data.

  • Streams the resulting data toward the Edge Link gateway.

5. Open the SCADA HMI

GIF2_optimized.gif

The simulator also provides a web-based SCADA interface.

After starting the simulator, open:

http://localhost:8080

The SCADA HMI provides access to the simulated PLC data, including the Data Blocks from DB1 to DB20.

It also provides controls for actions such as:

  • LINE START

  • LINE STOP

  • LINE RESET

  • ERASE SHIFT DATA

These controls interact directly with the simulated S7-300 memory structure.

6. The Important Part — This Is Our Digital Production Line

At this point, we have a complete virtual production line running on our PC.

Instead of connecting our Edge Link to a real Siemens PLC, the PLC Simulator acts as our virtual Siemens S7-300 PLC.

Gemini_Generated_Image_4ha4xf4ha4xf4ha4.png

It generates realistic machine and production information that our Edge Link can consume, including:

  • Machine states

  • Production counters

  • Good and rejected products

  • Station information

  • Test results

  • Machine alarms

  • Sensor values

  • Energy information

  • OEE parameters

  • Production cycle information

The simulator then streams this information as telemetry, creating the data source for our Edge Link.

7. Connecting the PLC Simulator to Edge Link

Gemini_Generated_Image_5sm1825sm1825sm1.png

The next stage is to connect the simulated PLC to the Edge Link IIoT gateway.

The architecture becomes:

PLC Simulator → Serial/UART → Edge Link → Edge AI/ML

The Edge Link receives the PLC telemetry, parses the different packet types, and routes the information to the appropriate processing pipeline.

For example:

  • PLC counters → OEE, production counters, and utilities

  • PLC test data → Product quality and test history

  • PLC alarms → Alarm and machine-event processing

  • Station sensor data → Edge AI/ML inference

From there, the Edge Link can simultaneously:

Synchronize production data to the Cloud

and

Run predictive-maintenance models at the Edge.

This is what turns our simple PLC simulator into a complete Digital Twin → IIoT Gateway → Cloud → Edge AI development environment.

Arduino UNO Q Edge Link App

Screenshot 2026-08-13 173253.png

The next step is to install and configure the Edge Link App on the Arduino UNO Q.

The same GitHub repository contains an EdgeLinkApp.zip file. This ZIP contains the Arduino application and its associated code files.

1. Import the Edge Link App

Open Arduino App Lab and click:

Create New App → Import App

Then select the EdgeLinkApp.zip file from the downloaded PLC_SIM repository.

Arduino App Lab will import the complete Edge Link application, including its code files.

2. Create the.env File

After importing the application, we need to create a .env file in the root directory of the application.

Use the .env.example file included with the application as the template.

The .env file contains the configuration required for the Edge Link application, including the gateway port and Firebase/Google Cloud credentials.

# ==============================================================================
# Edge Link IIoT Platform & Arduino Q Edge App — Environment Template
# ==============================================================================

# Signage HUD & Serial Gateway Port
GATEWAY_PORT=7000

# Google Cloud Firestore / Firebase Configuration Secrets
FIREBASE_API_KEY=YOUR_FIREBASE_API_KEY
FIREBASE_PROJECT_ID=YOUR_FIREBASE_PROJECT_ID
FIREBASE_AUTH_DOMAIN=your-project-id.firebaseapp.com
FIREBASE_STORAGE_BUCKET=your-project-id.firebasestorage.app
FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
FIREBASE_APP_ID=your_firebase_app_id
FIREBASE_MEASUREMENT_ID=your_measurement_id

The .env file is intended for local configuration and should contain your own project credentials.

3. Create and Configure the Firebase Project

The Edge Link application uses Google Cloud Firestore / Firebase for cloud synchronization. We need to create a Firebase project, enable Cloud Firestore, register a Web App, and then copy the Firebase configuration values into our .env file.

3.1 Create a Firebase Project

Go to the Firebase Console: Firebase Console

  • Sign in with your Google account.

  • Click Create a project.

  • Enter a suitable project name, for example:Edge-Link-IIoT

  • Firebase will generate a unique Project ID. You can customize it during project creation, but the Project ID cannot be changed later.

  • Google Analytics is optional for this project. You can disable it if you do not need Analytics.

  • Click Create project and wait for Firebase to finish provisioning the project.

Once completed, you will be taken to the Firebase project dashboard.

3.2 Create the Cloud Firestore Database

Our Edge Link application stores the production and diagnostic data in Cloud Firestore.

From the Firebase project:

  • In the left navigation menu, go to Build → Firestore Database.

  • Click Create database.

  • Keep the Database ID as:(default)

  • Select a suitable Firestore location.

  • Choose a location that is reasonably close to where the application will primarily operate. The location is an important decision because it cannot simply be changed later.

  • Select the appropriate security mode.

  • For an initial development setup, Firebase provides Test mode, but remember that the rules must be properly secured before using the application in a real production environment.

  • Click Create.

The Cloud Firestore database is now ready.

You do not need to manually create all of the collections used by the Edge Link application at this stage. Firestore can create collections and documents when the application performs its first writes.

Our application will organize the data into areas such as production history, test results, alarms, and ML inference data.

3.3 Register a Web App

Next, we need to register a Web App inside the Firebase project.

From the Firebase project overview:

  • Click Project Overview.

  • Click the Web icon (</>) or Add app → Web.

  • Enter an app nickname, for example: Edge-Link-Web-App

  • Do not enable Firebase Hosting unless you specifically want to host the application through Firebase.

  • Click Register app.

Firebase will now display the Firebase SDK configuration object for your Web App. This configuration contains the values that identify your Firebase project and Web App.

3.4 Get the Firebase Configuration

Firebase will show a configuration similar to:

const firebaseConfig = {
  apiKey: "xxxxxxxxxxxxxxxx",
  authDomain: "your-project-id.firebaseapp.com",
  projectId: "your-project-id",
  storageBucket: "your-project-id.firebasestorage.app",
  messagingSenderId: "xxxxxxxxxxxxxxxx",
  appId: "1:xxxxxxxxxxxxxxxx:web:xxxxxxxxxxxxxxxx",
  measurementId: "G-XXXXXXXXXX"
};

Copy these values.

If you have already closed this screen, you can retrieve them again:

Firebase Console → Project Settings → General → Your apps → Web App → SDK setup and configuration → Config

Firebase officially provides the Web App configuration from this section whenever you need it.

3.5 Map the Firebase Configuration to.env

Now open the .env file that we created in the Edge Link App.

Copy the corresponding values from the Firebase Web App configuration:

GATEWAY_PORT=7000

FIREBASE_API_KEY=YOUR_API_KEY
FIREBASE_PROJECT_ID=YOUR_PROJECT_ID
FIREBASE_AUTH_DOMAIN=YOUR_PROJECT_ID.firebaseapp.com
FIREBASE_STORAGE_BUCKET=YOUR_PROJECT_ID.firebasestorage.app
FIREBASE_MESSAGING_SENDER_ID=YOUR_MESSAGING_SENDER_ID
FIREBASE_APP_ID=YOUR_APP_ID
FIREBASE_MEASUREMENT_ID=YOUR_MEASUREMENT_ID

For example, if Firebase gives you:

apiKey: "AIzaSyXXXXXXXX",
projectId: "edge-link-iiot",
authDomain: "edge-link-iiot.firebaseapp.com",
storageBucket: "edge-link-iiot.firebasestorage.app",
messagingSenderId: "123456789",
appId: "1:123456789:web:abcdef123456",
measurementId: "G-ABC123XYZ"

your .env would contain:

FIREBASE_API_KEY=AIzaSyXXXXXXXX
FIREBASE_PROJECT_ID=edge-link-iiot
FIREBASE_AUTH_DOMAIN=edge-link-iiot.firebaseapp.com
FIREBASE_STORAGE_BUCKET=edge-link-iiot.firebasestorage.app
FIREBASE_MESSAGING_SENDER_ID=123456789
FIREBASE_APP_ID=1:123456789:web:abcdef123456
FIREBASE_MEASUREMENT_ID=G-ABC123XYZ

The Firebase configuration is specific to the Firebase project and Web App you created, so do not copy credentials from another project.

4. Run the Application

Once the .env file has been configured, we can run the Edge Link application from Arduino App Lab.

For the first launch, the application may take approximately 30 seconds to start as the required services initialize.

Once the application is running, the Edge Link web application will be available at:

http://127.0.0.1:7000/

In most cases, the application will automatically open the browser.

If it does not open automatically, simply open a browser and navigate to:

http://127.0.0.1:7000/

At this point, the Edge Link App is running on the Arduino UNO Q, and we are ready to connect it with our PLC Simulator and start sending production data through the Edge Link pipeline.

Screenshot 2026-08-13 174604.png

Running the Edge Link with the PLC Simulator

Once the Edge Link App starts running, we can use the physical LEDs on the enclosure to understand the current system status.

1. Edge Link Startup

When the application initially starts, the Red LED will be ON.

The Red LED indicates that there is currently no machine communication or the machine is stopped.

Once the Arduino UNO Q successfully connects to Wi-Fi, the Network Green LED will turn ON, indicating that network connectivity is available.

2. Start the PLC Simulator

Now start the PLC Simulator on the PC.

GIF3_optimized.gif

Once the Edge Link begins receiving communication from the PLC Simulator, the Edge Link will indicate an Idle / Ready state using the Yellow LED.

At this point, the system is connected and ready to start the production line.

3. Start the Production Line

From the PLC Simulator's SCADA dashboard, click LINE START.

The production line will begin running, and the Edge Link will change its status to the Green LED, indicating that the machine is running.

4. Communication and Cloud Synchronization

The LEDs also provide visual feedback while the system is operating.

Whenever messages are exchanged between the PLC Simulator and Edge Link, the corresponding Rx LEDs will blink.

When the Edge Link starts synchronizing production data with the cloud, the Cloud Synch LED will also blink to indicate the cloud synchronization activity.

This provides a simple physical indication that data is actively moving through the system without needing to constantly monitor the software dashboard.

5. Edge Link Dashboard

GIF4_optimized.gif

At the same time, we can open the Edge Link Dashboard in the browser.

The dashboard provides a real-time view of the production line, including:

  • Production trends

  • Production counters

  • Station information

  • OEE and performance information

  • Machine status

  • Quality/test information

  • Alarm information

  • Cloud synchronization status

  • Edge AI/ML information

The physical LEDs provide quick status feedback, while the Edge Link Dashboard gives us the detailed view of what is happening across the simulated production line.

Edge Impulse ML Models

Now let's come to the Edge Impulse ML models running on the Arduino UNO Q.

The Edge Link application package already contains six pre-trained Edge Impulse models, one for each production-line station:

  • pm_st1.eim — Station 1

  • pm_st2.eim — Station 2

  • pm_st3.eim — Station 3

  • pm_st4.eim — Station 4

  • pm_st5.eim — Station 5

  • pm_e1.eim — Overall/production-line model

How the Predictive Maintenance Models Work?

Each model is designed for a specific part of the production line and expects a particular set of input features.

For example, Station 1 – PCB Assembly uses the pm_st1.eim model.

The model monitors parameters such as:

  • accel_x_g

  • accel_y_g

  • accel_z_g

  • vibration_rms_g

  • reflow_zone1_temp_c

  • reflow_zone2_temp_c

  • reflow_zone3_temp_c

  • reflow_zone4_temp_c

  • conveyor_current_a

  • pick_place_vacuum_mbar

These inputs represent different aspects of the Station 1 equipment, including mechanical vibration, reflow oven temperatures, conveyor motor current, and pick-and-place vacuum.

Model Outputs

The Station 1 model can classify the machine condition into states such as:

  • normal_health

  • warning_bearing_wear

  • warning_heater_aging

  • fault_heater_failure

  • fault_vacuum_leak

For example, the model configuration contains representative input presets for normal, warning, and fault conditions. These allow the simulator to generate different machine-health conditions and provide the corresponding feature values to the model.

Real-Time Inference on the Arduino UNO Q

The important part is that the ML inference is performed locally on the Arduino UNO Q.

The PLC Simulator continuously generates the machine data and sends the formatted data to the Edge Link.

The Edge Link identifies the station and extracts the required features for that station's model.

For example:

PLC Simulator

→ Station 1 sensor data → Edge Link → pm_st1.eimArduino UNO Q → Predictive-maintenance inference → Machine-health result

This happens in milliseconds, allowing the system to continuously monitor the health of the production equipment without sending every inference request to the cloud.

Continuous Health Monitoring

The PLC Simulator continuously sends the required formatted sensor data while the production line is running.

For Station 1, the data contains the parameters required by pm_st1.eim. The Edge Link receives these values, prepares the model input, and runs the inference on the UNO Q.

The same process happens independently for the other stations using their respective models.

So instead of having a single ML model monitoring the entire factory, we have station-specific predictive-maintenance models running as part of the Edge AI pipeline.

The Complete Flow

PLC Simulator
                         │
                         │ Machine / Sensor Data
                         ▼
                    Edge Link
                         │
          ┌──────────────┼──────────────┐
          │              │              │
        ST1            ST2            ST3 ... ST5
          │              │              │
          ▼              ▼              ▼
      pm_st1.eim      pm_st2.eim      pm_st3.eim
          │              │              │
          └──────────────┼──────────────┘
                         │
                         ▼
              Edge ML Inference
                         │
                         ▼
              Machine Health Status

This is where the MCU + MPU architecture of the Arduino UNO Q becomes particularly useful. We are not simply collecting data and forwarding it to the cloud- we are continuously processing machine data at the edge and performing predictive-maintenance inference locally.

The cloud can still be used for historical data, visualization, analytics, and long-term monitoring, while the UNO Q provides the low-latency Edge AI layer.

Building Our Own Predictive Maintenance Models with Edge Impulse

Screenshot 2026-08-13 195300.png

Now that we have seen how the pre-trained Edge Impulse models work, let's look at how we can build our own predictive-maintenance models using Edge Impulse.

The first requirement for training an ML model is a large and representative dataset. Since we don't have access to a real production line, we can use our PLC Simulator to generate realistic simulated machine data.

1. Generate the Dataset from the PLC Simulator

GIF5_optimized.gif

The PLC Simulator includes a dedicated Edge Impulse Data Generator directly inside the SCADA web application.

Open the PLC Simulator SCADA interface and select:

Edge Impulse Data Generator

Here we can generate datasets for the different production stations.

  • Select the station/model dataset you want to generate.

  • Enter the required simulation run duration.

  • Click Generate.

The simulator will generate the corresponding machine and predictive-maintenance data and export it as a CSV file.

One of the useful features of this generator is how quickly it can create large datasets.

1 hour of simulated production generates 36, 000 samples at 10 Hz in less than 0.2 seconds.

This gives us a very fast way to generate large datasets without having to wait for a real production line to operate for hours.

For this example, I generated and downloaded the Overall Line Predictive Maintenance dataset as a CSV file.

Create an Edge Impulse Project

Screenshot 2026-08-13 195425.png

Now let's import this dataset into Edge Impulse.

Go to the Edge Impulse platform, sign in with your account, and create a new project.

Once the project is created, we can begin importing our generated dataset.

Screenshot 2026-08-13 195439.png

Import the CSV Using CSV Wizard

  • Inside the Edge Impulse project, go to Data Acquisition.

  • Select: CSV Wizard → Upload CSV

  • Select the CSV file that we generated from the PLC Simulator and click Upload.

  • Edge Impulse will analyze the structure of the CSV file.

  • Review the detected configuration and click: Looks Good,Next.

Configure the Time-Series Data

Screenshot 2026-08-13 195712.png

Edge Impulse will now ask how the CSV data is structured.

For our predictive-maintenance dataset, select:

Is this time-series data?

Yes, this is time-series data (either raw sensor data, or processed features)

Next, configure the data format:

How is your time-series data formatted?

Select: Each row contains a reading, and sensor values are columns.

This tells Edge Impulse that each row represents one measurement and that the different sensor/features are stored in separate columns.

Configure the Timestamp

Next, Edge Impulse asks: Do you have a timestamp or time elapsed column?

Select: Yes

Then configure the timestamp type as:

What type of data is in your timestamp column?

Select: Time elapsed in milliseconds

Click: Great, let's look at your values

Edge Impulse will now display the detected values and allow us to verify that the imported data looks correct.

Configure the Label

Screenshot 2026-08-13 195838.png

Next, Edge Impulse asks whether the dataset contains a label.

Select: Do you have a column that contains the label (the value you want to predict)? Yes

Select the column: label

This is important because the label column contains the machine-health condition that we want the model to learn to identify.

Click Next.

Configure the Sample Length

Screenshot 2026-08-13 195937.png

We now need to define how much time should be included in each ML sample.

For this example, set:

Limit to: 2000 ms

This means each training sample will contain a 2-second time window of sensor data.

Next, configure the handling of labels:

How should we deal with multiple labels in a sample?

Select: The sample should have multiple labels

Click: Finish wizard

Screenshot 2026-08-13 195947.png

Edge Impulse will now create the appropriate data configuration for the dataset.

Upload the Dataset

After completing the CSV Wizard, click:

Upload some data

Select the same CSV file that was generated by the PLC Simulator.

Screenshot 2026-08-13 200014.png

Keep the configurations consistent with what we selected in the CSV Wizard and click: Upload data

Edge Impulse will now process the CSV and create the individual samples from our time-series dataset.

Screenshot 2026-08-13 201402.png

We can now use this dataset to create the Impulse, configure the processing blocks, extract useful features, train the model, and evaluate how well it can identify different machine-health conditions.

Create the Impulse

Screenshot 2026-08-13 201532.png

Now let's create the Impulse for our predictive-maintenance model.

  • Go to Create Impulse.

  • Set the Window size to 2000 ms.

  • Set the Window increase (stride) to 2000 ms.

  • Under Processing block, select Spectral Analysis.

Under Learning block, select:

  • Classification

  • Anomaly Detection (K-Means)

  • Under Learning block, select:ClassificationAnomaly Detection (K-Means)

  • Click Save Impulse.

Screenshot 2026-08-13 201704.png

Generate Features

Screenshot 2026-08-13 201730.png

Now that the Impulse has been created, we can generate the features from our dataset.

1. Spectral Features

Go to Spectral Features.

Here, Edge Impulse shows the extracted features for each data point. The Feature Explorer helps us visualize how the different classes are distributed based on these features.

Once you are satisfied with the feature configuration, click:

Save parameters

2. Generate Features

Screenshot 2026-08-13 202514.png

Next, go to Generate Features.

Under Normalize features, select:

Normalize using the standard scaling method

Then click: Generate features

Edge Impulse will process all the samples in our dataset and generate the corresponding features.

Screenshot 2026-08-13 202401.png

These generated features will now be used for the next step: training our Classification and Anomaly Detection models.

Train the Classification Model

Screenshot 2026-08-14 081342.png

  • Now go to the Classification page.

  • Change the learning rate to 0.01, other settings at their default values and click: Save & Train

  • Edge Impulse will now use the generated features and train the classification model.

Once training is complete, we can review the accuracy, confusion matrix, and model performance.

It is important to remember that a high accuracy score alone does not necessarily mean the model is good. We should also look at the confusion matrix, F1 score, precision, recall, and the separation of classes in the Data Explorer.

Example 1 - Overall Line Model

Screenshot 2026-08-14 081350.png

The first result shows an 86.2% validation accuracy with a loss of 0.38.

The model performs very well on some classes:

  • fault_utility_breakdown100%

  • normal_plant_health100%

  • warning_line_power_surge70.8%

However, there is confusion between some warning classes. For example, warning_air_compressor_drop is frequently classified as warning_line_power_surge.

This tells us that the features generated for these two conditions are relatively similar, so the model has difficulty separating them.

The other metrics are:

  • AUC: 0.92

  • Weighted Precision: 0.82

  • Weighted Recall: 0.86

  • Weighted F1: 0.83

The F1 score of 0.83 gives us a better overall indication than accuracy alone because it considers both precision and recall.

Example 2 - Station 4 Classification

Screenshot 2026-08-14 081737.png

The second screenshot is the Station 4 classification model.

This model performs significantly better:

Validation Accuracy: 98.7%

Loss: 0.03

The confusion matrix shows that:

  • fault_pressure_drop100%

  • fault_vacuum_fail100%

  • normal_health100%

  • warning_pneumatic_leak94.9%

  • warning_vacuum_pump_wear89.1%

The overall metrics are also excellent:

  • AUC: 1.00

  • Weighted Precision: 0.99

  • Weighted Recall: 0.99

  • Weighted F1: 0.99

The model is also extremely lightweight for Edge deployment:

  • Inference time: 1 ms

  • Peak RAM: 1.4 KB

  • Flash usage: 15.3 KB

This is particularly interesting for our project because it shows that a model can achieve very fast inference while requiring very little memory, making it suitable for running directly on the edge.

Why Do We Get Different Results?

  • The two models don't necessarily have the same difficulty.

  • Different stations have different sensor characteristics and different fault conditions. Some conditions produce very distinctive patterns, while others may look very similar.

  • For example, if two fault conditions produce almost identical vibration, temperature, current, or pressure patterns, the model will have a harder time distinguishing them.

  • This is why dataset quality and feature selection are extremely important.

Let's Experiment to Get Better Results

  • Instead of simply accepting the first training result, we should experiment with the model configuration.

  • There is no single configuration that is guaranteed to give the best result for every dataset.

  • Try changing one parameter at a time and retrain the model.

Things to Experiment With

1. Learning Rate

We used: 0.01

Try different values and compare the results.

For example:

0.001
0.005
0.01
0.02
0.05

A learning rate that is too high can make training unstable, while one that is too low can make training slower or fail to learn effectively.

2. Window Size

We currently use:

1000 ms
2000 ms
3000 ms
4000 ms

The correct window depends on how quickly the machine condition changes.

For vibration or rapidly changing signals, a shorter window may work better. For slower temperature or pressure changes, a longer window may capture more useful information.

3. Window Stride

We currently use:

2000 ms

Experiment with smaller strides if you want more overlapping training samples.

For example:

500 ms
1000 ms
2000 ms

A smaller stride creates more overlapping windows, although it also increases the number of samples and can introduce highly similar samples.

4. Spectral Analysis Parameters

  • Don't assume the default spectral configuration is always optimal.

  • Experiment with the spectral feature configuration and observe the Feature Explorer.

  • The goal is to get good separation between different machine-health classes.

  • If two classes are heavily overlapping in the Feature Explorer, that is a sign that we may need better features or better data.

Most Important: Improve the Dataset

In my opinion, dataset quality is more important than simply tuning the learning rate.

For every machine condition, try to generate enough representative data.

Normal
├── different operating speeds
├── different loads
└── normal sensor variation

Warning
├── early-stage condition
├── moderate condition
└── different operating conditions

Fault
├── different fault severity
└── different operating conditions

The model should not learn one very specific sensor pattern and assume that it always represents a particular fault.

It should learn the underlying machine condition.

New Training Result

Screenshot 2026-08-14 084723.png

After experimenting with the model configuration, we now have a much better result for the Overall Line Classification model.

Screenshot 2026-08-14 084752.png

Model Performance

  • Validation Accuracy:96.0%

  • Loss:0.07

  • AUC:1.00

  • Weighted Precision:0.96

  • Weighted Recall:0.96

  • Weighted F1 Score:0.96

This is a significant improvement compared with our earlier 86.2% accuracy.

Confusion Matrix

The model now correctly identifies:

  • fault_utility_breakdown100%

  • normal_plant_health100%

  • warning_air_compressor_drop65.2%

  • warning_line_power_surge87.5%

  • warning_plant_vibration100%

The main remaining confusion is between:

warning_air_compressor_dropwarning_line_power_surge

Around 34.8% of the air-compressor-drop samples are being classified as line-power-surge, while 12.5% of line-power-surge samples are being classified as air-compressor-drop.

So there is still some overlap between these two conditions.

What Improved?

Previously, we had:

86.2% Accuracy → 0.83 F1

Now we have:

96.0% Accuracy → 0.96 F1

That is a substantial improvement, and the Data Explorer also shows better separation between several classes.

Train the Anomaly Detection Model

Screenshot 2026-08-14 085134.png

Now let's configure the Anomaly Detection model.

  • Go to the Anomaly Detection page.

  • Click Select suggested axes.

  • Edge Impulse will automatically select the most suitable axes/features for the model.

  • Click Save & Train.

Edge Impulse will now train the K-Means anomaly detection model using the selected features.

Once training is complete, we can review the anomaly detection results and see how well the model identifies normal behavior versus unusual or abnormal conditions.

Screenshot 2026-08-14 085232.png

The Anomaly Explorer shows how the test data compares with the normal training data.

  • The blue points/regions represent the training data and learned normal clusters.

  • The orange points represent the test data.

  • The selected axes are line_active_power_kw and line_ambient_temp_c with their extracted features.

  • Points that stay close to the learned clusters are considered normal.

  • Points that fall far outside the learned clusters can be identified as anomalies.

The Anomaly Score and Average Axis Distance below the graph provide numerical information about how far the test data is from the learned normal behavior.

In our case, the test data is largely within the learned regions, showing that it follows the expected pattern.

Deploy the Model to Arduino UNO Q

Now let's deploy our trained Edge Impulse model to the Arduino UNO Q.

  • Go to the Deployment page in Edge Impulse.

  • Under Deployment Target, select Arduino UNO Q.

  • Click Build.

Screenshot 2026-08-14 090218.png

Edge Impulse will now compile the trained model into a deployment package optimized for the Arduino UNO Q.

This package can then be integrated into our Edge Link application and used for real-time Edge AI/ML inference directly on the UNO Q.

Once the Build process is complete, Edge Impulse automatically downloads the generated.eim model file.

Screenshot 2026-08-14 091134.png

Now we can copy the generated.eim file into the appropriate Arduino UNO Q / Edge Link application folder and configure the application to use the new model.Arduino's current App Lab workflow also supports deploying custom Edge Impulse models to the UNO Q, with the model becoming available to the relevant AI brick after deployment.

My Edge Impulse Models

These are the Edge Impulse projects/models used in this project:

You can train multiple specialized ML models, deploy them to the Arduino UNO Q, and run the intelligence locally at the edge rather than sending every piece of data to the cloud. Edge Impulse and Arduino App Lab now explicitly support custom models and multiple models in an application.

Conclusion

DSC05635.JPG

In this project, we have not used a real production line or industrial PLC, simply because I did not have access to one. Instead, I used the PLC Simulator to reproduce the behavior of a production line and demonstrate the complete concept.

But the important point is that the same architecture can be adapted to a real production environment.

The question is: How do we connect an existing PLC, machine, or industrial controller to our Edge Link running on the Arduino UNO Q?

There are many possibilities depending on what interface and protocol the existing equipment provides.

For example:

  • RS-485 → Modbus RTU and other serial protocols

  • RS-232 → Serial communication with suitable interface hardware

  • Ethernet → Industrial Ethernet/TCP-based protocols where supported

  • Digital I/O → Read machine status, sensors, alarms, counters, etc.

  • Analog I/O → Read values such as temperature, pressure, current, etc.

  • CAN/CAN-based interfaces → For machines and controllers that expose CAN communication

  • Existing gateways → Where the machine already provides OPC UA, MQTT, or another higher-level interface

The Idea Behind This Project

And this brings me to the actual reason why I built this project.

Not every factory can afford to replace its existing equipment.

A factory may already have perfectly functional PLCs, machines, sensors, and controllers that have been running for years. Replacing all of that just to introduce modern IoT, Cloud, Analytics, and AI can be extremely expensive.

But that doesn't mean the factory should lose access to the gold of manufacturing — its production data.

Instead, we can build a layer around the existing infrastructure:

Existing Machine / PLC

Edge Link(Arduino UNO Q)

Data Processing + Edge AI/ML

Cloud / Dashboard / Analytics

This approach allows us to modernize existing equipment instead of replacing it.

And the other important advantage is flexibility.

With a fixed commercial system, we may be limited to whatever features, dashboards, integrations, and analytics the vendor provides.

With our own Edge Link platform, we have much more control.

We can decide:

  • Which machine data we collect

  • Which protocols we support

  • Which ML models we run

  • Where the data is processed

  • What gets sent to the cloud

  • What remains locally on the edge

  • How the dashboard looks

  • What actions should be triggered

  • How the system integrates with existing software

And because the Edge AI runs locally, we don't necessarily need to send every raw sensor value to the cloud just to make a decision. The edge device can process the data, detect an anomaly or predict a machine condition, and then send only the useful information upstream.

The Bigger Picture

So I don't see this project simply as an Arduino + PLC Simulator + Cloud dashboard.

The idea is to create a retrofit-friendly Edge AI platform that can sit alongside existing industrial equipment.

It can potentially turn:

Legacy Machine → Connected Machine → Intelligent Machine

without requiring the entire production line to be replaced.

Mfr Part # ABX00173
ARDUINO UNO Q 4GB RAM 32GB EMMC
Arduino
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.