Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iothings:proiecte:2023:rgbledbar [2024/01/16 06:01]
rares.niculescu
iothings:proiecte:2023:rgbledbar [2024/01/16 07:28] (current)
rares.niculescu [RGB Ledbar]
Line 1: Line 1:
 ====== RGB Ledbar ====== ====== RGB Ledbar ======
  
-  * Author: Niculescu Rares Cosmin+  * Author: Niculescu Rares-Cosmin
   * Email: <​rares.niculescu@stud.acs.upb.ro>​   * Email: <​rares.niculescu@stud.acs.upb.ro>​
   * Master: GMRV   * Master: GMRV
-  * Source code, video and presentation:​ gitlab ​TODO+  * Source code, video and presentation: ​https://gitlab.cs.pub.ro/​rares.niculescu/​iot-rgb_ledbar/​-/​tree/​main/​
  
 =====Overview===== =====Overview=====
 The inspiration came from the 2014-2018 period when I was a part-time DJ at a club in my hometown. In addition to the DJ equipment, I also had a lighting setup consisting of several RGB LED bars that could be programmed and controlled using a DMX console to create a vibrant atmosphere at the party. Over time, I developed a true hobby for programming the LED bars, elements that are present at any show/party with at least 100 participants. The inspiration came from the 2014-2018 period when I was a part-time DJ at a club in my hometown. In addition to the DJ equipment, I also had a lighting setup consisting of several RGB LED bars that could be programmed and controlled using a DMX console to create a vibrant atmosphere at the party. Over time, I developed a true hobby for programming the LED bars, elements that are present at any show/party with at least 100 participants.
 ===Objective=== ===Objective===
-The purpose of this project is to simulate the behavior of a RGB LEDBAR. The user will be able to interact with the LED bar through a web interface that will change the lighting mode of the LEDs. The LEDs can be manually controlled (the final color will be set using sliders), automatically controlled using specific algorithms for coloring the LEDs, similar to those found in Christmas lights, or customized through a schedule created by the user (that will be uploaded in a Firebase Database). The automatic mode will provide 4 different lighting possibilities.+The purpose of this project is to simulate the behavior of a RGB LEDBAR. The user will be able to interact with the LED bar through a web interface that will change the lighting mode of the LEDs. The LEDs can be manually controlled (the final color will be set using sliders), automatically controlled using specific algorithms for coloring the LEDs, similar to those found in Christmas lights ​for example, or customized through a schedule created by the user (schedule ​will be uploaded in a Firebase Database). The automatic mode will provide 4 different lighting possibilities.
 ===Hardware=== ===Hardware===
   * **ESP-WROOM-32** - ESP32 Sparrow   * **ESP-WROOM-32** - ESP32 Sparrow
   * **Breadboards** - 1 half-breadboard + 1 full breadboard   * **Breadboards** - 1 half-breadboard + 1 full breadboard
-  * **Wires** - as many as possible ​:)+  * **Wires** - as many as possible ​^_^
   * **1k resistors** - 12 of them are necessary in this project   * **1k resistors** - 12 of them are necessary in this project
   * **Common cathode RGB Led** - 12 of them are necessary in this project   * **Common cathode RGB Led** - 12 of them are necessary in this project
 ===Software and services=== ===Software and services===
   * **Firebase Realtime database** - For saving the schedule for the custom mode   * **Firebase Realtime database** - For saving the schedule for the custom mode
-  * **Simple ​Web Page** - a simple Web Page designed to encompass all 3 functionalities. The Web Page is stored in the Flash Memory of the ESP32.+  * **Web Page** - a simple Web Page designed to encompass all 3 functionalities. The Web Page is stored in the Flash Memory of the ESP32.
   * **Arduino IDE** alongside the required libraries for ESP32: SPIFFS, WiFi, AsyncTCP, ESPAsyncWebServer,​ Firebase_ESP_Client   * **Arduino IDE** alongside the required libraries for ESP32: SPIFFS, WiFi, AsyncTCP, ESPAsyncWebServer,​ Firebase_ESP_Client
 =====Architecture===== =====Architecture=====
Line 29: Line 29:
   * The user will navigate through the simple web interface by choosing the lighting mode.   * The user will navigate through the simple web interface by choosing the lighting mode.
   * In the manual mode the user will control the ledbar through 9 different sliders (since we have 6 individual columns, grouped by 2). Each slider modifies the intensity of a RGB channel.   * In the manual mode the user will control the ledbar through 9 different sliders (since we have 6 individual columns, grouped by 2). Each slider modifies the intensity of a RGB channel.
