Skip to the content
2 layers40.1 × 64.4 mmMPU6050.kicad pcbFINAL, the printed circuit board in 3D

Raspberry Pi Pico Dual-Core PCB Hat with MPU-6050 and WS2812B LED Strip

Size
40.1 × 64.4 mm
Copper layers
2
Thickness
1.6 mm
Parts
9
Nets
80
Pads
123
Tracks, vias
162, 11
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
19 Nov 2025
Updated
20 Nov 2025

Overview

MPU6050.kicad pcbFINAL is an open-source printed circuit board by varolkan, from the varolkan/Yens-Yens-internship-assignment repository on GitHub, published under the MIT licence. It is a 2-layer board of 40.1 × 64.4 mm with 9 parts on 80 nets, routed with 162 tracks and 11 vias.

It is built around the MPU-6050. Its parts include 4 capacitors, 2 resistors, 1 IC and 1 connector. It belongs with the RP2040 boards of this library.

Main components

1

README

README.md

Motion-Driven Light System

Raspberry Pi Pico Dual-Core PCB Hat with MPU-6050 and WS2812B LED Strip

C++ Raspberry Pi KiCad Arduino IDE

Project Overview

Motion-Driven Light is a dual-core embedded system for the Raspberry Pi Pico featuring:

  • Real-time motion sensing via MPU-6050 6-axis accelerometer/gyroscope module
  • Physics-based water flow LED animation with smooth gradient falloff on WS2812B addressable RGB LED strip
  • Custom PCB Hat design with complete KiCad project files and production-ready Gerber manufacturing outputs
  • Hardware-agnostic robustness: Automatic simulation mode when sensor is not detected, enabling code testing without physical hardware
  • Dual-core architecture: Core 0 handles sensor I/O and data acquisition, Core 1 manages LED rendering and real-time serial visualization

Technical Assignment for: Yens & Yens
Author: M. Salih BEKTUR

Testing Without Hardware (Simulation Mode)

This project includes automatic robustness for testing without physical hardware.

Quick Start (No Sensor Required)

  1. Flash the code to any Raspberry Pi Pico (even without MPU-6050 connected)
  2. Open Serial Monitor at 115200 baud
  3. System auto-detects missing sensor and engages SIMULATION MODE
  4. Watch the animation: A smooth sine wave generates virtual tilt data (-45° to +45°)

Expected Output

The system will output real-time ASCII visualization showing the liquid moving:

text
STATUS: SIM  | TILT:  37.6 | WATER: [~~~~~~~~~~~~~~~~~|O~~~]
STATUS: SIM  | TILT:  44.6 | WATER: [~~~~~~~~~~~~~~~~~|~~~O]
STATUS: SIM  | TILT:  37.2 | WATER: [~~~~~~~~~~~~~~~~~|O~~~]
STATUS: SIM  | TILT:  28.4 | WATER: [~~~~~~~~~~~~~~~~O|~~~~]
STATUS: SIM  | TILT:  -0.9 | WATER: [~~~~~~~~O~~~~~~~~|~~~~]
STATUS: SIM  | TILT: -10.5 | WATER: [~~~~~~O~~~~~~~~~~|~~~~]
STATUS: SIM  | TILT: -20.0 | WATER: [~~~~O~~~~~~~~~~~~|~~~~]
STATUS: SIM  | TILT: -29.1 | WATER: [~~~O~~~~~~~~~~~~~|~~~~]
STATUS: SIM  | TILT: -38.0 | WATER: [~O~~~~~~~~~~~~~~~~~~~~]

Legend:

  • O = Current bubble position (liquid center)
  • ~ = Water surface
  • | = Center reference marker (0° tilt)
  • Status shows SIMULATED or LIVE depending on sensor detection

With Real Hardware

When MPU-6050 is connected:

  • System automatically detects sensor at boot
  • Display changes to STATUS: LIVE
  • Tilt the board left/right to control the LED liquid
  • LED color shifts: Blue (flat) to Purple (left) to Cyan (right)

Architecture: Dual-Core Design

The Raspberry Pi Pico's RP2040 chip features two ARM Cortex-M0+ cores. This project leverages both for parallel task execution:

Core 0: Sensor Data Acquisition

File: setup() and loop() functions

  • Initializes I2C communication (GPIO4=SDA, GPIO5=SCL)
  • Continuously polls MPU-6050 for 6-axis motion data (50 Hz)
  • Calculates roll angle (tilt) from accelerometer readings and stores it in sharedAngle
  • Fallback Logic: If sensor fails, generates smooth sine wave simulation
  • Updates shared variable sharedAngle (thread-safe volatile)

Core 1: Visual Output and Rendering

File: setup1() and loop1() functions

  • Initializes WS2812B LED strip (GPIO15, 10 LEDs)
  • Reads sharedAngle and maps to LED position (0-9)
  • LED Physics Animation:
    • Water blob centered at tilt position
    • Smooth gradient falloff using Gaussian distribution
    • Dynamic color shifting based on tilt direction
  • ASCII Serial Output: Real-time visualization at 20 FPS
  • Rendering rate: ~8ms per frame (125Hz refresh)

