Arduino UNO Q - LED Module

A bare LED needs a resistor, the right orientation and a small breadboard circuit before it lights up even once. The LED module skips all of that: three labeled pins, plug in, done. On the Arduino UNO Q, the STM32 MCU switches the module, and the Linux side can turn it into a remote status light — dimmed from a Python script or switched from your phone with a Telegram message.

In this tutorial, you will learn:

Arduino UNO Q LED Module

Hardware Preparation

1×Arduino UNO Q
1×USB Cable for Arduino Uno Q
1×LED Module
1×Jumper Wires
1×Recommended: Screw Terminal Block Shield for Arduino Uno
1×Recommended: Sensors/Servo Expansion Shield for Arduino Uno
1×Recommended: Breadboard Shield for Arduino Uno
1×Recommended: Enclosure for Arduino Uno
1×Recommended: Prototyping Base Plate & Breadboard Kit for Arduino UNO

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
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 LED Module

LED module pinout
image source: diyables.io

The DIYables LED module is a 10mm diffused round LED mounted on a small 20mm x 20mm black board. Next to the LED sit a 330Ω resistor, a 1KΩ resistor and a tiny transistor. In plain words, it is an LED with its resistor and its driver already on board. The LED takes its power from the VCC pin, and the IN pin only tells the transistor to open or close. The pack comes with five colors: red, yellow, blue, green and white.

Item Value
Operating voltage 3.3V to 5V DC
LED 10mm, diffused, round
Logic Active HIGH (IN = HIGH turns the LED on)
Brightness control PWM on the IN pin
Board size 20mm x 20mm
Header 3-pin, 2.54mm, right-angle, presoldered

The three header pins are printed on the board in this order:

  • GND: connect to a GND pin of the Arduino UNO Q
  • VCC: connect to 5V (3.3V also works, with a slightly dimmer light)
  • IN: the control input — connect to a digital pin of the MCU. Pick a PWM pin if you want to dim the LED

Why this matters on the Arduino UNO Q: the MCU pins give only 3.3V for HIGH. With a bare LED, the light then depends on that 3.3V pin and its small current. With the module, the pin only drives the transistor, while the LED itself runs from VCC — so it stays bright and the MCU pin is barely loaded.

※ NOTE THAT:

Compared with a bare LED: you do not add a resistor, and you cannot plug it in the wrong way round, because the pins are labeled instead of being a long leg and a short leg. If you want to learn the bare LED first, see Arduino UNO Q - Blink LED.

Wiring Diagram

The module needs just three jumper wires — no breadboard. IN goes to pin 9, which is one of the PWM pins of the STM32 MCU, so the same wiring works for blinking and for fading.

The wiring diagram between Arduino UNO Q LED module

This image is created using Fritzing. Click to enlarge image

LED Module Pin Arduino UNO Q
GND GND
VCC 5V
IN Pin 9

※ NOTE THAT:

Pins 3, 5, 6, 9, 10 and 11 of the Arduino UNO Q can make PWM. If you only need on/off, any digital pin works — just change LED_MODULE_PIN in the code.

How To Program For LED Module

Because the transistor and resistor are already on the board, the code is the same as for a single digital output. No library is needed.

  1. Make the IN pin an output in setup() with pinMode():
pinMode(LED_MODULE_PIN, OUTPUT);
  1. Switch the LED fully on or off with digitalWrite(). The module is active HIGH:
digitalWrite(LED_MODULE_PIN, HIGH); // LED on digitalWrite(LED_MODULE_PIN, LOW); // LED off
  1. Set any brightness between 0 (dark) and 255 (full) with analogWrite(). This only works on a PWM pin:
analogWrite(LED_MODULE_PIN, 64); // about one quarter brightness

Arduino UNO Q Code

The Arduino UNO Q has two processors:

  • The STM32 MCU runs the sketch and drives pin 9, which goes to the IN pin of the module
  • The Qualcomm MPU runs Debian Linux with Wi-Fi and Python
  • In this part, only the MCU gets code. Linux joins in the Bridge section later

Example 1 - Blink the LED Module

