ESP32-S3 RGB LED Matrix Project 4 - Tilt dot

ESP32-S3 RGB LED Matrix Project 4 - Tilt dot

Project 4 – Tilt Dot (Move the Dot by Tilting the ESP32-S3 RGB LED Matrix)

Project 4 introduces the motion sensor built into the ESP32-S3 RGB LED Matrix module. Instead of moving the dot automatically (like Project 1) or scrolling text (Projects 2 and 3), this project lets you control the position of the dot simply by tilting the board. The dot moves smoothly across the 8×8 RGB display based on live readings from the QMI8658C accelerometer on the back of the module.

All six projects in this series are demonstrated in one YouTube video. The same video is embedded on this page, so you can see exactly how the dot moves in real time as the board tilts. The complete code for this project is loaded automatically below the article, and affiliate purchase links for the module appear under the code section.

ESP32-S3 RGB LED Matrix Module Overview

This project uses the ESP32-S3 RGB LED Matrix module, which includes:

  • ESP32-S3 microcontroller with Wi-Fi and Bluetooth
  • 8×8 RGB LED matrix (64 individually addressable LEDs)
  • QMI8658C accelerometer on the back for tilt and motion detection
  • USB port for programming and power
  • Boot / Reset buttons
  • Usable GPIO pins for future expansion

The QMI8658C sensor reads X, Y, and Z acceleration and orientation values, allowing the dot to move up/down/left/right based on how the board is tilted.:contentReference[oaicite:0]{index=0}

Projects Covered in the Video (Timestamps)

  • 00:00 – Introduction
  • 02:01 – Installing ESP32 boards
  • 03:32 – Installing libraries
  • 05:32 – Project 1: Moving Dot
  • 11:11 – Project 2: Text Scroll
  • 12:59 – Project 3: HTTP Text
  • 16:41Project 4: Tilt Dot (this project)
  • 18:55 – Project 5: Arrow Up
  • 20:02 – Project 6: Target Game

Watching the tilt demonstration in the video is highly recommended, as you can see how the dot reacts smoothly to the orientation of the board.:contentReference[oaicite:1]{index=1}

Installing ESP32 Boards in Arduino IDE

If you have completed any earlier project, the board support is already installed. Otherwise, follow these steps:

  1. Open File > Preferences → Add ESP32 Boards URL.
  2. Go to Tools > Board > Boards Manager… and install ESP32.
  3. Select your ESP32-S3 board under Tools > Board.
  4. Select the correct COM port under Tools > Port.

Installing Required Libraries

This project requires the following libraries:

  • Adafruit NeoMatrix
  • Adafruit NeoPixel
  • Adafruit GFX Library
  • QMI8658 (motion sensor)

Install them in the Library Manager:

  1. Open Sketch > Include Library > Manage Libraries….
  2. Search for Adafruit NeoMatrix → Install.
  3. Allow automatic installation of Adafruit GFX and Adafruit NeoPixel.
  4. Search for QMI8658 by its listed author → Install.:contentReference[oaicite:2]{index=2}

How Project 4 Works

The QMI8658C sensor continuously provides acceleration data along X, Y, and Z axes. For this project, we only use the X and Y axes to decide:

  • How far to move the dot left or right (X axis)
  • How far to move the dot up or down (Y axis)

The sensor values are mapped into a coordinate range from 0 to 7 (for the 8×8 LED matrix). The dot position updates many times per second, giving the smooth sliding effect as you tilt the module.:contentReference[oaicite:3]{index=3}

Project 4 – Code Settings (Tilt Dot)

Below are the user-editable settings found near the top of the project’s code. The full sketch appears below the article automatically.

Matrix Pin and Size


// 8×8 RGB matrix configuration
const int MATRIX_PIN    = 14;   // fixed pin for this board
const int MATRIX_WIDTH  = 8;
const int MATRIX_HEIGHT = 8;

Leave MATRIX_PIN at 14. It is hard-wired to the onboard matrix.

Brightness


// Overall brightness (0–255)
uint8_t matrixBrightness = 40;

Increase if needed, but avoid extreme brightness when viewing up close.

Dot Color


// Dot color (R, G, B)
uint8_t dotRed   = 0;
uint8_t dotGreen = 200;   // light green (default)
uint8_t dotBlue  = 0;

Change these values to create any color. Examples:

  • Red: (255, 0, 0)
  • Yellow: (255, 255, 0)
  • White: (255, 255, 255)

Motion Sensitivity

To prevent extreme jumps, accelerometer values are usually clamped or scaled. A typical setting looks like:


// How aggressively tilt affects movement
float sensitivity = 4.0f;   // larger = faster movement across screen

If the dot moves too slowly → increase the value. If the dot moves too abruptly → decrease it.

Update Speed (Refresh Rate)

You can add a small delay between updates to smooth motion:


// Delay between position updates (ms)
int refreshDelayMs = 20;   // lower = smoother and faster response

Values between 10–30 ms feel very responsive.

Summary

Project 4 brings the ESP32-S3’s built-in QMI8658C accelerometer to life by letting you control the LED matrix with physical motion. A small tilt of the board moves the dot in the same direction, making this project a perfect stepping stone for the more advanced “Arrow Up” and “Target Game” projects.

The full Tilt Dot sketch is loaded below this article (automatically). For best understanding, watch the tilt demonstration in the video, where you can see how smoothly the dot moves as the board is rotated. Links to purchase the ESP32-S3 RGB LED Matrix module are included under the code section.

Immagini

ESP32 S3 Matrix
ESP32 S3 Matrix
ESP32 S3 Matrix  pin out
ESP32 S3 Matrix pin out
ESP32-S3_RGB_8x8_matrix-3
ESP32-S3_RGB_8x8_matrix-3
ESP32 S3 Matrix displaying rainbow heart
ESP32 S3 Matrix displaying rainbow heart
ESP32-S3_RGB_8x8_matrix1
ESP32-S3_RGB_8x8_matrix1
ESP32-S3_RGB_8x8_matrix-2
ESP32-S3_RGB_8x8_matrix-2
802-ESP32-S3 RGB LED Matrix Project 4 - Tilt dot
Lingua: C++
Copia!

Cose di cui potresti avere bisogno

Risorse e riferimenti

Nessuna risorsa ancora.

File📁

Nessun file disponibile.