Thread Safety

  • volatile float sharedAngle ensures atomic reads/writes between cores
  • volatile bool sensorConnected indicates sensor status
  • No mutex required due to single-variable communication pattern

Hardware Configuration

Pin Mapping (Custom PCB Hat)

ComponentGPIOFunctionPCB Connector
MPU-6050 SDAGPIO4I2C DataJ2 Pin 1
MPU-6050 SCLGPIO5I2C ClockJ2 Pin 2
WS2812B Data InGPIO15LED Strip ControlJ2 Pin 3
Power (5V)VBUSLED Strip PowerJ2 Pin 4
GroundGNDCommon GroundJ2 Pin 5

Bill of Materials (PCB)

  • Microcontroller: Raspberry Pi Pico (RP2040)
  • Sensor: MPU-6050 6-DOF IMU Module
  • LEDs: WS2812B Addressable RGB Strip (10 LEDs minimum)
  • PCB: Custom 2-layer board (see Final PCB Files/)
  • Connectors: JST headers for modular connections

Installation and Setup

1. Software Requirements

2. Upload Instructions

bash
# 1. Clone this repository
git clone https://github.com/varolkan/Yens-Yens-internship-assignment
cd Yens-Yens-internship-assignment/Yens-Yens-internship-assignment-main

# 2. Open Motion-DrivenLight.ino in Arduino IDE

# 3. Configure Board Settings:
#    - Board: "Raspberry Pi Pico"
#    - Port: (Select your Pico's COM port)
#    - Upload Speed: 921600

# 4. Click Upload (Ctrl+U)

# 5. Open Serial Monitor (Ctrl+Shift+M)
#    - Set baud rate: 115200

3. Hardware Assembly (Optional)

  1. Solder Raspberry Pi Pico to custom PCB

  2. Connect MPU-6050 module and WS2812B strip to J2 header (observe polarity)

    J2 Header Pinout:

    PinSignalConnects to
    13V3MPU-6050 VCC
    2GNDMPU-6050 GND, WS2812B GND
    3SDA (I2C)MPU-6050 SDA
    4SCL (I2C)MPU-6050 SCL
    55VWS2812B VCC
    6GPIO (LED Data)WS2812B DIN

    Double-check your PCB silkscreen and schematic for exact pin order and orientation.

  3. Power via USB-C on Pico

Note: System will auto-detect and run in simulation mode without sensor.

PCB Design Files

Included Resources

FolderContentsPurpose
Final PCB Files/KiCad project files (.kicad_pcb, .kicad_sch, .kicad_pro)Source design files
Final GERBER FILES/Manufacturing outputs (.gbr, .drl, .gbrjob)Send to PCB fabricator

Manufacturing Specifications

  • Layers: 2 (Top + Bottom copper)
  • Dimensions: Matches Raspberry Pi Pico footprint
  • Thickness: 1.6mm standard FR-4
  • Minimum Trace/Space: 0.15mm / 0.15mm
  • Finish: HASL or ENIG recommended

Ready to Order: Upload the entire Final GERBER FILES/ folder to JLCPCB, PCBWay, or similar service.

Testing and Validation

Functional Tests

  1. Sensor Detection Test

    • Boot with/without MPU-6050 connected
    • Verify correct mode displayed in serial output
  2. Simulation Mode Test

    • Boot without sensor
    • Confirm smooth sine wave animation (no crashes)
  3. Live Mode Test

    • Connect MPU-6050 to I2C pins
    • Tilt board and verify LED responds to physical motion
    • Check color transitions (Blue to Purple/Cyan)
  4. Serial Visualization Test

    • Monitor ASCII output for proper formatting
    • Verify 'O' marker moves across 25-character width

Expected Serial Output Format

text
=== BOOTING SYSTEM ===
Core 0: Initializing Sensor... [FAILED]
WARNING: Sensor missing. Switching to ROBUSTNESS MODE (Simulation).
STATUS: SIM  | TILT:  00.0 | WATER: [~~~~~~~~~~~~O~~~~~~~~~~~~|]

Test Results

The code has been validated 3 times using comprehensive test suite covering:

  • Simulation mode functionality (no hardware required)
  • Live sensor mode with Kalman filtering
  • Physics engine stability at all angles
  • Boundary conditions and edge cases
  • ASCII visualization rendering

All tests passed successfully. See TEST_RESULTS.md for detailed test results and COMPATIBILITY_TEST.md for platform compatibility analysis.

Key Features

Technical Highlights

  • Zero-Configuration Robustness: Works immediately on any Pico board
  • Professional PCB Design: Production-ready Gerber files included
  • Efficient Dual-Core Usage: Sensor I/O never blocks LED rendering
  • Smooth Physics Animation: Sub-pixel interpolation for fluid motion
  • Low Latency: 20ms sensor polling, 60ms render cycle
  • Universal Compatibility: Standard Arduino libraries, no custom dependencies

Customization Options

Modify these constants in Motion-DrivenLight.ino:

cpp
#define NUM_LEDS      10      // LED strip length (1-100)
#define ASCII_WIDTH   25      // Serial monitor width

