Remotely Controlled RGB Desktop Lights
by RitankarP in Circuits > Electronics
992 Views, 5 Favorites, 0 Comments
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.
Get the Strips in the Right 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
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
The Database Schema is simple.
- (user)
- neopixels
- 0
- {r:12, g:220, b:120}
- 1
- {r:112, g:150, b:200}
- 0
- token
- public : {token}
- private: {token}
- neopixels
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
The code is pretty self-descriptive.
- Include the required libraries.
- Setup the authentication token of database
- Provide WiFI credentials
- Setup the firebase stream to neopixels changes and start listening for changes in the data triggered by the client-side.
- 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
I made an app called "Autoroom" in Flutter using the Dart Programming Language, the controls the LED Lights.
Here are example results to that.
- First, log in with the credentials in my case it's (xritzx)
- Select the color and the range and hit update.
- Or maybe color the entire range by selecting -1.