This sketch keeps the LED on for one second and off for one second, and writes each change to the console.

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-led-module */ // Arduino UNO Q - LED Module: blink the module once per second // Wiring: LED module IN -> D9, VCC -> 5V (or 3.3V), GND -> GND // The module has its own resistor and transistor, so no extra resistor is needed. #define LED_MODULE_PIN 9 // The Arduino UNO Q pin connected to the IN pin of the LED module void setup() { Serial.begin(115200); delay(1500); pinMode(LED_MODULE_PIN, OUTPUT); // the IN pin is driven by a digital output Serial.println("Arduino UNO Q LED Module blink started"); } void loop() { digitalWrite(LED_MODULE_PIN, HIGH); // IN = HIGH -> the module lights up Serial.println("LED module: ON"); delay(1000); digitalWrite(LED_MODULE_PIN, LOW); // IN = LOW -> the module goes dark Serial.println("LED module: OFF"); delay(1000); }

Detailed Instructions

First time with Arduino UNO Q? Follow Getting Started with Arduino UNO Q before you continue.

  • Wire: Connect GND, VCC and IN of the module as shown in the wiring diagram.
  • Connect: Plug the Arduino UNO Q into your computer with the USB-C cable.
  • Open Arduino App Lab: Wait until it finds your board.
  • Create a new App: Click the Create New App button.
Create New App in Arduino App Lab on Arduino UNO Q
  • Name it, for example LedModuleBlink, and click Create.
Arduino App Lab App folders and files on Arduino UNO Q
  • Paste the sketch: Copy the code above into sketch/sketch.ino. Keep the other files as they are. No library is needed.
  • Run: Click the Run button.
Click Run button in Arduino App Lab on Arduino UNO Q
  • Look at the module: The 10mm LED flashes once every two seconds — one second lit, one second dark.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-10-23 14:20:05] Arduino UNO Q LED Module blink started [2026-10-23 14:20:05] LED module: ON [2026-10-23 14:20:06] LED module: OFF [2026-10-23 14:20:07] LED module: ON [2026-10-23 14:20:08] LED module: OFF [2026-10-23 14:20:09] LED module: ON

If the lines appear but the LED stays dark, check the VCC wire first: the IN pin only switches the LED, it does not power it.

Example 2 - Fade the LED Module

Now the LED breathes: the brightness climbs from 0 to 255 in steps of 15, then falls back to 0. One full cycle takes about two seconds. A line goes to the console at the top and at the bottom of each cycle.

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-led-module */ // Arduino UNO Q - LED Module: fade the module up and down with PWM // Wiring: LED module IN -> D9 (PWM pin), VCC -> 5V (or 3.3V), GND -> GND #define LED_MODULE_PIN 9 // must be a PWM-capable pin for analogWrite() #define FADE_STEP 15 // brightness change per step (0 to 255 in 17 steps) #define STEP_DELAY 60 // milliseconds between two steps void setup() { Serial.begin(115200); delay(1500); pinMode(LED_MODULE_PIN, OUTPUT); Serial.println("Arduino UNO Q LED Module fade started"); } void loop() { // dark -> full brightness for (int level = 0; level <= 255; level += FADE_STEP) { analogWrite(LED_MODULE_PIN, level); delay(STEP_DELAY); } Serial.println("Brightness: 255 (full)"); // full brightness -> dark for (int level = 255; level >= 0; level -= FADE_STEP) { analogWrite(LED_MODULE_PIN, level); delay(STEP_DELAY); } Serial.println("Brightness: 0 (off)"); }

Detailed Instructions

  • Keep the same wiring. IN is already on pin 9, a PWM pin.
  • Create a new App named LedModuleFade (or replace the sketch in the previous App), paste the code into sketch/sketch.ino, and click Run.
  • The LED slowly glows brighter, then dims again, over and over.
  • Try it: Make STEP_DELAY larger for a slower breath, or FADE_STEP smaller for a smoother one.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-10-23 14:31:40] Arduino UNO Q LED Module fade started [2026-10-23 14:31:41] Brightness: 255 (full) [2026-10-23 14:31:42] Brightness: 0 (off) [2026-10-23 14:31:43] Brightness: 255 (full) [2026-10-23 14:31:44] Brightness: 0 (off)

