Introduction: Remotely Controlled RGB Desktop Lights

This project demonstrates the use of firebase as a server for controlling and manipulating the led lights along the backside of my table.

Supplies

  • ESP8266.
  • Led Strips WS2812B.
  • Power supply with at least 10W@5V rating.
  • An app for controlling the LED Strips.

Step 1: Get the Strips in the Right Place

The first thing is to get the LED strips in place

I choose my bland old computer table for this project so I used some sticky tapes and fixed up my WS2812b led strips along the backside of it and connected the VCC, GND, DATA lines with a few wires as demonstrated in the pictures

Step 2: Make the Little Connections

Connect the power supply to the ESP8266 [Note* - I used a board that I used for Home Automation but we only need the ESP8266]

Connect as follow:

  • D5(Pin 14) -> Data Pin of LED strip
  • Interconnect the GND pin of ESP8266, Power Supply, LED Strips.

That's for the hardware, now lets jump into coding board.

Step 3: Firebase Rules and Database Schema

The Database Schema is simple.

  • (user)
    • neopixels
      • 0
        • {r:12, g:220, b:120}
      • 1
        • {r:112, g:150, b:200}
    • token
      • public : {token}
      • private: {token}

This Schema represents a simple structures a list of Led values

Token sections represents a simple authentication system where the public and private section matches if authenticated.

Step 4: Code for the Setup

The code is pretty self-descriptive.

  1. Include the required libraries.
  2. Setup the authentication token of database
  3. Provide WiFI credentials
  4. Setup the firebase stream to neopixels changes and start listening for changes in the data triggered by the client-side.
  5. In the loop keep on checking for the events and send the incoming data to the helper functions.

  • The helper function takes the data and checks wheater the neopixel update was trigger for a:
    • A single LED
    • A range of LED numbers
    • All of the LEDs.

Step 5: The Autoroom App

I made an app called "Autoroom" in Flutter using the Dart Programming Language, the controls the LED Lights.

Here are example results to that.

  1. First, log in with the credentials in my case it's (xritzx)
  2. Select the color and the range and hit update.
  3. Or maybe color the entire range by selecting -1.

LED Strip Speed Challenge

Participated in the
LED Strip Speed Challenge