LUMINOIR (Smart Decorative Lamp)
by stefanusnahar in Circuits > Arduino
189 Views, 2 Favorites, 0 Comments
LUMINOIR (Smart Decorative Lamp)
LUMINOIR is a smart decorative lamp that can be controlled via our mobile application and has an OLED to display date-time, temperature, and humidity. We used RGB LEDs so they could emit light onto the epoxy resin; that says 'CE25' which means Computer Engineering Batch 25. There are two buttons in our product: the first button for turning on and off the RGB strip, and the second button for changing the OLED display. Our product connected to the RTDB Google Firebase from the ESP32 via WiFi, and Flutter controlled the Boelan value of RGB mode in Google Firebase.
This project was created by:
- Dean Marcello, 2502036086
- Jansen Nathanael, 2501960114
- Stefanus Nahar, 2540128266
Our smart decorative lamps blend aesthetics with functionality. Utilizing a microcontroller and Android app, they offer convenient remote control for personalized lighting. With a spectrum of color options, these lamps enhance the ambiance based on user preferences. Additionally, integrated temperature and humidity sensors are important for monitoring a healthy and safe environment, particularly in spaces prone to humidity and extreme temperatures. You can use this product as a nightlight or decorative light on your table.
Evaluation of our product design:
- The hole for the power and terminal blocks on the PCB casing should be minimized.
- The hole for the AHT10 should be expanded to enhance data collection efficiency.
- The dimensions of the wooden box could be decreased for a neater appearance.
- Use more gradient colors for the duct tape that harmonize with the wooden tones.
- Added more RGB light modes.
Conclusion:
The smart decorative lamp seamlessly integrates with a Flutter application, allowing users to control LED color modes, toggle the LED on/off and access real-time temperature and humidity data from the AHT10 sensor. The OLED display on the lamp accurately reflects time and date information, ensuring a cohesive and reliable user experience across both the lamp and the Android app.
Here's our link for the demo project: https://drive.google.com/file/d/1IWHFV5pAwE6zcyA8KLRQew6Zv_78yM7A/view?usp=sharing
Reference:
- https://randomnerdtutorials.com/guide-for-oled-display-with-arduino/
- https://www.youtube.com/watch?v=DKXi1491et8
- https://youtu.be/IEUBq_AikAo?si=A7xrnoLSHGpoSwV5
Supplies
Hardware Supplies:
- 1x ESP32 DEVKIT V1
- 1x RGB Smart LED Strip WS2812B 15cm
- 1x AHT10 High Precision Digital Temperature and Humidity Sensor I2C Module
- 1x LCD OLED 0.96-inch 128x64-pixel WHITE I2C Modul Display v1.2
- 1x 5v 2A Head Charger Adapter
- 1x 1m USB type A to micro USB
- 2x Resistor, 1K Ohm, 0.25 W, 5%
- 2x Tactile Switch 12 x 12 mm Push Button (cap button included)
- 2x Long Stackable Header, 15-Pin, 2.54mm Pitch
- 6x Terminal Block 2-pin
- 7x Jumper Cable, Male-to-Male
- 8x Jumper Cable, Male-to-Female
Software Supplies:
- Visual Studio Code (Platform.io, C++, and Flutter/Dart extensions included)
- MinGW C++ Compiler
- Google Firebase RTDB
- EasyEDA
- Autodesk Fusion360
Other:
- 1x Plain PCB
- Wood Planks
- Epoxy Resin + Harderener
- Sufficient Duct Tape
Optional:
- Any kind of stickers and knick-knack
Design the Electrical Circuit
We utilize an adapter cable to seamlessly connect to the micro USB port on the ESP32, serving as the primary power source. To establish a clean and effective connection, we use a terminal block that links various components, such as the RGB strip, OLED display, AHT10 sensor, and buttons, to the PCB. For the power distribution, we use Vin (5v) on the ESP32 as the central power source for all components.
The RGB strip data is then directed into IO13, facilitating smooth communication and controlling the RGB color.
For the AHT10 and OLED components, we employ the I2C protocol for efficient data transfer. SDA and SCL are appropriately connected to IO21 and IO22, respectively, ensuring synchronized and reliable communication between these vital elements of our system.
To facilitate user interaction, buttons are integrated into the design. The LED button seamlessly interfaces with IO12, while the OLED button is connected to IO14. This thoughtful input/output pin allocation ensures that the user interface remains intuitive and responsive. We add a pull-down resistor of 1kΩ between the IO and GND. This resistor ensures that the IO pin has a defined voltage level when the button is not pressed.
P.S. For AHT10 and OLED, we use another GND of ESP32 to simplify the PCB circuit.
Convert the Circuit Into PCB
After converting schematics to PCB in EasyEDA, make the size of the PCB around 6x6.5 cm. Arrange all the components efficiently, and set the PCB track width to 1.5 mm for the power (VCC and GND) and 1 mm for the data (I2c track and data input), as the PCB track will be the bottom layer. You can route by yourself or by auto-routing the components from the software. To prevent short circuits (VCC lines colliding with the ground), ensure that the PCB lines are spaced widely apart.
Downloads
Creating & Uploading the Hardware Code
For the ESP32 code, we use platform.io in Visual Studio Code and the C++ language.
Here's a brief explanation of the code:
We use various libraries for the specific tools we employ.
For the WS2812b LED strip, we utilize the FastLED library. The LED configuration programming includes features like turning on and off and changing colors. We employ separate functions for different colors, such as void blueMode, turnOffLEDs, turnOnLEDs, and so on.
For the AHT10 temperature and humidity sensor, we use the Adafruit_AHTX0 library, and the programming involves a function called readAHTSensor to capture room temperature and humidity. Both the AHT10 sensor and OLED use I2C, requiring the Wire.h library. The OLED programming involves the Adafruit_SSD1306 library. The OLED displays time, date, temperature, and humidity, and the OLED functions are embedded within other functions, such as readAHTSensor, which includes display.display() to show temperature and humidity on the OLED. The OLED also displays a real-time date and time. We use the NTPClient library to get real-time date and time information, programmed through the void showTime() function. This function displays the date and time in the specified format on the OLED and includes a switch between a sun and moon logo indicated in the if-else statements.
In our programming, the display changes to a moon logo, indicating nighttime starting from 6:00 PM, as shown in the bool isMorning... line. We also use a button to switch modes displayed on the OLED. This is evident in the buttonState OLED line. If the button is pressed once, the display changes to show the time and date, and if pressed again, it returns to showing temperature and humidity. This is represented in the if-else statement for buttonState, where if (OLEDshow) runs the readAHTSensor function, else runs the showTime function.
We integrate Firebase into our programming to configure the LED strip and capture data from the AHT10 temperature sensor. The onFirebaseStream function invokes a callback when new data is received from Firebase. This function extracts information from the incoming data, such as modePath, data type, and payload. The data path is then used to determine the requested LED mode, and the mode status is determined from the payload. The modePath used in this programming is a boolean, either true or false, to enable or disable a function in Firebase.
In the loop, a section reads data from the AHT10 sensor every second. After reading temperature and humidity values, this function updates the values in the Firebase RTDB at streampath /sensors/temperature and /sensors/humidity. The streampath in both onFirebaseStream and sensors allows the Flutter application we developed to connect to the same Firebase project and access real-time sensor data.
Here's our link code: https://github.com/deathlxst/smart-epoxy.git
Setup Google Firebase
Make sure to connect your selected email to Google Firebase and then,
- Login to the Firebase console.
- Create a new project and enter a name.
- Create a database, initialize data, and set rules to true.
- Create storage, create an images folder, and set rules to true.
- Don't forget to create the LED_mode and the key (white mode, etc.), and set the key value to boolean.
Here you go; the Firebase setup is done.
Create 3D Printing Case
We use 3D printing with PLA material for the PCB casing. The dimensions are customized to fit the PCB (60 x 65 mm) with a 1 mm gap on each side, and the thickness for this case was around 5 mm. The casing is sealed with bolts; that's why we created the bolt hole in four corners, around 2.8 mm. On the back side, there are holes for a power source cable measuring 30 x 15 mm. The holes on the left and right sides measure 60 x 13 mm for all the components, like AHT10 cables, OLED cables, button cables, and RGB strip cables.
Below is the link to the STL of our PCB case:
Downloads
Create the Wood Case
For the overall case, we use wood planks measuring 30 x 9 cm for the top, bottom, front, and back sides. The right and left sides are sized at 9 x 9 cm. On the front side, we create one rectangular hole for the OLED display and two round holes for the buttons. On the back side, we cut around 7.3 x 5 cm (the size is the same as the back of the PCB case) and drilled a tiny hole for the AHT10 sensor. After drilling and sanding the wood, we apply a cream-colored Pylox spray paint. To assemble the pieces of wood, we use wood glue. We put the PCB case in the middle of inside the wood case Lastly, cover it with masking tape to achieve a neater appearance, and you can add a sticker to make the wood case cooler.
Create the "CE25" Epoxy Resin
In making "CE25" resin, we used 437 mL of epoxy resin mixed with 137 mL of harderener and then poured it into the mold. In the epoxy, before it dries, we put in the knick-knack decorations. Then wait 24 hours to dry completely. After drying, we sanded the resin to make it shiny.
Create App
For our Android application, we utilize Flutter for its development. The primary feature of the application is to control the colors of our smart decorative lamp. The app includes eight pre-programmed color presets, and users simply need to tap on one of the color icons to change the lamp's color. Above these color icons, there is a preview section to visualize the selected color for the lamp. In terms of navigation features, our application seamlessly transitions to the next frame based on user actions, such as turning on/off the lamp or changing its color.
On the backend side, we integrate Google Firebase to capture real-time data from the Firebase Realtime Database (RTDB). The data captured from Google Firebase includes changes in each color as well as the on/off status of the lamp. Beyond the configuration features for the decorative lamp, we have added some additional functionalities, such as displaying a real-time clock and temperature/humidity information. For temperature and humidity, we leverage Google Firebase to retrieve data from the AHT10 temperature sensor we use. To showcase real-time clock information, we employ the "intl" Flutter package, which provides advanced date and time formatting capabilities, allowing us to display accurate real-time information in our local region.
Here's our link code: https://github.com/deathlxst/smart_decorative_lamp_android.git