Weekly Labs
One lab per class, for the Arduino UNO Q half of IESTI05
Each class in this part of the course is one hour, which is enough to introduce a topic and start working, not to finish. These labs are what students carry out of the room: a concrete task tied to one chapter, with a deliverable to hand in before the next class.
Classes are numbered 16 to 28, continuing the course sequence. The chapter links go to the relevant part of this book.
Before Class 16: the Fixed-Function Half
These labs pick up where the course’s first part leaves off. Classes 1 to 15 cover reactive AI — Linux and Python setup, image classification with LiteRT and Edge Impulse, object detection with Edge Impulse and YOLO, a bee-counting project, and text generation with an RNN.
That material was written around the Raspberry Pi, and the companion volume EdgeML Made Easy documents it. It also runs on the Arduino UNO Q with modest adaptation: the models, the training workflow in Edge Impulse, and the concepts are identical, and the Linux side is Debian in both cases.
What genuinely differs is deployment. On the UNO Q you package a model, a web interface, and an MCU sketch as one App Lab application and drive it with arduino-app-cli, rather than running a Python script on the Pi. Part 2 of this book — Image Classification and Object Detection — covers exactly that path, so a student who did Classes 5 to 12 on a Pi can redo them on the UNO Q without relearning the task, only the toolchain.
If you are teaching the whole course on UNO Q hardware, the practical consequence is that students already know Linux, SSH, and Edge Impulse by Class 16. Class 18 is then a shorter session than it looks.
Class 16 — How Generative AI Works
Chapter: How Generative AI Works, and How It Gets Small
Objectives:
- Build working vocabulary: tokens, embeddings, pretraining, quantization, distillation
- See why a model’s context window is measured in tokens, not words
- Apply the RAM budget rule to a real board
Instructions:
- Read the chapter, paying attention to sections 4 and 5.
- Open the OpenAI tokenizer. Paste one paragraph in English and the same paragraph in Portuguese. Record the token count for each.
- Open the TensorFlow Embedding Projector. Search for a word from your field and inspect its nearest neighbours.
- Work through the Transformer Explainer one layer at a time.
- Using the rule of thumb from the SLMs chapter — usable model size ≈ (total RAM − OS and apps) × 0.7 — estimate the largest model that fits on a 4 GB UNO Q.
Deliverable: A half-page note with the two token counts and an explanation of why they differ, plus your RAM estimate and the arithmetic behind it.
Class 17 — SLMs on Your Own Machine
Chapter: SLMs at the Edge
Objectives:
- Run a language model locally, with no cloud account
- Measure tokens per second on hardware you own
- Compare two quantizations of the same model
Instructions:
- Install one runtime on your own computer: Ollama, LM Studio, or
llama.cpp. Section 4 covers all three. - Pull a model in the 0.5B–2B range and run a first prompt.
- Record tokens per second and peak RAM.
- Download a second quantization of the same model — Q4 against Q8 — and run the identical prompt.
- Note where the answers differ, not only how fast they are.
Deliverable: A table with model, quantization, file size, tokens per second, and peak RAM for both runs, plus two sentences on any quality difference you noticed.
Class 18 — Arduino UNO Q Setup
Chapter: Arduino UNO Q Setup
Objectives:
- Bring up a UNO Q headless, with no monitor or keyboard
- Reach the board over SSH from your own machine
- Run one of the pre-installed example applications
Instructions:
- Install ADB on your host computer and confirm
adb devicessees the board. - Flash the latest Linux image.
- Open an ADB shell and change the default password.
- Configure Wi-Fi from the terminal, then enable SSH and connect over the network.
- List the pre-installed examples and run one with
arduino-app-cli.
Deliverable: A screenshot of an SSH session on the board showing the output of arduino-app-cli and the result of a running example.
Class 19 — Running SLMs on the UNO Q
Chapter: Generative AI at the Edge
Objectives:
- Build
llama.cppfrom source on the board - Download a GGUF model and generate the first tokens on-device
- Measure real throughput on four Cortex-A53 cores
Instructions:
- Verify swap is present and install the build tools (chapter sections 4 and 5).
- Clone
llama.cppand build it. Expect this to take a while on the board. - Confirm
llama-cliandllama-serverexist. - Create
~/modelsand download Qwen3.5-0.8B at Q8_0. - Run a first prompt with
llama-cliand record the reported tokens per second.
Deliverable: Terminal output of your first on-board generation, with the tokens-per-second figure highlighted. Compare it to the number you measured on your laptop in Class 17.
Class 20 — Benchmarking and Model Selection
Chapter: Generative AI at the Edge, section 7
Objectives:
- Quantify the cost of quantization on a sub-1B model
- Decide which model to use for a stated task, with evidence
Instructions:
- Download Qwen3.5-0.8B at Q4_K_M alongside the Q8_0 you already have.
- Run the same three prompts through both, one of which must require structured output such as JSON.
- Record tokens per second, memory use, and whether the structured output parsed.
- Repeat with SmolLM2-360M to see the floor of what is usable.
- If you have a 4 GB board and time, try Qwen3.5-2B at UD-Q4_K_XL.
Deliverable: A comparison table across all models tested, ending with one paragraph recommending a model for a battery-powered sensor node that must return valid JSON. Justify it with your own numbers.
Class 21 — Talking to the Model from Python
Chapter: Generative AI at the Edge, section 9
Objectives:
- Run
llama-serverand call it from code - Get reliable structured output from a small model
Instructions:
- Start
llama-serverand confirm it responds to acurlrequest. - Create a Python virtual environment and install the
openaiclient. - Write a script that sends a prompt and prints the reply.
- Change it to request JSON, using a system prompt and a few-shot example.
- Run it ten times on the same input and count how often the JSON parses.
Deliverable: Your script, plus the pass rate out of ten runs and a note on what you changed to improve reliability.
Class 22 — Multimodal AI at the Edge
Chapter: Multimodal AI at the Edge
Objectives:
- Give the same model vision by loading a projector
- Judge honestly what a sub-1B vision model gets right and wrong
Instructions:
- Download the
mmprojprojector matching your model. Do not mix a 0.8B projector with a 2B model. - Start the vision server and send it an image.
- Describe three photographs you took yourself, at least one cluttered or poorly lit.
- Test on a potential mosquito breeding site, as in the VisText-Mosquito section.
- Note where the model hallucinates detail that is not in the image.
Deliverable: The three images with the model’s descriptions, and a short assessment of each: correct, partly correct, or invented.
Class 23 — Agentic AI: Tools and the WebUI
Chapter: Agentic AI at the Edge
Objectives:
- Understand what separates an agent from a chatbot
- Watch a model choose tools and observe when it chooses badly
Instructions:
- Confirm your
llama.cppbuild supports the tools API. - Start the server with read-only tools only.
- Open the built-in WebUI and read the tools panel.
- Set the agentic limits, then give it a task needing two tools in sequence.
- Add a writing tool deliberately, and read the safety note before you do.
Deliverable: A transcript of one interaction where the model called at least two tools, annotated with where its reasoning went wrong or right.
Class 24 — Building an Agent on the UNO Q
Chapter: Agentic AI at the Edge, sections 5 to 8
Objectives:
- Design a tool set with a deliberately small attack surface
- Implement the agent loop and drive hardware from a tool call
Instructions:
- Create the app and seed its workspace.
- Implement the Python-side tools.
- Write the MCU sketch driving the built-in LED and LED matrix, and check the matrix orientation on the board.
- Define the tool schemas and dispatch table, then build the loop.
- Add the HTTP interface and exercise it end to end.
Deliverable: A short screen recording of your agent answering a request that requires at least two tool calls, one of which changes something physical on the board.
Class 25 — Physical AI and Bridge RPC
Chapter: GenAI Meets the Real World, sections 4 and 5
Objectives:
- Run
llama-serveras a service that survives reboot - Explain the dual-brain split in your own words
Instructions:
- Optionally set up VS Code Remote-SSH; everything also works from a plain terminal.
- Create the
llama-serversystemd unit file. - Enable and start the service, then check its status.
- Reboot the board and confirm the model is serving without you touching it.
- Read section 5 and trace one request from the MCU to the model and back.
Deliverable: Output of systemctl status taken after a reboot, plus a diagram you draw yourself of the path a sensor reading takes to become an LED colour.
Class 26 — Physical AI Project
Chapter: GenAI Meets the Real World, sections 6 to 9
Objectives:
- Build a complete dual-brain application
- Connect a model’s verdict to a physical output
Instructions:
- Create the app skeleton and edit
app.yaml. - Write
python/requirements.txtandpython/main.py. - Wire the hardware and write
sketch/sketch.inoandsketch/sketch.yaml. - Run the full application and confirm the MCU responds to the model’s classification.
- Test the Flask endpoint from another machine on the network.
Deliverable: A demonstration video showing a changed sensor reading producing a different model verdict and a different physical output, plus your project repository.
Classes 27 and 28 — RAG at the Edge
In development. These classes will cover retrieval-augmented generation on the UNO Q. Until the material exists, the Advancing Edge AI chapter of the companion Raspberry Pi volume covers the same ground, and the approach carries over using the llama-server setup from Class 21.
Notes for Instructors
The labs assume students have their own UNO Q from Class 18 onward, and a 4 GB board from Class 19 — the 2 GB variant will not hold the models used after that point.
Classes 16 and 17 need no board at all. That is deliberate: it lets the course start while hardware is still in transit, and it gives every student a laptop baseline to compare the board against in Class 19.
Deliverables are sized for one week between classes, not for the hour itself.