Skip to the content
4 layers100 × 78 mmMechatronics LED, the printed circuit board in 3D

This repository contains the firmware and host-side interface for controlling a WS2812 LED strip via an STM32 microcontroller over UART.

Size
100 × 78 mm
Copper layers
4
Thickness
1.6 mm
Parts
28
Nets
67
Pads
143
Tracks, vias
147, 24
Pours
2
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
28 May 2025
Updated
21 Jun 2025

Overview

Mechatronics LED is an open-source printed circuit board by tigy1, from the tigy1/Mechatronics-Orin-LED repository on GitHub. It is a 4-layer board of 100 × 78 mm with 28 parts on 67 nets, routed with 147 tracks and 24 vias.

It is built around the SN74LV1T34DBV. Its parts include 12 capacitors, 3 resistors, 3 ICs, 3 connectors and 2 diodes. It belongs with the STM32 boards of this library.

Main components

1

README

README.md

Orin Robosub LED Mode Indicator

This repository contains the firmware and host-side interface for controlling a WS2812 LED strip via an STM32 microcontroller over UART. The LEDs are used to indicate the current operational mode of the Orin Robosub, a student-built autonomous underwater vehicle.

Modes are communicated via UART from a Python script running on the host system and translated into LED color patterns by the STM32 firmware.


Purpose

LEDs provide immediate visual feedback on Orin’s state. This is crucial during pool testing, debugging, or when operating the sub remotely. Modes are mapped to colors, enabling surface crew to distinguish between autonomous navigation, manual override, kill switch activation, and other states.


Architecture Overview

Hardware Components

  • Microcontroller: STM32 (e.g., STM32F103 or similar)
  • LED Strip: WS2812B addressable RGB strip
  • Communication: UART @ 115200 baud between host and STM32
  • Power Supply: Regulated 5V for LED strip

Firmware Features (main.c)

  • Configures TIM2 PWM with DMA for LED signal generation
  • Parses RGB input strings over UART
  • Allows real-time LED updates from Python terminal input
  • Implements chasing animation based on current mode color
  • Brightness control via tan() mapping for perceived brightness tuning

Python Host Interface (led_script.py)

  • Validates and sends RGB values to STM32 over UART
  • Command-line interface prompts for interactive control
  • Cross-platform support with adjustable serial port

Getting Started

Clone the Repository

bash
git clone https://github.com/tigy1/Mechatronics-Orin-LED.git
cd Mechatronics-Orin-LED

Build and Flash Firmware

  • Use STM32CubeIDE or compatible toolchain
  • Connect your board via ST-Link or UART bootloader
  • Ensure NUMBER_OF_LEDS is configured correctly in main.c
  • Flash main.c and its dependencies (led.c, led.h) to your board

Install Python Dependencies

No external libraries beyond pyserial are required:

bash
pip install pyserial

Using the Control Script

Run the Python control interface:

bash
python3 led_script.py

You will be prompted to enter RGB values in the format:

text
### ### ### where each chain of hashtags represents a number 001 - 255 (0s are important) as a decimal representation of RGB values.

To disable LED output via DMA, send: `001 000 000`

The script will validate input and send it via UART to the STM32 board.

Adjust port and baudrate if needed inside led_script.py.


Code Highlights

UART Packet Format

The STM32 expects newline-terminated ASCII RGB strings over UART:

text
"255 000 000\n"

Parsed using sscanf in HAL_UART_RxCpltCallback().

LED Color and Brightness Encoding

Color bits are stored as bitwise-shifted PWM values in structs:

c
typedef struct {
  uint16_t r[8], g[8], b[8];
} led;

Brightness mapping uses tan(angle) to provide nonlinear control.

DMA Timing

Each LED gets 24 bits; additional 2 LEDs are padded to ensure reset timing:

c
NUMBER_OF_LEDS * 24 + 2 * 24

Parts