-  * In the automatic mode the user will control the ledbar by selecting an individual lighting mode. There are 4 buttons on this page and the user can choose between: "Chritmas ​Mode", "​Running",​ "​Blinking",​ "Full Auto".+  * In the automatic mode the user will control the ledbar by selecting an individual lighting mode. There are 4 buttons on this page and the user can choose between: "Christmas ​Mode", "​Running",​ "​Blinking",​ "Full Auto".
   * In the custom mode the user will control the ledbar through an schedule uploaded in the Firebase DB. At first the LEDBAR is completely red and the user must not interact with the Web Page. After the ESP32 downloads the content from DB, the LEDBAR turns green and it's ready to "​play"​ the content. The user will manually trigger the schedule by pressing the "​START!"​ button.   * In the custom mode the user will control the ledbar through an schedule uploaded in the Firebase DB. At first the LEDBAR is completely red and the user must not interact with the Web Page. After the ESP32 downloads the content from DB, the LEDBAR turns green and it's ready to "​play"​ the content. The user will manually trigger the schedule by pressing the "​START!"​ button.
-===How the Web interface ​works===+===Web interface ​design===
   * The web interface is locally stored in the ESP32 SPIFFS.   * The web interface is locally stored in the ESP32 SPIFFS.
-  * Initial State+  ​* **Initial State**
   * {{:​iothings:​proiecte:​2023:​ScreenRGB_0.jpg?​400|}}   * {{:​iothings:​proiecte:​2023:​ScreenRGB_0.jpg?​400|}}
-  * Manual Mode+  ​* **Manual Mode**
   * {{:​iothings:​proiecte:​2023:​ScreenRGB_1.jpg?​400|}}   * {{:​iothings:​proiecte:​2023:​ScreenRGB_1.jpg?​400|}}
-  * Auto Mode+  ​* **Auto Mode**
   * {{:​iothings:​proiecte:​2023:​ScreenRGB_2.jpg?​400|}}   * {{:​iothings:​proiecte:​2023:​ScreenRGB_2.jpg?​400|}}
-  * Custom Mode+  ​* **Custom Mode**
   * {{:​iothings:​proiecte:​2023:​ScreenRGB_3.jpg?​400|}}   * {{:​iothings:​proiecte:​2023:​ScreenRGB_3.jpg?​400|}}
-=====Software implementation===== +=====Software implementation ​Overview===== 
-For starters I set up the environment similar to the demos found in labs 3 and 4. For the Web server part, I used the Async Web Server library and configured it similarly to the "​SPIFFS Webserver"​ demo. In other words, the ESP32 web server displays the control page, when the user interacts with the elements of the page the browser makes a request on a URL, ESP32 receives the request and parses it and, finally, it sends a PWM signal with the corresponding value to the GPIOs. It will also change some internal parameters. As I mentioned before the web page is stored in the internal memory+For starters I set up the environment similar to the demos found in labs 3 and 4. For the Web server part, I used the Async Web Server library and configured it similarly to the "​SPIFFS Webserver"​ demo. In other words, the ESP32 web server displays the control page, and when the user interacts with the elements of the page the browser makes a request on a URL, ESP32 receives the request and parses it and, finally, it sends a PWM signal with the corresponding value to the GPIOs. It will also change some internal parameters. As I mentioned before the web page is stored in the internal memory.
  
 After that I have configured the Firebase Database. I have assigned the API key and the RTDB URL and I have signed up on the firebase. After that I have configured the Firebase Database. I have assigned the API key and the RTDB URL and I have signed up on the firebase.
  
-The main idea of the project is to switch between individual "​states"​. For example state 1 is for the manual mode, state 2 is for "auto mode - Christmas Mode and so on." In the loop function ​+The main idea of the project is to switch between individual "​states"​. For example state 1 is for the manual mode, state 2 is for "auto mode - Christmas Mode" ​and so on. Inside ​the loop function ​is where the behavior is altered. For the manual and auto mode the behavior is modified 100% by the "​internal code" I have implemented. For the custom mode the ESP32 interrogates the Firebase DB to see if there is any schedule to download. If there is none, the ESP32 will wait until the DB updates or the user changes the lighting mode. If there is any content in the DB, the ESP32 will download the schedule and save it in a local file. Once the download is complete the ESP32 waits for the user to actually trigger the schedule.
 ====Project real-life view==== ====Project real-life view====
 {{:​iothings:​proiecte:​2023:​ScreenRGB_4.jpg?​720|}} {{:​iothings:​proiecte:​2023:​ScreenRGB_4.jpg?​720|}}
 =====Challenges and things to improve===== =====Challenges and things to improve=====