Note: Brightness is set via strip.setBrightness(255) in the code.

Code Structure

The implementation consists of the following key components:

Main Arduino File: Motion-DrivenLight.ino

  • KalmanFilter class: Advanced sensor fusion to remove jitter from MPU-6050
  • Core 0 functions (setup/loop): Sensor acquisition and simulation
  • Core 1 functions (setup1/loop1): Physics engine and rendering
  • Verlet Integration: Physics-based motion simulation
  • Gamma Correction: CIE 1931 lookup table for linear brightness perception

Physics Constants

  • GRAVITY: 0.55 (controls liquid responsiveness)
  • DRAG_COEFF: 0.04 (air resistance simulation)
  • ELASTICITY: 0.50 (bounce behavior at boundaries)
  • BLOB_WIDTH: 1.8 (Gaussian sigma for smooth LED glow)

Documentation

  • Code Comments: Inline documentation throughout source
  • Pin Diagram: See Hardware Configuration section above
  • Schematic: Available in Final PCB Files/MPU6050.kicad_schFINAL.kicad_sch
  • Compatibility Analysis: See COMPATIBILITY_TEST.md

License

This project is open-source under the MIT License. See LICENSE file for details.

Acknowledgments

Libraries Used:

  • Adafruit NeoPixel Library
  • MPU6050 Library by Electronic Cats (based on Jeff Rowberg's I2Cdevlib)

Board Support: Raspberry Pi Pico Arduino Core by Earle F. Philhower, III

Assignment: Yens & Yens Technical Test

Contact

Author: M. Salih BEKTUR
Repository: https://github.com/varolkan/Yens-Yens-internship-assignment

For questions regarding this technical assignment submission, please open an issue in the repository.

Parts

9
QtyValueFootprintReferences
20.1µFCapacitor_SMD:C_0402_1005MetricC1, C2
24.7kResistor_SMD:R_0402_1005MetricR1, R2
110nFCapacitor_SMD:C_0402_1005MetricC4
12.2nFCapacitor_SMD:C_0402_1005MetricC3
1Conn_01x03_PinConnector:FanPinHeader_1x03_P2.54mm_VerticalJ2
1MPU-6050Sensor_Motion:InvenSense_QFN-24_4x4mm_P0.5mmU1
1RaspberryPi_PicoModule:RaspberryPi_Pico_Common_UnspecifiedA1

Similar boards

  • 2 layers23 × 120 mmFeather multi oled, the printed circuit board in 3D

    Feather multi oled

    idlehandsdev/volumetric_display

    TENEX OLED Displays

    72 parts312CC-BY-SA-4.0
  • 4 layers95 × 50 mmControl board, the printed circuit board in 3D

    Control board

    ZhuYanzhen1/MM32_CLion

    本项目是全国大学生智能车竞赛GDUT 2022年极速越野组的项目文件。采用了LQR控制器和多速率卡尔曼融合算法,并在单片机上实现。This project is the project document for the GDUT 2022 Extreme Off-Road Category of the National Student Intelligent Vehicle Competition.

    129 parts58AGPL-3.0
  • 2 layers50 × 66 mmBluePhil, the printed circuit board in 3D

    BluePhil

    pms67/BluePhil

    STM32-based development board with various sensors.

    106 parts53MIT
  • 2 layers36 × 43 mmAsac fc rev a, the printed circuit board in 3D

    Asac fc rev a

    victorhook/asac-fc

    asac fc is an rp2040 based flight controller made for FPV drone flying

    119 parts52GPL-3.0
  • 4 layers305 × 208.3 mmControlBoard, the printed circuit board in 3D

    ControlBoard

    paradise-fi/RoFI

    Distributed Metamorphic Robots

    224 parts42
  • 2 layers98.5 × 17.8 mmWeeSpindel, the printed circuit board in 3D

    WeeSpindel

    c-/weeSpindel

    Smaller, simpler version of the iSpindel. NOTE: Work-in-progress

    22 parts17
  • 2 layers36.2 × 36.2 mmDrone PCB, the printed circuit board in 3D

    Drone PCB

    PlumPot55/PCB_Designs

    Source Files of our PCB we did as a community

    50 parts15
  • 2 layers26 × 21.3 mmPModBoard, the printed circuit board in 3D

    PModBoard

    pms67/PModlet

    PMOD PCB with USB-to-UART converter and IMU (MPU-6050, I2C) for FPGAs.

    19 parts15MIT

Questions

How big is the MPU6050.kicad pcbFINAL PCB?

It measures 40.1 × 64.4 mm and has 2 copper layers, 1.6 mm thick.

What parts does the MPU6050.kicad pcbFINAL use?

9 parts, built around the MPU-6050. 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 MPU6050.kicad pcbFINAL KiCad files?

From the varolkan/Yens-Yens-internship-assignment repository on GitHub, at the commit this page was made from: the board is Final PCB Files/MPU6050.kicad_pcbFINAL.kicad_pcb and its schematic Final PCB Files/MPU6050.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the MPU6050.kicad pcbFINAL design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).