Skip to the content
2 layers64.8 × 50.4 mmLedCubePCB, the printed circuit board in 3D

A 4×4×4 LED cube that tries to look impressive with its patterns… until you remember it’s just 64 tiny lights doing their best.

Size
64.8 × 50.4 mm
Copper layers
2
Thickness
1.6 mm
Parts
36
Nets
72
Pads
150
Tracks, vias
228, 6
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
3 May 2026
Updated
5 Jun 2026

Overview

LedCubePCB is an open-source printed circuit board by sarpharaj-09, from the sarpharaj-09/LEDCube repository on GitHub. It is a 2-layer board of 64.8 × 50.4 mm with 36 parts on 72 nets, routed with 228 tracks and 6 vias.

It is built around the 74HC595 and BC547. Its parts include 22 resistors, 4 transistors, 3 capacitors, 3 connectors and 2 ICs. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

2

README

README.md

LED Cube: Multi-Dimensional Light Display System

LED Cube Animation Demo

An intelligent 3D addressable LED cube system with real-time pattern control and dynamic animations

PlatformIO Arduino C++ KiCAD License Status


📖 Table of Contents


🎯 Overview

The LED Cube is a sophisticated 3D light display system featuring dynamically addressable LEDs arranged in a cubic lattice. This system combines embedded microcontroller programming with custom PCB design to create an immersive visual experience with real-time pattern generation and animation control.

Built around the Arduino Nano platform with a professionally designed PCB in KiCAD, this project demonstrates the practical application of LED control techniques, spatial algorithms, and embedded systems design for creative visual displays.

🚀 Development Status: This project is currently in active development. New features and optimizations are being added regularly. Contributions and feedback are welcome!

Arduino C++ PlatformIO KiCAD


✨ Features

FeatureDescription
🎯 3D LED MatrixFully addressable multi-dimensional LED array
🎨 Real-time AnimationDynamic pattern generation and smooth transitions
🔧 Modular ArchitectureClean code separation for easy expansion and maintenance
⚡ Efficient Power ManagementOptimized LED control and power distribution
🎮 Pattern LibraryDiverse built-in animation patterns and effects
💡 Customizable BrightnessPWM-based brightness control
🔄 Smooth AnimationsAnti-aliasing and interpolation for fluid motion
📊 Debugging SupportSerial monitoring and real-time data visualization

🔬 Technical Specifications

Hardware Components

ComponentQuantitySpecificationPurpose
Microcontroller1×Arduino Nano ATmega328PMain processor
Shift Register1×74HC595Column selection driver
NPN Transistors4×2N2222 or similarLayer multiplexing
LEDs64×5mm or SMDVisual display elements
Current Limiting Resistors64×470ΩLED current protection
Layer Transistor Base Resistors4×1kΩTransistor base limiting
Push Button1×Standard momentaryAnimation control input
Decoupling Capacitors1×100µFPower supply filtering
Power Supply1×5V, 1A+System power
PCB1×Custom KiCAD designComponent integration
Structural Frame-3D printed or acrylicCube structure

Performance Specifications

ParameterSpecification
Cube Size4 layers × 4 rows × 4 columns (64 LEDs total)
LED TypeBinary on/off (single channel per LED)
Color Depth1-bit per LED (on/off only)
Refresh Rate60+ FPS (multiplexed display)
Control InterfaceShift register (74HC595) + Layer transistors
Input ControlPhysical button with debouncing
Power ConsumptionVaries by animation (typically < 500mA)
MicrocontrollerArduino Nano ATmega328P

🏗️ System Architecture

Core Data Flow

text
┌──────────────────┐    ┌─────────────────────┐    ┌──────────────────┐
│  PATTERN ENGINE  │    │  LED CONTROLLER     │    │  PHYSICAL LEDS   │
│                  │    │                     │    │                  │
│ • Animation Gen  │────▶• Pixel Mapping     │────▶• RGB Addressable │
│ • Color Calc     │    │ • SPI/Data Driver  │    │   Output         │
│ • Timing Logic   │    │ • Brightness PWM   │    │                  │
└──────────────────┘    └─────────────────────┘    └──────────────────┘

Component Architecture

1. LEDCube Class - Frame Buffer & Display Driver
cpp
// Manages frame buffer and multiplexed LED display output
class LEDCube {
    // Frame buffer operations
    setLED(layer, col, on);              // Set individual LED
    setLayer(layer, mask);               // Set entire layer
    clearFrame();                        // Clear all LEDs
    fillAll();                           // Turn on all LEDs
    
