Building a Smart RGB Clock with Arduino
In today's digital age, clocks have gone beyond mere timekeepers; they have become statement pieces that blend functionality with artistry. In this extensive 1500-word article, we will embark on an exciting journey to create a Smart RGB Clock using an Arduino Nano and custom-made WS2812B LED segment displays. This project is more than just a time-telling device; it's a blend of creativity, precision, and practicality. We will also explore how to integrate a Real-Time Clock (RTC) module, a Li-ion battery, a TP4056 Li-ion charging module, and a boost converter module, making it a unique and fully functional piece of art.
IntroductionClocks, despite their ubiquity, hold a special place in our lives. They are more than just tools for telling time; they can be symbols of style and innovation. In this project, we'll delve into the world of DIY electronics to create a Smart RGB Clock that not only tells time but also captivates with its visually stunning and customizable display.
Before we dive into the details, let's take a comprehensive look at the components required for this project:
1.Arduino Nano: The brain behind our clock, is responsible for processing and displaying time.
2.WS2812B LEDs: These individually addressable RGB LEDs will serve as the building blocks of our custom-made displays.
3.Real-Time Clock (RTC) Module: To ensure the clock maintains accurate timekeeping even when disconnected from power.
4.480mAh Li-ion Battery: To make the clock portable, allowing it to be placed anywhere in your home.
5.TP4056 Li-ion Charging Module: This module facilitates easy recharging of the Li-ion battery, ensuring your clock remains functional without interruption.
6.Boost Converter Module: The Arduino Nano requires more than the 3.7V output from the Li-ion battery, so a boost converter is essential to provide the necessary voltage.
7.Custom-Made PCBs: Thanks to the sponsorship from PCBWay, you can create professional-looking custom PCBs for a neat and organized assembly.
8. Female Burge Strip
9. SPST Switch
Building the Custom Segment Displays-The standout feature of our Smart RGB Clock project is the custom-made segment displays created using WS2812B LEDs. These displays not only show the time but also add a mesmerizing multi-color changing effect, making the clock visually appealing and a true conversation starter.
The process of building these displays involves designing a custom PCB that accommodates the WS2812B LEDs in the desired segment layout. This step is crucial to achieving the aesthetics and functionality we desire.
First, we will assemble our top layer and then we will assemble our bottom layer. In the top layer, PCB we will solder all 4 seven segment displays and then we will assemble the bottom layer.
Let's assemble our TOP layer -
In the uppermost layer of the project, I have assembled all 7-segment displays obtained from " PCBWAY". Now, we are ready to integrate four 7-segment displays featuring the WS2812B LEDs. The next step involves soldering these four 7-segment displays onto the top layer of the PCB. Once this soldering process is complete, our top layer will be fully prepared.
You can download the Gerber files below
TOP & Bottom Layer -
7 Segment Display -
Order your custom PCB form " PCB WAY " for just 5$ Join through my link and you will get a 5$ coupon - https://pcbway.com/g/02DtWI
Let's assemble our Bottom layer -
In the bottom layer PCB, we encounter the crux of our project, where we must incorporate a multitude of components including the Arduino Nano, RTC module, boost converter module, TP4056 charging module, and Li-ion battery.
To begin the assembly, I will first solder the female header pins. Once those are securely in place, I will proceed to solder the TP4056 charging module, followed by the addition of the boost converter module. Before soldering the boost converter module, it's important to configure the output voltage to 5.3 volts, which is the optimal voltage for the operation of the Arduino Nano.
After these critical components are in position, I will proceed to solder the remaining elements such as the battery connector and switches. With these components firmly attached, I will carefully insert the Arduino Nano and RTC modules into their designated spots.
The next step involves connecting the top layer PCB to the bottom layer PCB. This connection is facilitated by three wires: one for VCC, one for ground (GND), and one for data transfer.
With the physical assembly complete, it is now time to program our Arduino Nano.
Code -#include <FastLED.h>
#include <DS3231.h>
#include <Wire.h>
#define NUM_LEDS 56
#define DATA_PIN 6
CRGB leds[NUM_LEDS];
DS3231 rtc;
const int TOTAL_SEGMENTS = 4;
const int LEDS_PER_SEGMENT = 14;
const int DISPLAY_SEGMENT[] = {14 * 3, 14 * 2, 0, 14};
const int DISPLAY_NUMBER[][14] = {
{true, true, true, true, true, true, true, true, true, true, true, true, false, false}, // 0 Number
{false, false, true, true, true, true, false, false, false, false, false, false, false, false}, // 1 Number
{true, true, true, true, false, false, true, true, true, true, false, false, true, true}, // 2 Number
{true, true, true, true, true, true, true, true, false, false, false, false, true, true}, // 3 Number
{false, false, true, true, true, true, false, false, false, false, true, true, true, true}, // 4 Number
{true, true, false, false, true, true, true, true, false, false, true, true, true, true}, // 5 Number
{true, true, false, false, true, true, true, true, true, true, true, true, true, true}, // 6 Number
{true, true, true, true, true, true, false, false, false, false, false, false, false, false}, // 7 Number
{true, true, true, true, true, true, true, true, true, true, true, true, true, true}, // 8 Number
{true, true, true, true, true, true, true, true, false, false, true, true, true, true}, // 9 Number
};
CRGB yellowColor = CRGB(255, 248, 9);
void setup() {
Serial.begin(9600);
Serial.println("Starting execution");
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
FastLED.setBrightness(30);
Wire.begin();
// Lines can be uncommented to set the date and time
rtc.setHour(00); // 24hr format
rtc.setMinute(15); // Set the minute
}
void loop() {
bool h12, pm;
int hour = rtc.getHour(h12, pm);
int minute = rtc.getMinute();
int hourFirstDigit = hour / 10;
int hourSecondDigit = hour % 10;
int minuteFirstDigit = minute / 10;
int minuteSecondDigit = minute % 10;
int totalDelay = 0;
while (totalDelay < 10000) {
FastLED.clear();
displayNumber(2, hourFirstDigit, yellowColor);
displayNumber(3, hourSecondDigit, yellowColor);
displayNumber(1, minuteFirstDigit, yellowColor);
displayNumber(0, minuteSecondDigit, yellowColor);
FastLED.show();
delay(10);
totalDelay += 10;
}
}
void displayNumber(int segment, int number, CRGB color) {
for (int j = 0; j < LEDS_PER_SEGMENT; j++) {
if (DISPLAY_NUMBER[number][j]) {
leds[DISPLAY_SEGMENT[segment] + j] = color;
}
}
}
Testing -After successfully uploading the code to the Arduino Nano, our DIY 7-segment table clock is now ready for testing. But before we proceed with the testing phase, we need to securely connect both PCBs using M3 spacers for stability and alignment.
With both layers securely fastened together, our clock is now primed for testing. Let's proceed and put it to the test.
So here are the results -
Here is the link - Watch the full video click here
Comments