
Project description
On an assembly line, a Human-Machine Interface (HMI) displays process values, actuator states, and similar signals. This information is valuable but it requires a skilled operator to interpret it and decide what needs to be done. A few years ago, AI in such industrial systems was mostly used for classifications and anomaly detection. Generative AI models let us go further by giving us richer context about production. Therefore a GenAI-powered HMI can enable operators to understand events such as assembly operations and even describe failures. However, running generative models can be challenging because industrial systems with similar computational power such as an Arduino UNO Q. Devices like that are constrained edge devices. Two innovations can make this possible:- Using Small Language Models (SLMs) such as Gemma, Qwen, SmolLM, Llama, among others.
- Model cascading whereby multiple lightweight models handle specific tasks and the larger model such as Gemma is run on demand.

Hardware and Software Requirements
Hardware
- Arduino® UNO Q: either the 2GB or 4GB variant.
- Modulino™ Movement
- USB-C® cable
- Personal computer with Internet access
- 3D printed tool support for the Modulino™ movement module
Software
- Edge Impulse Studio
- Arduino App Lab
- Small Language Models available locally through App Lab: Qwen, Llama, Gemma
Step 1: Assemble the tool support
The setup process for this demonstration is simple. First download this CAD design and 3D print it. This is a simple holder that carries the Modulino™ Movement module and has a slot into which a tool can be inserted. In my case, I used an Allen key as the tightening tool and because my electrical box had Phillips cross head screws, I added a simple 3D printed flat end socket that fits onto one end of the Allen key and lets it grip the Phillips screws.

Step 2: Set up your Arduino UNO Q
Before working with the Arduino UNO Q for the first time, we need to set up its Linux system through the App Lab. Arduino has documented the necessary steps in the user manual.
Step 3: Train a motion classification model with Edge Impulse
3.1: Collect tool motion data
Upload this sketch to your UNO Q. It reads accelerometer values and prints the three axes (X, Y, Z) to Serial. You can use App Lab or the Arduino IDE to upload the sketch to the STM32 brain of your UNO Q.
Ax, Ay, Az as the sensor axes.








3.2: Train a motion classifier
Before training the motion classifier, we need to set up an Impulse which is a configuration that defines the input data type, pre-processing algorithm, and the Machine Learning model. Click ‘Create Impulse’ and choose your processing settings. I set the input data to a window size of 1000ms (1 second) and a window increase of 500ms. The sampling frequency of 44Hz is automatically set by the UNO Q’s connection. I used Spectral Analysis for feature extraction because the algorithm is great for analyzing repetitive motion, such as data from accelerometers. It extracts the frequency and power characteristics of a signal over time. Save the impulse configuration and open the Spectral features section.



3.3: Deploy motion classifier to UNO Q
We will deploy the model as an Arduino library - a single package containing all the steps for sampling IMU data for 1 second, processing the data and feeding the features to the classifier. You can include this library in your own sketches to run the impulse locally on microcontrollers such as the STM32 on the UNO Q. Technically no programming is needed to deploy the Impulse as the Edge Impulse platform generates all the required source code and example sketches as well. Awesome!
model_metadata.h file in the Arduino library folder (Tool_motion_classification_-_UNO_Q_inferencing\src\model-parameters) and change the value of EI_CLASSIFIER_SENSOR from EI_CLASSIFIER_SENSOR_FUSION to EI_CLASSIFIER_SENSOR_ACCELEROMETER.
Once the file has been updated, upload this example sketch to the STM32 MCU for continuous motion classification. Open a Serial Monitor and you should see the model’s predictions being logged.

Step 4: Download the HMI Copilot
Installing the HMI application on an Arduino UNO Q is simple. SSH into the board and clone this GitHub repository into the/home/arduino/ArduinoApps/ directory.

Step 5: Install a Small Language Model
Recall our pipeline had two cascaded models: a perception model (motion classification), and a Small Language Model. Technically, developing the first model takes the most time because SLMs are already trained for general language based tasks. Open the HMI Copilot project in App Lab, click the ‘Large Language Model (LLM)’ brick and navigate to the ‘AI models’ tab. Download and select one of the available models. I used Qwen 3.5 0.8B because it is relatively small and can generate a response more quickly. Other supported models such as Gemma 3 1B can be used depending on your hardware and use case.
Step 6: Run the HMI Copilot


Workflow visualizer
The first section of the Web UI-based HMI is a workflow visualizer. It shows assembly progress in real time: the tool moving to a screw, tightening it, and putting the tool down (idle). An assembly is marked as successful when 4 screws are tightened. A state machine (run by main.py) handles the realities of assembly workflow. When an operator picks the next electrical box for assembly, the tool goes idle, and the state machine infers that the previous assembly work has been finished and a new one is about to start. The idea is that sometimes an operator may tighten say 2 out of 4 screws and the unit will be recorded as defective.
Assembly counters
The interface keeps running counts of both successful and defective assemblies. The Qwen language model is run periodically (interval set by thePERIODIC_LLM_FEEDBACK_INTERVAL_S variable in main.py) to notify the operator about defective assemblies and to describe how the last assembly went.

Copilot chat
A chat box lets the operator ask the language model questions about the assembly. In the example below, I asked the model to summarize various assemblies and it gave an impressive response. The model however failed to respond about assembly 14 and this is one of the limitations of small language models. Sometimes they hallucinate, or do not follow instructions well because they are built with limited training data and a small model size.