    // Display operations
    refresh();                           // Perform one refresh cycle
    Button::Event refreshFor(ms);        // Refresh with button polling
    
    // Button access
    Button& button();                    // Get button object
}
2. Animator Class - Animation Engine (OOP-Based)
cpp
// Contains 12 distinct animation methods
class Animator {
    // Each returns Button::Event to signal button press
    Button::Event allOn();               // Fill entire cube
    Button::Event layerSweep();          // Sweep through layers
    Button::Event rain();                // Falling particles
    Button::Event bounceBall();          // Bouncing sphere
    Button::Event spiral();              // Spiral pattern
    Button::Event checkerboard();        // Alternating pattern
    Button::Event sparkle();             // Random twinkling
    Button::Event wipe();                // Progressive wipe
    Button::Event propeller();           // Rotating blades
    Button::Event snake();               // Snake movement
    Button::Event firework();            // Explosion effect
    Button::Event allOff();              // Turn off all
}
3. AnimationManager Class - Animation Controller
cpp
// Manages animation dispatch and button-triggered switching
class AnimationManager {
    void run();                          // Main loop - runs animations
    void flashIndex();                   // Visual feedback for mode
    
    // Internally:
    // • Tracks current animation index
    // • Dispatches to Animator methods
    // • SHORT PRESS → next animation
    // • LONG PRESS  → previous animation
}
4. Button Class - Input Control
cpp
// Handles debounced button input detection
class Button {
    enum Event { NONE, SHORT_PRESS, LONG_PRESS };
    Button::Event check();               // Poll button state
}

⚡ Installation & Setup

Prerequisites

RequirementDescription
PlatformIO IDEVS Code with PlatformIO extension recommended
Arduino NanoMicrocontroller board
KiCADFor PCB design modifications (optional)
Electronic ComponentsLEDs, resistors, capacitors as per BOM
Fabrication ToolsSoldering equipment, wire strippers, etc.

Step-by-Step Setup

1. Environment Setup
bash
# Clone repository
git clone https://github.com/yourusername/LED-Cube.git
cd LED-Cube

# Open in VS Code with PlatformIO
code .
2. Dependency Installation
bash
# Install via PlatformIO
pio pkg install

# Required libraries will be automatically installed
3. Configuration

Edit code/include/Config.h to customize hardware settings:

cpp
namespace Config {
    // 74HC595 Shift Register pins
    constexpr uint8_t DS    = 2;      // Data input
    constexpr uint8_t RCLK  = 3;      // Latch clock
    constexpr uint8_t SRCLK = 4;      // Shift clock
    
    // Layer selection pins (NPN transistors)
    constexpr uint8_t LAYER_PINS[4] = {5, 6, 7, 8};
    
    // Button input pin
    constexpr uint8_t BUTTON_PIN = 10;
    
    // Cube dimensions
    constexpr uint8_t NUM_LAYERS  = 4;
    constexpr uint8_t NUM_COLUMNS = 16;
    
    // Timing parameters
    constexpr uint16_t LAYER_ON_US = 500;     // Microseconds per layer
    constexpr uint16_t DEBOUNCE_MS = 50;      // Button debounce
    constexpr uint16_t LONG_PRESS_MS = 600;   // Long press threshold
}
4. Compilation & Upload
bash
# Build project
pio run

# Upload to Arduino Nano
pio run -t upload

# Monitor serial output
pio device monitor
5. Hardware Assembly

Follow the PCB layout in ledCubePCB/ for proper component placement and solder connections. Use the circuit diagram for electrical connections.


🎮 Usage & Operation

Quick Start - Button Control

The cube automatically starts at animation 0 (All ON). Use the physical button to navigate:

  1. Power On - Cube initializes with all LEDs on
  2. Short Press Button - Advances to next animation, shows index via flash
  3. Long Press Button - Goes to previous animation
  4. Continuous Loop - Animations cycle infinitely until button interaction

Main Loop

cpp
// main.cpp — Main program loop
LEDCube          cube;           // Display driver & button handler
Animator         anim(cube);     // Animation engine
AnimationManager mgr(cube, anim); // Animation dispatcher

void setup() {
    randomSeed(analogRead(A0));
    cube.begin();
}

void loop() {
    mgr.run();   // Runs current animation, switches on button press
}

Animation Modes (12 Total)

