Close
0%
0%

Raspberry Pi Pico Matrix Project

Made a Matrix Dev Board, which includes 100 WS2812B LEDs and MPU6050

Similar projects worth following
0 followers
Greeting everyone and welcome back.

Here's something fun and bright! The Raspberry Pi Pico, WS2812B LEDs, and an MPU6050 were utilized in the PICO Matrix project, a Matrix Development Board designed for tinkering with WS2812B LEDs.
The goal was to develop a matrix with a dedicated microcontroller board that could be utilized for future RGB matrix-based projects. Additionally, it has an MPU6050 to provide this matrix board with an accelerometer function.

Users can create a wide range of projects with this matrix development board; for instance, we use it to create an RGB light display, a scrolling display, and even a Pixel Control sketch with the MPU6050.

Circuit Design

The two primary parts of this project's circuit are the LED matrix itself, which is made up of 100 WS2812B LEDs connected in their typical configuration, which connects the first LED's dout to the second's din, the second LED's dout to the second's din, and so on until the 100th LED. The VCC and GND of every LED are linked in parallel.

The second part of the circuit is made up of a Raspberry Pi Pico and an MPU 6050 accelerometer sensor that is connected to the Pico's GPIO27 and GPIO26. The first LED's Din is connected to the Raspberry Pi Pico's GPIO D0. In order to supply power to the board with a type-C connector, we have included a USB Type-C port with Pico's 5V IN and GND ports.

For each WS2812B LED, we further added 100 decoupling capacitors; however, in the end, we only used 10x 100 nf capacitors, one for each row.

Once the design was complete, we converted it into a board file and arranged all 100 LEDs in a 10x10 row and column grid.

Please take note that we have arranged the LEDs D1 through D10 in a single row. D11 is positioned at the beginning of the new column and extends to D20, followed by D21, which also begins at the beginning of the next column and continues to D100. Another name for this is serpentine matrix or snake matrix pattern.

After finishing the PCB and positioning the Pico and MPU on the left, we exported the Gerber data, which will be sent to a PCB manufacturer for samples.

HQ NextPCB Service

After completing the PCB design, we export the Gerber data and send it to HQ NextPCB for samples.

Gerber Data was sent to HQ NextPCB, and a Green Solder Mask PCB with White Screen was ordered.

After placing the order, the PCBs were received within a week, and the PCB quality was pretty great.

In addition, I have to bring in HQDFM to you, which helped me a lot through many projects. Huaqiu’s in-house engineers developed the free Design for Manufacturing software, HQDFM, revolutionizing how PCB designers visualize and verify their designs.

HQDFM: Free Online Gerber Viewer and DFM Analysis Tool

Also, NextPCB has its own Gerber Viewer and DFM analysis software.

Your designs are improved by their HQDFM software (DFM) services. Since I find it annoying to have to wait around for DFM reports from manufacturers, HQDFM is the most efficient method for performing a pre-event self-check.

Here is what online Gerber Viewer shows me. Would not be more clear. However, for full function, like DFM analysis for PCBA, you, need to download the software. The online version only provides a simple PCB DFM report.

With comprehensive Design for Manufacture (DFM) analysis features, HQDFM is a free, sophisticated online PCB Gerber file viewer.

It provides insights into advanced manufacturing by utilizing over 15 years of industry expertise. You guys can check out HQ NextPCB if you want great PCB service at an affordable rate.

SCH.pdf

Adobe Portable Document Format - 234.46 kB - 11/15/2024 at 08:56