Bridge: Linux + MCU

The LED module is an output, so this time Linux gives the orders and the MCU carries them out:

  • The module is wired to the MCU — IN on pin 9. Only the MCU can write to that pin
  • The MCU offers four actions with Bridge.provide_safe(): led_on, led_off, set_brightness (0 to 255) and start_blink (interval in ms)
  • It also offers get_led with Bridge.provide(), which returns the state as text such as blink,255,500 (mode, brightness, interval)
  • The blinking itself runs on the MCU with millis(), not delay(), so the sketch can answer the next Bridge call right away
  • Python calls the actions with Bridge.call() and reads the state back after each one
  • ⚠️ /dev/ttyHS1 (Linux) and Serial1 (MCU) are RESERVED by the router — never open them in your code

In short: Python calls set_brightness → the MCU runs analogWrite() on pin 9 → the module changes brightness.

MCU Code (Bridge)

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-led-module */ // Arduino UNO Q - LED Module, controlled from Linux via Bridge // Wiring: LED module IN -> D9 (PWM pin), VCC -> 5V, GND -> GND // The MCU owns pin 9. Linux (Python) only calls the functions below. #include "Arduino_RouterBridge.h" #define LED_MODULE_PIN 9 int level = 0; // brightness 0..255 (0 = off) bool blinking = false; // true while the MCU blinks the module by itself int blink_interval = 500; // milliseconds between two toggles bool blink_lit = false; // is the LED lit right now in blink mode? unsigned long last_toggle = 0; void apply(int value) { analogWrite(LED_MODULE_PIN, value); } void led_on() { blinking = false; level = 255; apply(level); Monitor.println("LED module: ON"); } void led_off() { blinking = false; level = 0; apply(level); Monitor.println("LED module: OFF"); } // value: 0..255, a number outside this range is clipped void set_brightness(int value) { blinking = false; level = constrain(value, 0, 255); apply(level); Monitor.println("LED module brightness: " + String(level)); } // interval_ms: how long the LED stays on (and off) in each blink void start_blink(int interval_ms) { blink_interval = interval_ms >= 50 ? interval_ms : 500; if (level == 0) level = 255; // blink at full brightness if it was off blinking = true; blink_lit = true; apply(level); last_toggle = millis(); Monitor.println("LED module: BLINK every " + String(blink_interval) + " ms"); } // Returns the state as "mode,brightness,interval", for example "blink,255,500" String get_led(String arg) { String mode = blinking ? "blink" : (level > 0 ? "on" : "off"); return mode + "," + String(level) + "," + String(blink_interval); } void setup() { Bridge.begin(); Monitor.begin(); pinMode(LED_MODULE_PIN, OUTPUT); apply(0); // start dark // These functions change a hardware pin, so they use provide_safe Bridge.provide_safe("led_on", led_on); Bridge.provide_safe("led_off", led_off); Bridge.provide_safe("set_brightness", set_brightness); Bridge.provide_safe("start_blink", start_blink); Bridge.provide("get_led", get_led); Monitor.println("Arduino UNO Q LED Module Bridge ready"); } void loop() { // Blinking runs here without delay(), so Bridge calls are answered at once if (blinking && millis() - last_toggle >= (unsigned long)blink_interval) { last_toggle = millis(); blink_lit = !blink_lit; apply(blink_lit ? level : 0); } }

Python Code (Bridge)

The script runs a short show: full on, four steps down in brightness, a fast blink, then off. Note that the blink keeps the last brightness (16), so it is a dim blink — call led_on first if you want a bright one.

""" This Arduino UNO Q script was developed by newbiely.com This Arduino UNO Q script is made available for public use without any restriction For comprehensive instructions and wiring diagrams, please visit: https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-led-module """ from arduino.app_utils import * import time # Linux side: drive the LED module on the MCU through Bridge calls def show_state(note): state = Bridge.call("get_led") # for example "on,255,500" print(f"{note} -> {state}") def loop(): Bridge.call("led_on") show_state("led_on") time.sleep(2) for value in (192, 128, 64, 16): # step the brightness down Bridge.call("set_brightness", value) show_state(f"set_brightness {value}") time.sleep(1.5) Bridge.call("start_blink", 250) # fast blink, the MCU keeps the timing show_state("start_blink 250") time.sleep(4) Bridge.call("led_off") show_state("led_off") time.sleep(3) App.run(user_loop=loop)