IndexAnimationDescription
0All ONEntire cube illuminated
1Layer SweepProgressive sweep through all layers
2RainParticles falling through the cube
3Bounce BallBouncing sphere within the cube
4SpiralSpiraling pattern through 3D space
5CheckerboardAlternating on/off pattern
6SparkleRandom twinkling LEDs
7WipeProgressive reveal/clear pattern
8PropellerRotating blade-like effects
9SnakeSnake-like movement pattern
10FireworkExplosion-like burst effect
11All OFFAll LEDs turned off

Button Control

Control animations via physical button (Pin 10):

text
SHORT PRESS (< 600ms)  → Advance to next animation
LONG PRESS  (≥ 600ms)  → Return to previous animation

Debounce: 50ms to prevent false triggers Visual Feedback: Brief flash shows current animation index on entry

Calibration & Testing

  • Use test/pattern.cpp for pattern validation
  • Monitor brightness levels for optimal visibility
  • Verify all LEDs illuminate correctly
  • Test power consumption under maximum brightness

🎨 Animation Patterns

Animation Implementation (OOP)

Each animation in the Animator class:

  1. Maintains State - Tracks position, frame, or other animation data
  2. Loops Until Button Press - Runs continuously, checking for button events
  3. Returns Button::Event - Signals to AnimationManager for switching
  4. Uses Helper Functions - _tick(ms) refreshes display and polls button

Example Pattern: layerSweep()

cpp
Button::Event Animator::layerSweep() {
    // Animate through each layer
    for (uint8_t layer = 0; layer < NUM_LAYERS; layer++) {
        // Set frame for this layer
        _cube.setLayer(layer, 0xFFFF);  // All columns ON
        
        // Refresh and check for button press
        Button::Event evt = _tick(100);  // Refresh for 100ms
        if (evt != Button::NONE) {
            return evt;  // Button pressed - exit and switch
        }
    }
    return Button::NONE;  // Loop again
}

Adding New Animations:

cpp
// 1. Add method declaration in Animator.h
Button::Event myNewAnimation();

// 2. Implement in Animator.cpp
Button::Event Animator::myNewAnimation() {
    // Your animation code
    return _tick(delayMs);  // Refresh and return button event
}

// 3. Register in AnimationManager.cpp dispatch table
// Update _total count and add to dispatcher

🎨 Project Gallery

Hardware & PCB Design

PCB Front View
PCB Front View
Front side of the custom-designed PCB with Arduino Nano, shift register, and transistor drivers

PCB Back View
PCB Back View
Back side of the PCB showing copper traces and signal routing

3D Enclosure Design
LED Cube 3D Case Design
3D-printed or acrylic case structure for holding the 4×4×4 LED array

Demo Videos

Animation Showcase
Play Demo Video
Real-time demonstration of all 12 animation patterns in action

Video Highlights:

  • ✨ All 12 animation effects including sparkle, rain, bounce ball, spiral, and fireworks
  • 🎮 Button control demonstration (short press: next, long press: previous)
  • ⚡ Smooth 60+ FPS refresh rate and responsive animation switching
  • 🎨 Color and brightness effects at full operational speed

📁 Project Structure

text
LED-Cube/
│
├── code/                          # Firmware Source Code
│   ├── src/
│   │   ├── main.cpp               # Entry point & main loop
│   │   ├── LEDCube.cpp            # Frame buffer & display driver
│   │   ├── AnimationManager.cpp   # Animation dispatcher & controller
│   │   ├── Animator.cpp           # 12 animation implementations
│   │   ├── Button.cpp             # Button input handling
│   │   ├── LayerController.cpp    # Layer multiplexing control
│   │   └── ShiftRegister.cpp      # 74HC595 shift register driver
│   │
│   ├── include/
│   │   ├── Config.h               # Hardware pinout & settings
│   │   ├── LEDCube.h              # Frame buffer interface
│   │   ├── AnimationManager.h     # Animation manager interface
│   │   ├── Animator.h             # Animation methods interface
│   │   ├── Button.h               # Button control interface
│   │   ├── LayerController.h      # Layer control interface
│   │   └── ShiftRegister.h        # Shift register interface
│   │
│   ├── test/
│   │   └── nano_test.cpp          # Unit tests for Arduino Nano
│   │

