RGBeatz


RGBeatz - Smart RGB Strip Controller with Music-Reactive Features

RGBeatz is an open-source project that enables remote control of addressable RGB LED strips through a NodeMCU microcontroller connected to the internet. It supports a variety of lighting patterns and can react to audio analytics from Spotify, creating dynamic, music-synchronized lighting. Additionally, RGBeatz uses Firebase Realtime Database for seamless communication between a mobile app and the MCU, and it supports user authentication via Google accounts.

Key Features

Hardware Requirements

Software Requirements

Installation Guide

Step 1: Hardware Setup

  1. Connect the WS2812B RGB strip to the NodeMCU. Ensure the data pin is connected to digital pin D2.
  2. Power up the NodeMCU with a compatible power source.

Step 2: Arduino Code Upload

  1. Download the latest version of the RGBeatz.ino file.
  2. Open RGBeatz.ino in the Arduino IDE.
  3. Configure your Firebase and WiFi credentials in the code, if necessary.
  4. Connect your NodeMCU to your computer and select the appropriate board and port in the Arduino IDE.
  5. Upload the code to the NodeMCU.

Step 3: RGBeatz App Setup

  1. Download and install the RGBeatz mobile app from GitHub.
  2. Log in using your Google account. This will synchronize your settings and data across devices.
  3. Follow the steps in the app to pair your NodeMCU with your account and control your RGB strip.

Step 4: Running RGBeatz.exe

Usage Instructions

  1. Once logged in to the app, you’ll be able to control the RGB strip through the mobile interface.
  2. To enable music-reactive features, ensure that Spotify is playing on your device. The app will analyze the music beats in real-time and adjust the lighting accordingly.
  3. Experiment with the 5 available RGB patterns, with more patterns planned in future updates.

Notes

Support and Contributions

RGBeatz is an evolving project, and community contributions are welcome. For issues, suggestions, or feature requests, please visit the GitHub repository and submit a pull request or an issue.


Table of Contents

  1. Overview
  2. Dependencies
  3. Configuration
  4. Core Features
    • LED Patterns
    • WiFi & Firebase Setup
    • System Reset Functions
  5. Usage Example

Overview

RGBeatz is powered by an ESP8266/NodeMCU controller, which manages WS2812B LED strips through WiFi. By connecting to Firebase, it allows remote control via a mobile app, with support for multiple dynamic lighting modes including music reactivity.

Dependencies

The following libraries are required for RGBeatz:

// WiFi & Web Server
#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>

// Time
#include <NTPClient.h>
#include <WiFiUdp.h>

// LED Control
#include <Adafruit_NeoPixel.h>
#include <FastLED.h>

// Firebase
#include <Firebase_ESP_Client.h>
#include "addons/RTDBHelper.h"

// File System & JSON
#include <FS.h>
#include <ArduinoJson.h>

Configuration

Hardware Configuration

Firebase Configuration

Define the Firebase URL and authentication key in the code:

#define DATABASE_URL "your_database_url"
#define DATABASE_SECRET "your_database_secret"

Core Features

1. WiFi Setup

void wifisetup() {
  WiFi.softAP(apssid, appassword);
  server.on("/", handleRoot);
  server.on("/wifiset", getwififromportalwrite);
  server.begin();
}

2. Firebase Integration

void setup() {
  config.database_url = DATABASE_URL;
  config.signer.tokens.legacy_token = DATABASE_SECRET;
  Firebase.begin(&config, &auth);
}

3. LED Control Modes

Music Reactive Mode (lol = 1023)

Creates a music-synchronized effect with LEDs lighting outward from the center based on music amplitude.

void wifi_music() {
  // Implements music visualization based on amplitude
  // Center-outward effect synchronized with music
}

Solid Color Mode (lol = 0)

Sets the entire LED strip to a single RGB color based on provided R, G, B values.

void SOLIDBLYNKCOLOR() {
  // Sets entire strip to single RGB color
}

LED Patterns

The available patterns and modes include:

  1. Solid Color (Mode 0): Displays a static color across the strip.
  2. Music Reactive (Mode 1023): Creates dynamic, center-outward lighting based on music amplitude.
  3. Color Fading Outward (Mode 30): Animates colors from the center outward using configured RGB values.
  4. Random Color Fading (Mode 60): Fades to random colors across the strip.
  5. RGB Cycle (Mode 90): Continuously cycles through rainbow colors.

WiFi & Firebase Setup

Initial WiFi Configuration

  1. The device starts in AP mode, creating a WiFi network called “RGBeatz.”
  2. Connect to the “RGBeatz” AP to set WiFi credentials.
  3. Credentials are saved in SPIFFS, allowing the device to reconnect after reset.

Firebase Connection

The Firebase configuration includes a database URL and secret key, which are authenticated during the initial setup.

void setup() {
  config.database_url = DATABASE_URL;
  config.signer.tokens.legacy_token = DATABASE_SECRET;
  Firebase.begin(&config, &auth);
}

System Reset Functions

Soft Reset (lol = 10022)

Restarts the device, keeping saved configurations intact.

Factory Reset (lol = 10032)

Resets device settings, clearing WiFi and Firebase credentials from SPIFFS.

void RESETRGBEATZ() {
  SPIFFS.remove("/wififirebase.txt");
  ESP.restart();
}

Error Handling

RGBeatz includes checks to ensure stable operation:

File System Structure

  1. wififirebase.txt: Stores WiFi and Firebase credentials.
  2. sysconffile.txt: Holds system configurations and device-specific UUID.

This is the only one i could find with the wireless spotify feature

Demo Video

App Images

RGBeatz_app

-Apps for https://github.com/AryanRai/RGBeatz

Python App

Used to look like this back in the day

Login UI

image

Sorry about the background

Google Login

Screenshot 2024-11-07 205030 Screenshot 2024-11-07 204919 Screenshot 2024-11-07 205042

Spotify Login

Screenshot 2024-11-07 205011 Screenshot 2024-11-07 205019

Device Pairing Wizard (incomplete)

Screenshot 2024-11-07 205516

Control Dashboard UI

Screenshot 2024-11-07 205531 Screenshot 2024-11-07 205535 Screenshot 2024-11-07 205541

Firebase Realtime DB struc

Screenshot 2024-11-07 205634

Realtime value change demo

Screenshot 2024-11-07 205644

Usage Example

Basic setup and loop functions for a 60-LED strip:

void setup() {
  Serial.begin(115200);
  checklocalwificreds();
  // WiFi and Firebase setup follows
}

void loop() {
  // Select pattern based on 'lol' value
  if (lol == 0) SOLIDBLYNKCOLOR();
  else if (lol == 1023) wifi_music();
  // Additional patterns...
}

This documentation outlines the main functionalities of the RGBeatz Arduino code, covering the setup, patterns, and modes available. For further setup instructions and troubleshooting, please visit the RGBeatz GitHub repository.