Arduino UNO Q - Potentiometer fade LED
This tutorial shows how to use a potentiometer to control the brightness of an LED with Arduino UNO Q. Turning the potentiometer knob changes the LED brightness in real time.
※ NOTE THAT:
Arduino UNO Q ADC difference: The STM32 MCU on Arduino UNO Q has a 12-bit ADC (values 0–4095), not 10-bit (0–1023). Map ADC values from 0–4095 to brightness 0–255 when using analogWrite().

Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Buy Note: Use the LED Module for easier wiring. It includes an integrated resistor.
Overview of the Potentiometer and LED
If you are new to the potentiometer or LED, check these tutorials first:
Wiring Diagram

This image is created using Fritzing. Click to enlarge image
How To Program
- Read ADC value from pin A0 (12-bit on Arduino UNO Q, 0–4095):
- Map ADC value to PWM brightness (0–255):
- Write brightness to the LED pin using PWM:
MCU Code — Potentiometer controls LED brightness
The Arduino UNO Q has two processors: the STM32 MCU (handles real-time hardware control) and the Qualcomm MPU (runs Debian Linux). In this section, only the STM32 MCU is programmed — the Linux side stays idle. A later section will show how both processors work together.
Detailed Instructions
- First time with Arduino UNO Q? Follow the Getting Started with Arduino UNO Q tutorial to get your development environment ready before proceeding.
- Wire the components: Connect the potentiometer output to A0, GND to GND, VCC to 3.3V. Connect the LED (with 220 Ω resistor) to pin 3 according to the wiring diagram.
- Connect: Plug the Arduino UNO Q into your computer with a USB-C cable.
- Open Arduino App Lab: Launch Arduino App Lab and wait until it detects your Arduino UNO Q.
- Create a new App: Click the Create New App button.

- Give the App a name, for example: DIYables_PotLED
- Click Create to confirm.
- You will see a set of folders and files generated inside your new App.

- Find the sketch/sketch.ino file — this is where you will paste the MCU sketch.
- Install the library: Click the Add sketch library button (the open book icon with a + sign) in the left sidebar.

- Search for Arduino_RouterBridge created by Arduino and click the Install button.
- Upload: Click the Run button in Arduino App Lab to compile and upload to the STM32.

- Turn the potentiometer knob — the LED brightness should change smoothly in real time.
Linux + MCU Bridge Programming
The Arduino UNO Q has two processors that work together: the MPU (Qualcomm, runs Debian Linux) and the MCU (STM32, runs Zephyr OS with your Arduino sketch). They communicate using RPC via the Arduino_RouterBridge library — never via raw serial ports.
- The potentiometer and LED are connected to the MCU (STM32) — the potentiometer output wires to analog pin A0 and the LED to a PWM-capable output pin. The MCU continuously reads ADC values and updates the LED brightness in loop().
- The MPU cannot read the potentiometer or control the LED directly — it must request the current brightness from the MCU via Bridge.call().
- The MPU has Wi-Fi — because the MPU runs full Debian Linux with Wi-Fi, it can report the brightness level via Telegram on demand.
- Communication: Bridge.call() on the Linux side invokes Bridge.provide() functions on the MCU side
- ⚠️ Reserved: /dev/ttyHS1 (Linux) and Serial1 (MCU) are used by the Arduino Router — never open them directly
In short: MPU requests brightness → MCU reads ADC and converts → MCU reports ADC and brightness values → MPU logs or forwards it.
MCU sketch — potentiometer-LED with Bridge and Monitor output:
Python script (Arduino App Lab) — poll brightness from Linux:
- Note: Make sure Bridge.begin() is called in the MCU sketch and the sketch is uploaded before running the Python script on the Linux side.
- ⚠️ Warning: Never directly open /dev/ttyHS1 (on Linux) or use Serial1 (on MCU) in your code — these are reserved by the Arduino Router and accessing them will break the Bridge.
Detailed Instructions
- Upload the MCU sketch: Open Arduino App Lab, create a new App, paste the Bridge MCU sketch above into sketch/sketch.ino, install the Arduino_RouterBridge library, and click Run.
- Add the Python script: Paste the Python code above into the Python tab of the same App.
- Run the App: Click Run — the Python side polls the brightness level every second.
- Turn the potentiometer knob and watch the LED brighten and dim.
- Check the console: Open the Console tab → MCU Monitor subtab to see ADC and brightness values logged.
App Lab Console Output
Telegram Integration
Check the current brightness level remotely from anywhere via Telegram.
If you do not have a Telegram bot yet, see How to Create a Telegram Bot to get your bot token before continuing.
MCU sketch: Keep the same MCU sketch from the previous Bridge section — no changes needed. Make sure it is already uploaded and running on the STM32 before proceeding.
Python script (Arduino App Lab) — Telegram bot for brightness level:
- Note: Replace YOUR_BOT_TOKEN with the token obtained from @BotFather on Telegram.
- Send /brightness to check the current ADC and brightness values.
Detailed Instructions
- Upload the MCU sketch: Use the Bridge MCU sketch from the previous section (upload it first if not already done).
- Paste the Telegram script: Copy the Python code above into the Python tab of your App in Arduino App Lab.
- Set your token: Replace YOUR_BOT_TOKEN in the script with your actual bot token.
- Run the App: Click Run — the bot starts listening for Telegram messages.
- Test it: Turn the potentiometer, send /brightness — the bot replies with the ADC and PWM brightness value.
App Lab Console Output
ArduinoBot
OpenClaw Integration
OpenClaw integration for Arduino UNO Q potentiometer-LED control is coming soon.
- Coming Soon: OpenClaw support for potentiometer-controlled LED brightness on Arduino UNO Q will be covered in a future update.
Application/Project Ideas
- Smart dimmer: Use a potentiometer as a physical brightness control for a light — monitor level via Telegram
- Volume knob indicator: Display the current "volume level" mapped from the potentiometer on a remote monitor
- Ambient light controller: Tie potentiometer position to a warm-white LED strip brightness
- Manual override panel: Use the potentiometer to manually override an automated brightness schedule
- Visual feedback dial: Map potentiometer to an LED array that shows progress or level
Challenge Yourself
- Easy: Add a second LED that fades inversely (when LED 1 is bright, LED 2 is dim)
- Medium: Expose both ADC value and percentage (0–100) via Bridge callbacks
- Advanced: Build a Telegram bot that logs brightness readings at a fixed interval and sends a daily summary