Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsThe Waveshare ESP32-S3-Matrix has an 8x8 WS2812 RGB matrix and a QMI8658 6-axis IMU on one thumb-sized board. This sketch reads the accelerometer, moves a dot in the direction of the tilt and lights a target pixel: roll onto it to score, and a new target appears. No wiring is needed; it is a good first project for the board.
Tick anything you already have and the total updates.
ESP32-S3 with 8x8 RGB matrix and QMI8658 IMU
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB-C 5 V. Keep brightness low: the LEDs get hot at full white.
tilt_game.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "SensorQMI8658.hpp"
#define LED_PIN 14
#define SDA_PIN 11
#define SCL_PIN 12
Adafruit_NeoPixel px(64, LED_PIN, NEO_RGB + NEO_KHZ800);
SensorQMI8658 imu;
IMUdata acc;
int x = 3, y = 3, tx = 6, ty = 1, score = 0;
const float TILT = 0.25; // g needed to move one pixel
void draw() {
px.clear();
px.setPixelColor(ty * 8 + tx, px.Color(20, 0, 0)); // target
px.setPixelColor(y * 8 + x, px.Color(0, 20, 10)); // ball
px.show();
}
void setup() {
px.begin(); px.setBrightness(40);
if (!imu.begin(Wire, QMI8658_L_SLAVE_ADDRESS, SDA_PIN, SCL_PIN)) { while (true) delay(1000); }
imu.configAccelerometer(SensorQMI8658::ACC_RANGE_4G, SensorQMI8658::ACC_ODR_250Hz, SensorQMI8658::LPF_MODE_0);
imu.enableAccelerometer();
draw();
}
void loop() {
if (imu.getDataReady() && imu.getAccelerometer(acc.x, acc.y, acc.z)) {
if (acc.x > TILT && x < 7) x++;
if (acc.x < -TILT && x > 0) x--;
if (acc.y > TILT && y > 0) y--;
if (acc.y < -TILT && y < 7) y++;
if (x == tx && y == ty) { score++; tx = random(8); ty = random(8); }
draw();
}
delay(120);
}
The matrix orientation depends on how you hold the board; swap the signs in the four if-lines.
Change NEO_RGB to NEO_GRB.
Check you selected the right board and that SensorLib is installed; the IMU is at 0x6B on this board.
Yes, show the score after 60 seconds by flashing the matrix.
Yes, it runs from USB 5 V. Keep brightness at 40 or below so the LEDs stay cool.
Yes, call configGyroscope and enableGyroscope for rotation speed.
1 part: Waveshare ESP32-S3 Development Board w/ 8×8 RGB LED Matrix & QMI8658C Sensor. On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 1 hour. The build on this page has 5 steps.
No. This page has the complete, tested code (tilt_game.ino).
About ₹1,189 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Driving WS2812 pixels with Adafruit NeoPixel; Reading an accelerometer to sense tilt; Simple game loop with collision checks.
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Press to roll: the pips tumble and slow down before landing on a number.
Wait for the light, hit the button: how many milliseconds can you beat?
A bright 4-digit clock that keeps time through power cuts.
Learning project. Check every circuit and the datasheet of each part before you power it up.