-  * Finding an easy way for a user create their own machine learning model, with minimal knowledge required. The main idea of the system was that all the user has to do, is to provide pictures of their house catsI have tried multiple free models with varying degrees of success, but none as good as Google'​s Teachable Machine, with provided a nice web interface ​to generate classifiers and export them as tensorflow models+  * I need a few but consistent libraries ​for this project and the problem is that these libraries take up lot of internal space (especially ​the Firebase_ESP_Client). Therefore ​the ESP32'​s internal memory ​is almost fullAn immediate disadvantage is that you cannot upload a very long schedule. But this is a minor problem overall ​as it can be easily resolved using an SD Card to download the schedule
-  * Testing was, and still is, hard to do without an actual cat. I have tested ​the model with the web interface ​by uploading pictures already taken, but most importantly I had to test the predictions with pictures ​from esp32 cameraWhat I did was to put my phone, which displayed ​picture ​of a cat and trigger the motion sensorSince the camera has quite low resolution, combined with the fact that the cat was presented on not-so-good screen, the predictions of the model were less accurate+  * Another useful functionality would be implementing a "​music-auto"​ mode where the behavior would altered ​by the input from a microphone. 
-  * The algorithm for cat detection used in the esp32 could still be improved. For example the esp may take multiple pictures when the motion sensor is triggered, in case the cat is not detected properly even if it was there. Also, it would be nice to provide our own classifier model and web interface, and not be reliant on Teachable Machine. +  * Hardware challenge: You need a lot of equipment ​to implement this project (as you can see I've used lot of wires)Also the ESP32'​s connections are faulty so you would have to either solder ​the wires or attach ​the ESP32 module to breadboard. Butonce the connections are stable, ​the satisfaction comes immediately
-  * The project is also dependent on stable WiFi connection. It would be nice if the esp32 saved the pictures in it's ram or on persistent storage and send them whenever a connection is available. Or, even better, use a SIM card for internet connectivity so the hardware could easily work outdoors. +  * //A dedicated program where the user can create ​schedule more easily. It would be also useful because ​the user will see the actual behavior before uploading ​the data to the Firebase DB.// 
-  * The board could also connect ​to the internet only periodically in order to conserve energy.+
 =====Conclusions===== =====Conclusions=====
-This project ​provides an easy way to control and monitor ​the behavior of your house petsAlthough here still is room for improvement the ease of setting up the project, ​and on the finesse of the detection algorithm, it provides ​a good basis for further developmentAll of the basic requirements are implemented and quite useful, requiring just a bit more polishingIn summarythis project ​integrates ​ robust web technologies and relatively cheap hardware in order to fulfill an useful task.+In this project ​I've managed ​to implement a small RGB Ledbar with functionalities similar to those available on the marketIt is an entertaining tool and a very good initial prototype ​for light show enthusiastsCertain refinements and tests need to be done to make the user experience as enjoyable as possibleOverallI consider the project to be a success:-)
 =====References===== =====References=====
-  * https://media.digikey.com/pdf/Data%20Sheets/DFRobot%20PDFs/DFR0602_Web.pdf +  * https://ocw.cs.pub.ro/courses/iothings/laboratoare/2022/lab3 
-  * https://​www.mpja.com/download/31227sc.pdf +  * https://ocw.cs.pub.ro/​courses/​iothings/​laboratoare/​2022/​lab4 
-  * https://teachablemachine.withgoogle.com/ +  * https://​www.browserstack.com/guide/build-a-website-using-html-css 
-  * https://firebase.google.com/docs/functions +  * https://www.arduino.cc/​reference/​en/​language/​functions/​random-numbers/​randomseed/​ 
-  * https://​www.tensorflow.org/js/tutorials+  * https://arduino.stackexchange.com/questions/​32739/​how-to-get-current-time-and-date-in-arduino-without-external-source 
 +  * https://forum.arduino.cc/t/ledc-libraries/​663747/​2 
 +  * https://​www.youtube.com/watch?​v=ZIj0aZyng1Q&​ab_channel=eurolitevideo
iothings/proiecte/2023/rgbledbar.1705377719.txt.gz · Last modified: 2024/01/16 06:01 by rares.niculescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0