Remotely Controlled RGB Desktop Lights

by RitankarP in Circuits > Electronics

992 Views, 5 Favorites, 0 Comments

Remotely Controlled RGB Desktop Lights

WhatsApp Image 2020-04-06 at 19.56.25 (3).jpeg
WhatsApp Image 2020-04-06 at 23.18.33.jpeg

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.

Get the Strips in the Right Place

WhatsApp Image 2020-04-06 at 19.56.25 (2).jpeg
WhatsApp Image 2020-04-06 at 19.56.25 (1).jpeg
WhatsApp Image 2020-04-06 at 19.56.25.jpeg
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

Make the Little Connections

WhatsApp Image 2020-04-06 at 21.54.09.jpeg

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.

Firebase Rules and Database Schema

firebase_rules.png
firebase_schema.png

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.

Code for the Setup

voidsetup.png
voidloop.png
helperfunctions.png

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.

The Autoroom App

WhatsApp Image 2020-04-06 at 22.28.58.jpeg
WhatsApp Image 2020-04-06 at 22.26.24.jpeg
WhatsApp Image 2020-04-06 at 22.25.56.jpeg
WhatsApp Image 2020-04-06 at 22.25.56 (1).jpeg
WhatsApp Image 2020-04-06 at 22.25.56 (2).jpeg
WhatsApp Image 2020-04-06 at 22.27.51 (1).jpeg
WhatsApp Image 2020-04-06 at 22.27.51.jpeg
Controlling WS2812B Led Strip with a Flutter app and Firebase RTLD

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.