
Switch
byrantech/laptop
anyon_e, a highly integrated, high end, open source laptop. Attempt the impossible.

An automated RGB night light system powered by STM32, featuring an OLED display, dynamic lighting effects, and a configurable sleep timer.
PCB RGB is an open-source printed circuit board by MinhDangEE, from the MinhDangEE/Multi-mode-RGB-Mood-Lamp repository on GitHub. It is a 2-layer board of 80 × 70 mm with 6 parts on 44 nets, routed with 48 tracks and 0 vias.
Its parts include 3 connectors, 1 IC and 1 switch. It belongs with the lEDs and displays and interfaces and adapters boards of this library.
This project implements an embedded ambient lighting system using the STM32F103C8T6 (ARM Cortex-M3) microcontroller. It combines 3-channel 16-bit Timer PWM color blending, real-time potentiometer brightness regulation via ADC, rotary encoder countdown scheduling with instant cancellation, an SSD1306 OLED interface, and a browser-based Web Serial control dashboard communicating over UART at 115200 baud.
The firmware leverages hardware peripherals of the STM32F103C8T6 MCU to drive a common-cathode RGB LED and manage interactive controls:
TIM3 generates 1 kHz PWM across channels 1, 2, and 3 (PA6, PA7, PB0) for independent color mixing. Analog input from a 10k potentiometer on PA1 is converted through ADC1 to scale total luminous output from 0% to 100%. User control is handled via an external mode toggle button on PB12 and a KY-040 rotary encoder module on PB14 and PB15, which adjusts the auto-off timer in 10-second increments with step debouncing. The timer push button (PB13) cancels active countdowns. Status information is rendered on a 128x64 SSD1306 OLED module over software I2C.
The complete hardware prototype is constructed using the following components and breakout modules:
| Component / Module | Specification / Model | Quantity | Role in System |
|---|---|---|---|
| Microcontroller Board | STM32F103C8T6 Blue Pill (ARM Cortex-M3, 72 MHz, 64KB Flash) | 1 | Master embedded processing unit |
| RGB LED Module | Common-Cathode RGB LED Breakout Module | 1 | 3-channel PWM mood light emitter |
| Rotary Encoder Module | KY-040 Quadrature Rotary Encoder Breakout Module | 1 | Auto-off timer adjustment and instant cancel push switch |
| OLED Display Module | 0.96 inch SSD1306 I2C OLED Module (128x64 pixels, Blue/White) | 1 | Real-time status, mode, and countdown visualization |
| Potentiometer | 10k Linear Rotary Potentiometer (B10K) | 1 | Analog 0% to 100% master brightness regulator |
| Mode Push Button | 6x6mm Tactile Momentary Push Button | 1 | External hardware mode toggle trigger |
| USB-to-UART Adapter | CP2102 USB to Serial TTL Adapter | 1 | Bidirectional PC/Web Serial interface (115200 baud) |
| Debugger / Programmer | ST-Link V2 USB Dongle | 1 | SWD firmware flashing and hardware debugging |
| Prototyping Accessories | Solderless Breadboard and Jumper Wires | 1 set | Circuit interconnects and power distribution |
The execution flow, mode transition logic, potentiometer ADC brightness mapping, and countdown timer routine are illustrated in the architecture flowchart below:
| Device / Module | Module Pin | STM32 Pin | Peripheral Function | Electrical Role |
|---|---|---|---|---|
| RGB LED Module | Red Channel (R) | PA6 | TIM3_CH1 | 1 kHz PWM Output |
| Green Channel (G) | PA7 | TIM3_CH2 | 1 kHz PWM Output | |
| Blue Channel (B) | PB0 | TIM3_CH3 | 1 kHz PWM Output | |
| Common Ground (-) | GND | Ground | Common Cathode Reference | |
| 10k Potentiometer | Wiper Pin | PA1 | ADC1_IN1 | Analog Voltage Input (0V to 3.3V) |
| Outer Rails | 3.3V / GND | Power Rails | Voltage Divider Reference | |
| KY-040 Encoder Module | CLK (Phase A) | PB15 | EXTI15 | Dual-Edge Step Interrupt |
| DT (Phase B) | PB14 | EXTI14 | Direction Logic Input | |
| SW (Push Switch) | PB13 | EXTI13 | Falling-Edge Timer Cancel | |
| Power (+ / GND) | 3.3V / GND | Power Rails | Module 3.3V Supply | |
| Mode Button | Tactile Switch | PB12 | EXTI12 | Falling-Edge Mode Toggle |
| SSD1306 OLED Module | SCL | PB6 | GPIO Output PP | Software I2C Clock |
| SDA | PB7 | GPIO Output PP | Software I2C Data | |
| Power (VCC / GND) | 3.3V / GND | Power Rails | Module Display Power | |
| USB-UART Bridge | TXD / RXD | PA10 / PA9 | USART1 (RX/TX) | 115200 8N1 Serial Protocol |
| ST-Link V2 | SWDIO / SWCLK | PA13 / PA14 | SWD Debug | Firmware Flash & Debug |
The lamp implements five discrete operational states:
Duty = MaxBright * Progress^2.2) to match human eye lightness perception.Turning the KY-040 encoder clockwise increases timer duration by 10 seconds per detent click, while counter-clockwise rotation decreases duration by 10 seconds. Pressing the encoder shaft switch (PB13) clears the timer and disables countdown tracking.
A background timer tick decrements remaining time once per second. When the counter reaches zero, the firmware automatically switches to Sleep Mode (Mode 0) and blanks the LED output. Remaining time is continuously updated on the OLED display and echoed over UART.
The browser interface connects directly to the STM32 USART1 port via the Web Serial API at 115200 baud. It includes a native color picker, individual R/G/B sliders, mode preset buttons, and a line-stream buffered serial log.
| Command Packet | Target Action | Example / Details |
|---|---|---|
1\n or w\n | Switch to Solid White | Constant white illumination |
2\n or b\n | Switch to Breathing White | Gamma 2.2 breathing cycle |
3\n or r\n | Switch to Rainbow Spectrum | 6-phase chromatic crossfade |
4\n or c\n | Switch to Custom RGB | Uses current custom RGB registers |
0\n or s\n | Switch to Sleep Mode | Turns off PWM channels |
n\n or Space | Next Mode | Cycles sequentially through states |
C:R,G,B\n | Set Custom RGB Coordinates | Example: C:255,120,40\n |
#RRGGBB\n | Set Custom Hex Color | Example: #FF7828\n |
To operate the web controller, open web/index.html in Chrome or Edge, click Connect STM32, choose the active COM port, and select colors or modes in real time.
Functional testing footage, hardware validation, potentiometer brightness control, encoder timer countdown, and web serial communication can be reviewed here:
While the current system operates reliably, several hardware and software limitations offer clear opportunities for future development:
| Qty | Value | Footprint | References |
|---|---|---|---|
| 2 | Conn_01x04_Socket | Connector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_Vertical | J1, J4 |
| 1 | 10K | Potentiometer_THT:Potentiometer_Vishay_148-149_Single_Horizontal | RV1 |
| 1 | Conn_01x05_Socket | Connector_PinSocket_2.54mm:PinSocket_1x05_P2.54mm_Vertical | J2 |
| 1 | MODE | Button_Switch_THT:SW_PUSH_6mm_H5mm | SW2 |
| 1 | YAAJ_BluePill_Part_Like_SWD_Breakout | YAAJ_STM32:YAAJ_BluePill_SWD_1 | U3 |

byrantech/laptop
anyon_e, a highly integrated, high end, open source laptop. Attempt the impossible.


Jcparkyn/dpoint
Open-source digital stylus using camera tracking and inertial measurements

VoronDesign/Voron-Hardware
Cool Hardware designed by the Voron Design group

hoglet67/RGBtoHDMI
Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

hackclub/OnBoard
💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

Luos-io/luos_engine
Open-source and real-time orchestrator for cyber-physical-systems, to easily design, test and deploy embedded applications and digital twins.

It measures 80 × 70 mm and has 2 copper layers, 1.6 mm thick.
6 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the MinhDangEE/Multi-mode-RGB-Mood-Lamp repository on GitHub, at the commit this page was made from: the board is docs/Simulation/PCB_RGB.kicad_pcb and its schematic docs/Simulation/PCB_RGB.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository states no licence, so its author keeps all rights: ask MinhDangEE before reusing the design.