28
QtyValueFootprintReferences
6100nFCapacitor_SMD:C_0603_1608MetricC5, C6, C7, C8, C9, C12
230pFCapacitor_SMD:C_0805_2012MetricC3, C4
2510RResistor_SMD:R_0805_2012MetricR1, R3
110KResistor_SMD:R_0805_2012MetricR2
110μFCapacitor_SMD:C_0805_2012MetricC2
116MHzCrystal:Crystal_HC49-4H_VerticalY1
11μFCapacitor_SMD:C_0805_2012MetricC1
12.5pFCapacitor_SMD:C_0805_2012MetricC11
12pFCapacitor_SMD:C_0805_2012MetricC10
1Conn_01x03Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ2
1Conn_01x04Connector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_VerticalJ3
1L78L33_SOT89Package_TO_SOT_SMD:SOT-89-3U1
1LEDLED_SMD:LED_0805_2012MetricD1
1PWR LEDLED_SMD:LED_0805_2012MetricD2
1SN74LV1T34DBVPackage_TO_SOT_SMD:SOT-23-5U3
1STM32F103C6TxPackage_QFP:LQFP-48_7x7mm_P0.5mmU2
1~Connector_PinHeader_2.54mm:PinHeader_2x20_P2.54mm_VerticalJ1

The 24 most common of 28 parts.

Similar boards

  • 2 layers96.1 × 45.2 mmPicoFightingBoard, the printed circuit board in 3D

    PicoFightingBoard

    FeralAI/PicoFightingBoard

    Open source PCB for arcade sticks using Raspberry Pi Pico.

    25 parts283
  • 2 layers51.4 × 61 mmWifi gb cart, the printed circuit board in 3D

    Wifi gb cart

    Staacks/wifi-game-boy-cartridge

    A WiFi cartridge for the original Game Boy.

    38 parts242
  • 4 layers56.5 × 65 mmTv070hat, the printed circuit board in 3D

    Tv070hat

    ScandentLLC/tv070wxm-hat

    Raspberry Pi 5 HAT for Steam Deck LCD

    54 parts108CC0-1.0
  • 4 layers106 × 63.5 mmBrineomatic, the printed circuit board in 3D

    Brineomatic

    hoeken/brineomatic

    Open Source Watermaker Controller.

    323 parts47LGPL-2.1
  • 4 layers81.2 × 81.2 mmView base, the printed circuit board in 3D

    View base

    SeedLabs-it/smartknob-hardware

    PCB and CAD files for smartknob devkit

    259 parts47
  • 2 layers100.8 × 40 mmKM217-WiFi, the printed circuit board in 3D

    KM217-WiFi

    the78mole/km271-wifi

    A piece of hardware to be installed in a Buderus Logamatic 2107 to provide control and status over WiFi

    120 parts44
  • 4 layers277.2 × 107.5 mmKatia, the printed circuit board in 3D

    Katia

    ikajdan/katia

    A split keyboard with 6 by 3 column staggered keys and 3 thumb keys, based on the Crkbrd design

    230 parts33CERN-OHL-P-2.0
  • 4 layers132 × 84.5 mmHamodule, the printed circuit board in 3D

    Hamodule

    crgarcia12/electronics-homeassistant-lightscontroll

    A smart lighting controller PCB that integrates seamlessly with ESPHome and Home Assistant while maintaining full compatibility with traditional mechanical switches.

    207 parts28

Questions

How big is the Mechatronics LED PCB?

It measures 100 × 78 mm and has 4 copper layers, 1.6 mm thick.

What parts does the Mechatronics LED use?

28 parts, built around the SN74LV1T34DBV. 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.

Where can I download the Mechatronics LED KiCad files?

From the tigy1/Mechatronics-Orin-LED repository on GitHub, at the commit this page was made from: the board is Mechatronics LED.kicad_pcb and its schematic Mechatronics LED.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Mechatronics LED design in my own project?

Its repository states no licence, so its author keeps all rights: ask tigy1 before reusing the design.