Core Classes Overview

  • LEDCube - Manages frame buffer (4 layers × 16 columns) and physical display refresh
  • Animator - Contains 12 different animation methods
  • AnimationManager - Dispatches animations and handles button-triggered switching
  • Button - Debounced button input with short/long press detection
  • ShiftRegister - Controls 74HC595 for column selection
  • LayerController - Manages layer multiplexing via NPN transistors

📚 Documentation

Technical Resources

DocumentLocationPurpose
SchematicledCubePCB/ledCubePCB.kicad_schElectrical design
PCB LayoutledCubePCB/ledCubePCB.kicad_pcbBoard layout

Getting Started

  1. Check the project structure above
  2. Review the KiCAD files in ledCubePCB/ for PCB details
  3. Follow the installation steps in Installation & Setup
  4. Upload firmware to your Arduino Nano
  5. Test with basic patterns

License

This project is licensed under the MIT License - see the LICENSE file for details.

text
MIT License

Copyright (c) 2024 LED Cube Project

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

👨‍💻 Author

Sarpharaj Dewan
💼 Embedded Systems & Robotics Enthusiast

Facebook Instagram YouTube


⭐ Support the Project

If you found this project useful or inspiring, please consider giving it a star!

GitHub Stars


"Creativity illuminated in three dimensions."

Made with ❤️ by Sarpharaj Dewan

Parts

36
QtyValueFootprintReferences
20100RResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR1, R2, R4, R5, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21 +4
4BC547Package_TO_SOT_THT:TO-92_InlineQ1, Q2, Q3, Q4
20.1ufCapacitor_THT:C_Disc_D3.8mm_W2.6mm_P2.50mmC1, C3
274HC595Package_DIP:DIP-16_W7.62mm_Socket_LongPadsU1, U2
1100ufCapacitor_THT:CP_Radial_D5.0mm_P2.50mmC2
110kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR22
1Arduino_Nano_EveryModule:Arduino_NanoA1
1Conn_01x02_PinConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ1
1Conn_01x04_SocketConnector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_VerticalJ2
1Conn_01x16_SocketConnector_PinSocket_2.54mm:PinSocket_1x16_P2.54mm_VerticalJ3
1RResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR3
1SW_PushButton_Switch_THT:SW_PUSH_6mmSW1

Similar boards

  • 2 layers148.8 × 132.2 mmUsbflashprog, the printed circuit board in 3D

    Usbflashprog

    robsonsmartins/usbflashprog

    A memory device programmer (Flash/EPROM/E2PROM) board and software, connected to PC by USB port.

    125 parts36
  • 2 layers99.1 × 99.1 mmSID MB, the printed circuit board in 3D

    SID MB

    Ixox/midibox-SID

    PCBs, Panels and firmware for puting a 4 stereo voices midiboxSid in a 1U 19" rack

    93 parts20
  • 2 layers100 × 100 mmLcr 2, the printed circuit board in 3D

    Lcr 2

    yjmwxwx/stm32asm

    256 parts16GPL-3.0
  • 2 layers139 × 139 mmScreen driver, the printed circuit board in 3D

    Screen driver

    lambdaBoost/MC6205-graphical-display

    graphical display on old neon plasma screen

    285 parts7
  • 2 layers137.7 × 56.4 mmDivergence meter logic, the printed circuit board in 3D

    Divergence meter logic

    toohka42/Divergence-Meter

    Itron Divergence meter based on Steins;Gate anime series

    73 parts2MIT
  • 2 layers170.2 × 119.4 mmSentinel, the printed circuit board in 3D

    Sentinel

    YousefAliAicha/sentinel-arduino-firmware

    Adaptive traffic-light FSM on the Arduino UNO R3 — pedestrian preemption, LDR-gated night mode with HC-SR04 vehicle detection, and a multiplexed 7-segment countdown. Fully non-blocking.

    25 parts2MIT
  • 2 layers199 × 57.5 mmIROC U Charging, the printed circuit board in 3D

    IROC U Charging

    24bec124-sketch/IROC-U-Charging-PMOS

    Developed for Team Arrow as part of IRoC-U (ISRO Robotics Challenge - URSC), a national student competition hosted by the Indian Space Research Organization (ISRO).

    48 parts1

Questions

How big is the LedCubePCB PCB?

It measures 64.8 × 50.4 mm and has 2 copper layers, 1.6 mm thick.

What parts does the LedCubePCB use?

36 parts, built around the 74HC595 and BC547. 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 LedCubePCB KiCad files?

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

Can I use the LedCubePCB design in my own project?

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