Detailed Instructions

  • Create a new App: In Arduino App Lab click Create New App, name it LedModuleBridge, and click Create.
  • Paste the MCU sketch into sketch/sketch.ino and add the library:
  • Install the library: Click the Add sketch library button (the open book icon with a + sign) in the left sidebar.
Add sketch library in Arduino App Lab on Arduino UNO Q
  • Search for Arduino_RouterBridge created by Arduino and click the Install button.
My Apps / DIYables Apps
Run
Bricks
No bricks added...
Sketch Libraries
No sketch libra...
Files
python
sketch
.gitignore
README.md
app.yaml
sketch.ino
Add sketch library
Arduino_RouterBridge Arduino

This library provides a simple RPC bridge for Arduino UNO Q boards, allowing communication between the board and other devices using MsgPack serialization.

0.4.1
Install
More Info
  • Paste the Python code into the Python file of the same App.
  • Run: Click the Run button. The show starts and repeats.
  • Check both consoles: The MCU Monitor prints every change it makes to pin 9; the Python console prints each call and the state it read back.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-10-23 15:02:10] Arduino UNO Q LED Module Bridge ready [2026-10-23 15:02:12] LED module: ON [2026-10-23 15:02:14] LED module brightness: 192 [2026-10-23 15:02:15] LED module brightness: 128 [2026-10-23 15:02:17] LED module brightness: 64 [2026-10-23 15:02:18] LED module brightness: 16 [2026-10-23 15:02:20] LED module: BLINK every 250 ms [2026-10-23 15:02:24] LED module: OFF
DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-10-23 15:02:12] led_on -> on,255,500 [2026-10-23 15:02:14] set_brightness 192 -> on,192,500 [2026-10-23 15:02:15] set_brightness 128 -> on,128,500 [2026-10-23 15:02:17] set_brightness 64 -> on,64,500 [2026-10-23 15:02:18] set_brightness 16 -> on,16,500 [2026-10-23 15:02:20] start_blink 250 -> blink,16,250 [2026-10-23 15:02:24] led_off -> off,0,250

Telegram

A colored light on your desk or shelf makes a nice remote signal: switch it on to tell your family you are on the way home, set it to blink when the coffee is ready, or dim it for the night. The bot below accepts five commands and always answers with the real state it reads back from the MCU, so you know the command arrived.

Command What it does
/on LED on at full brightness
/off LED off
/blink or /blink N blink every 500 ms, or every N ms (50 to 5000)
/brightness N set the brightness to N percent (0 to 100)
/status report the current state

The bot works in percent because that is easier to type on a phone. Python turns the percent into the 0 to 255 range before it calls set_brightness.

MCU sketch: Keep the same MCU sketch from the Bridge section.

Python Code (Telegram)