Preview

  • 1
    CIRCUIT ASSEMBLY
    • Using a solder paste dispenser needle, we apply solder paste to each component pad to begin the circuit assembly process. In this case, we are using 63/37 SnPB Solderpaste.
    • After that, we pick each WS2812B LED and place it into their correct position.
    • The PCB is then heated from below to the solder paste melting temperature by placing the circuit on the Reflow Hotplate, which causes all of the SMD LEDs to be connected to their pads.
    • After reflow, we place the THT components, which consist of female header pin connectors for the Raspberry Pi Pico, and MPU6050 along with a USB type C port.
    • Using a soldering iron, we solder the leads of every through-hole component from the bottom side of the board.
    • Finally, we position the MPU6050 and Raspberry Pi Pico on the header pins, and the assembly is now complete.
  • 2
    "MPU Control Pixel" Sketch

    We start testing this matrix by uploading a sketch we created, which is essentially a pixel control sketch that makes use of the MPU6050. In this sketch, a bright pixel in the center moves in response to the MPU6050's orientation, simulating a particle of sand. For a future hourglass project that senses movement and controls pixel particles that travel around like sand particles, our goal is to refine this sketch further.

    #include <Adafruit_NeoPixel.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_NeoMatrix.h>
    #include <Wire.h>
    #include <MPU6050_light.h>
    #define MATRIX_PIN 0
    #define MATRIX_WIDTH 10
    #define MATRIX_HEIGHT 10
    #define NUMPIXELS (MATRIX_WIDTH * MATRIX_HEIGHT)
    Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_PIN,
    NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
    NEO_MATRIX_ROWS,
    NEO_GRB + NEO_KHZ800);
    MPU6050 mpu(Wire1);
    int prevX = MATRIX_WIDTH / 2;
    int prevY = MATRIX_HEIGHT / 2;
    void setup() {
    matrix.begin();
    matrix.setBrightness(50);
    // Initialize I2C1 with pins 26 (SDA) and 27 (SCL)
    Wire1.setSDA(26);
    Wire1.setSCL(27);
    Wire1.begin();
    mpu.begin();
    mpu.calcOffsets(true, true); // Calculate and apply offsets
    // Display initialization success
    matrix.fillScreen(0);
    matrix.show();
    }
    void loop() {
    mpu.update();
    // Normalize accelerometer values
    float axNorm = -mpu.getAccX() * 5; // Invert X-axis sensitivity
    float ayNorm = mpu.getAccY() * 5; // Adjust sensitivity
    // Clear the previous pixel
    matrix.drawPixel(prevX, prevY, matrix.Color(0, 0, 0));
    // Calculate the new position
    int centerX = MATRIX_WIDTH / 2;
    int centerY = MATRIX_HEIGHT / 2;
    int newX = constrain(centerX + (int)ayNorm, 0, MATRIX_WIDTH - 1); // Horizontal movement
    int newY = constrain(centerY - (int)axNorm, 0, MATRIX_HEIGHT - 1); // Vertical movement
    // Update the matrix with the new position
    matrix.drawPixel(newX, newY, matrix.Color(255, 0, 0)); // Display influenced pixel
    matrix.show();
    // Update the previous position
    prevX = newX;
    prevY = newY;
    delay(20); // Reduce delay for smoother movement
    }

     These are the libraries that you first need to install before using the sketch.

    #include <Adafruit_NeoPixel.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_NeoMatrix.h>
    #include <MPU6050_light.h>
  • 3
    SCROLLING TEXT

    The scrolling text animation was the next interesting thing we tried. It was made up of a humorous statement that we put to our sketch and that said the following: "Why don't scientists trust atoms? Because they make up everything!"

    Here's the sketch we used.

    #include <Adafruit_NeoPixel.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_NeoMatrix.h>
    #define MATRIX_PIN 0 // GPIO pin connected to the LED matrix data pin
    #define MATRIX_WIDTH 10
    #define MATRIX_HEIGHT 10
    Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_PIN,
    NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
    NEO_MATRIX_ROWS,
    NEO_GRB + NEO_KHZ800);
    int x = 0; // Initialize position
    void setup() {
    Serial.begin(115200);
    Serial.println("Matrix scrolling text display setup...");
    matrix.begin();
    matrix.setTextWrap(false);
    matrix.setBrightness(50);
    matrix.setTextColor(matrix.Color(0, 0, 255)); // White color for text
    matrix.setTextSize(1); // Ensure text size is appropriate
    x = matrix.width(); // Start cursor position at the matrix width
    }
    void loop() {
    matrix.fillScreen(0); // Clear screen
    const char *text = "Why don't scientists trust atoms? Because they make up everything!";
    matrix.setCursor(x, 0);
    matrix.print(text);
    Serial.print("Cursor X position: "); Serial.println(x);
    Serial.print("Text to display: "); Serial.println(text);
    int textWidth = 6 * strlen(text); // Calculate the width of the text
    if (--x < -textWidth) {
    x = matrix.width();
    Serial.println("Resetting cursor position.");
    }
    matrix.show();
    delay(110); // Adjust the delay to control the scrolling speed
    }

    You need the following libraries before using this sketch.

    #include <Adafruit_NeoPixel.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_NeoMatrix.h>

View all 5 instructions

Enjoy this project?

Share

Discussions

Does this project spark your interest?

Become a member to follow this project and never miss any updates