""" This Arduino UNO Q script was developed by newbiely.com This Arduino UNO Q script is made available for public use without any restriction For comprehensive instructions and wiring diagrams, please visit: https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-led-module """ from arduino.app_utils import * import requests import time TELEGRAM_BOT_TOKEN = "YOUR_TELEGRAM_BOT_TOKEN" API_URL = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}" last_update_id = 0 HELP_TEXT = ( "Arduino UNO Q LED Module Bot\n" "/on - LED on (full brightness)\n" "/off - LED off\n" "/blink - blink every 500 ms\n" "/blink N - blink every N ms (50 to 5000)\n" "/brightness N - set brightness, N = 0 to 100 (%)\n" "/status - show the LED state" ) def get_updates(): try: resp = requests.get(f"{API_URL}/getUpdates", params={"offset": last_update_id + 1, "timeout": 5}, timeout=10) data = resp.json() if data.get("ok"): return data["result"] except Exception as e: print(f"Error getting updates: {e}") return [] def send_message(chat_id, text): try: requests.post(f"{API_URL}/sendMessage", data={"chat_id": chat_id, "text": text}, timeout=10) except Exception as e: print(f"Error sending message: {e}") def status_text(): parts = str(Bridge.call("get_led")).split(",") # for example ["blink", "255", "500"] if len(parts) != 3: return "LED state is not ready yet." mode, level, interval = parts[0], int(parts[1]), parts[2] percent = round(level * 100 / 255) if mode == "off": return "LED is OFF" if mode == "blink": return f"LED is BLINKING every {interval} ms at {percent}% brightness" return f"LED is ON at {percent}% brightness" def handle(text): words = text.split() command = words[0] if words else "" if command == "/on": Bridge.call("led_on") elif command == "/off": Bridge.call("led_off") elif command == "/blink": interval = 500 if len(words) > 1: if not words[1].isdigit() or not 50 <= int(words[1]) <= 5000: return "Usage: /blink N (N = 50 to 5000 ms)" interval = int(words[1]) Bridge.call("start_blink", interval) elif command == "/brightness": if len(words) < 2 or not words[1].isdigit() or int(words[1]) > 100: return "Usage: /brightness N (N = 0 to 100)" Bridge.call("set_brightness", round(int(words[1]) * 255 / 100)) # % -> 0..255 elif command != "/status": return HELP_TEXT return status_text() # every command replies with the new state def loop(): global last_update_id for update in get_updates(): last_update_id = update["update_id"] if "message" not in update: continue chat_id = update["message"]["chat"]["id"] text = update["message"].get("text", "").strip().lower() print(f"Received: {text}") send_message(chat_id, handle(text)) time.sleep(1) App.run(user_loop=loop)

Detailed Instructions

  • Get a bot token: Create a bot with @BotFather. See How to Create a Telegram Bot if you need help. Put the token in TELEGRAM_BOT_TOKEN.
  • Paste the code into the Python file of your Bridge App. The MCU sketch stays the same.
  • Run: Click the Run button.
  • Test it: Open your bot in Telegram, send /brightness 30, then /blink 200. Any unknown text returns the list of commands.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-10-23 19:05:31] Received: /on [2026-10-23 19:05:48] Received: /brightness 30 [2026-10-23 19:06:10] Received: /blink 200 [2026-10-23 19:06:42] Received: /status [2026-10-23 19:07:05] Received: /off
Telegram
Telegram 12:45
Welcome to Telegram!
ArduinoBot 10:19
Chatting with Arduino...
telegram-botfather
BotFather Yesterday
Your bot has been created.

ArduinoBot

bot
Today
/on
10:15 AM ✓✓
LED is ON at 100% brightness
10:16 AM
/brightness 30
10:17 AM ✓✓
LED is ON at 30% brightness
10:18 AM
/blink 200
10:19 AM ✓✓
LED is BLINKING every 200 ms at 30% brightness
10:20 AM
/status
10:21 AM ✓✓
LED is BLINKING every 200 ms at 30% brightness
10:22 AM
/off
10:23 AM ✓✓
LED is OFF
10:24 AM

OpenClaw

You can adapt the OpenClaw to this tutorial by refering the instruction on Arduino Uno Q - OpenClaw Tutorial

Project Ideas

A plug-in light with a Linux computer behind it is more useful than it looks:

  • Build Status Lamp: A green module and a red module on two PWM pins. Python checks your CI or a website every minute and lights the right one.
  • "Do Not Disturb" Door Light: Put a red module outside your room and switch it from Telegram when you join a call.
  • Server Heartbeat: The Linux side blinks a blue module slowly while a service is healthy, and fast when it stops answering.
  • Sunrise Wake-Up Glow: Python raises a yellow module from 0% to 100% over 20 minutes before your alarm time.
  • Plant Water Reminder: A soil moisture sensor on the MCU makes a white module blink when the pot is dry.

Challenge Yourself

Ready to do more with the LED module and the Arduino UNO Q?

  • Easy: Change the blink sketch to a "heartbeat": two short flashes, then a long pause.
  • Medium: Add a /fade command to the Telegram bot. Add a start_fade function to the MCU sketch that uses millis() to breathe the LED, like the blink does.
  • Advanced: Wire all five colors to pins 3, 5, 6, 10 and 11, and let one Telegram command such as /color green 60 pick the module and set its brightness.

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!