This tutorial is part of: ESP32-S3 RGB LED Matrix
Cool project to create for fun and practical applications using ESP32-S3 RGB Matrix module. Links to other videos are below this article.
ESP32-S3 RGB LED મેટ્રિક્સ ઇન્ટરનેટ ઘડિયાળ પ્રોજેક્ટ - 4 રેન્ડમ રંગ
રેન્ડમ RGB રંગો સાથે ESP32-S3 ઇન્ટરનેટ ઘડિયાળ
આ પ્રોજેક્ટ એક ESP32-S3 RGB મેટ્રિક્સ ઇન્ટરનેટ ઘડિયાળ છે જે Wi-Fi સાથે કનેક્ટ થાય છે, NTP સર્વરથી સ્થાનિક સમય સિંક્રનાઇઝ કરે છે, અને બિલ્ટ-ઇન 8×8 RGB નિયોમેટ્રિક્સ પર HH:MM ફોર્મેટમાં સમય સ્ક્રોલ કરે છે. આ સંસ્કરણમાં, કલાકો, કોલોન અને મિનિટો દરેક રેન્ડમ રંગોમાં રેન્ડર થાય છે જે દરેક સંપૂર્ણ સ્ક્રોલ ચક્ર પર પસંદ કરવામાં આવે છે, જે ગતિશીલ અને રમતિયાળ ઘડિયાળ પ્રદર્શન બનાવે છે જે સતત બદલાતું રહે છે.

આ ઘડિયાળ કેવી રીતે કાર્ય કરે છે
USB-C દ્વારા બોર્ડને પાવર કર્યા પછી, ESP32-S3 તમારા Wi-Fi નેટવર્ક સાથે કનેક્ટ થાય છે અને ઇન્ટરનેટથી વર્તમાન સ્થાનિક સમય મેળવે છે. સમય ત્રણ ભાગોમાં વિભાજિત થાય છે—કલાકો, કોલોન અને મિનિટો—અને દરેક ભાગ RGB મેટ્રિક્સ પર અલગથી દોરવામાં આવે છે. જ્યારે ટેક્સ્ટ સ્ક્રીન પરથી સંપૂર્ણપણે સ્ક્રોલ થઈ જાય છે, ત્યારે આગલા પાસ માટે નવા રેન્ડમ રંગો પસંદ કરવામાં આવે છે.
ઉપયોગમાં લેવાયેલી લાઇબ્રેરીઓ
આ સ્કેચ નીચેની લાઇબ્રેરીઓનો ઉપયોગ કરે છે:

#include <WiFi.h>
#include "time.h"
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
Arduino લાઇબ્રેરી મેનેજરમાંથી Adafruit NeoMatrix ઇન્સ્ટોલ કરો. જરૂરી નિર્ભરતાઓ જેમ કે Adafruit GFX Library અને Adafruit NeoPixel આપમેળે ઇન્સ્ટોલ થશે.

મહત્વપૂર્ણ વપરાશકર્તા રૂપરેખાંકન
મેટ્રિક્સ ડેટા પિન (બિલ્ટ-ઇન RGB મેટ્રિક્સ)
જોકે RGB મેટ્રિક્સ બોર્ડ પર સંકલિત છે, ડેટા પિન હજુ પણ કોડમાં વ્યાખ્યાયિત થવી જોઈએ:

#define MATRIX_PIN 14
GPIO 14 સામાન્ય રીતે ESP32-S3 RGB મેટ્રિક્સ બોર્ડ પર ઉપયોગમાં લેવાય છે. જો તમારું બોર્ડ વેરિઅન્ટ અલગ પિનનો ઉપયોગ કરે છે, તો આ મૂલ્ય તે મુજબ અપડેટ કરો.
Wi-Fi SSID અને પાસવર્ડ (કેસ-સંવેદનશીલ)
Wi-Fi ઓળખપત્રોને તમારી પોતાની નેટવર્ક વિગતોથી બદલો:
const char* WIFI_SSID = "your WiFi SSID";
const char* WIFI_PASSWORD = "passW0rd";
મહત્વપૂર્ણ: Wi-Fi SSID કેસ-સંવેદનશીલ છે. "Book" નામનો SSID "book" જેવો નથી. જો મોટા અક્ષરો બરાબર મેળ ખાતા નથી, તો ESP32-S3 કનેક્ટ થવામાં નિષ્ફળ જશે.
NTP સર્વર, સમય ઝોન અને ડેલાઇટ સેવિંગ
સમય સિંક્રનાઇઝેશન ઇન્ટરનેટ NTP સર્વરનો ઉપયોગ કરીને કરવામાં આવે છે:
const char* ntpServer = "pool.ntp.org";
સ્થાનિક સમય UTC અને ડેલાઇટ સેવિંગ ઓફસેટ્સનો ઉપયોગ કરીને ગણવામાં આવે છે:
// ટોરોન્ટો-જેવું: UTC-5, વત્તા 1 કલાક DST
const long gmtOffset_sec = -5 * 3600;
const int daylightOffset_sec = 3600;
gmtOffset_sec: સેકંડમાં UTC ઓફસેટ (તમારા સ્થાન માટે સમાયોજિત કરો)daylightOffset_sec: જ્યારે DST સક્રિય હોય ત્યારે3600વાપરો, અન્યથા0
આ સેટિંગ્સ આનો ઉપયોગ કરીને લાગુ કરવામાં આવે છે:
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
સ્વચાલિત દિવસ / રાત્રિ તેજ
ઘડિયાળ વર્તમાન કલાકના આધારે આપમેળે તેજ સમાયોજિત કરે છે:
const int DAY_BRIGHTNESS = 40;
const int NIGHT_BRIGHTNESS = 5;
const int NIGHT_START_HOUR = 22;
const int NIGHT_END_HOUR = 6;
રાત્રે 10 વાગ્યાથી સવારે 6 વાગ્યાની વચ્ચે, ઘેરા વાતાવરણમાં ઝગમગાટ ઘટાડવા માટે ડિસ્પ્લે ઝાંખું થાય છે. દિવસના સમય દરમિયાન, મેટ્રિક્સ સામાન્ય તેજ પર પાછું આવે છે.
રેન્ડમ RGB રંગ વર્તન
RGB રંગોની પૂર્વવ્યાખ્યાયિત સૂચિ એરેમાં સંગ્રહિત છે, જ્યાં દરેક રંગ 0 થી 255 સુધીના લાલ, લીલા અને વાદળી મૂલ્યોનો ઉપયોગ કરીને વ્યાખ્યાયિત થાય છે:
uint8_t userColors[][3] = {
{255, 0, 0}, // લાલ
{0, 255, 0}, // લીલો
{0, 0, 255}, // વાદળી
{255, 165, 0}, // નારંગી
{255, 0, 255}, // મેજેન્ટા
{0, 255, 255}, // સ્યાન
{255, 255, 0} // પીળો
};
દરેક સંપૂર્ણ સ્ક્રોલ ચક્ર પર:
- કલાકના અંકોને રેન્ડમ રંગ સોંપવામાં આવે છે
- કોલોનને અલગ રેન્ડમ રંગ મળે છે
- મિનિટના અંકોને બીજો રેન્ડમ રંગ મળે છે
આ સતત બદલાતું રંગ સંયોજન ઉત્પન્ન કરે છે જે ઘડિયાળને દૃષ્ટિની રસપ્રદ રાખે છે. તમારા પોતાના કસ્ટમ રંગો બનાવવા માટે, તમે RGB કલર પિકર ટૂલનો ઉપયોગ કરી શકો છો: RGB કલર પિકર.
સમય રેન્ડરિંગ તર્ક
સમય ત્રણ ઘટકોમાં વિભાજિત થાય છે:
- કલાકો:
HH - કોલોન:
: - મિનિટો:
MM
દરેક ભાગ અલગથી દોરવામાં આવે છે જેથી તેનો પોતાનો રંગ હોઈ શકે, જ્યારે બધા ભાગો 8×8 ડિસ્પ્લે પર સરળ સ્ક્રોલિંગ એનિમેશન બનાવવા માટે સાથે ખસે છે.
રેન્ડમ રંગ પેદા કરવો
રંગની રેન્ડમનેસ સુનિશ્ચિત કરવા માટે, સ્કેચ શરૂઆતમાં અનકનેક્ટેડ એનાલોગ પિનનો ઉપયોગ કરીને રેન્ડમ નંબર જનરેટરને સીડ કરે છે:
randomSeed(analogRead(0));
આ સુનિશ્ચિત કરે છે કે દરેક પાવર-અપ અને દરેક સ્ક્રોલ ચક્ર પર રંગ સંયોજનો અલગ હોય છે.
પ્રદર્શન
સ્કેચ અપલોડ કર્યા પછી અને USB-C દ્વારા બોર્ડને પાવર કર્યા પછી:
- ESP32-S3 તમારા Wi-Fi નેટવર્ક સાથે કનેક્ટ થાય છે
- સમય ઇન્ટરનેટથી સિંક્રનાઇઝ થાય છે
- સમય
HH:MMફોર્મેટમાં સ્ક્રોલ થાય છે - કલાકો, કોલોન અને મિનિટો દરેક ચક્રમાં રેન્ડમ રંગોમાં બદલાય છે
- ડિસ્પ્લે રાત્રે આપમેળે ઝાંખું થાય છે
ડાઉનલોડ્સ અને લિંક્સ
આ લેખની નીચે સંપૂર્ણ સ્ત્રોત કોડ આપવામાં આવ્યો છે. ઉપયોગી સાધનો અને સંદર્ભો આ લેખની નીચે લિંક કરવામાં આવ્યા છે.
This tutorial is part of: ESP32-S3 RGB LED Matrix
- ESP32-S3 RGB LED મેટ્રિક્સ પ્રોજેક્ટ 1- મૂળભૂત ડોટ
- ESP32-S3 RGB LED મેટ્રિક્સ પ્રોજેક્ટ 2 - સ્ક્રોલિંગ ટેક્સ્ટ
- ESP32-S3 RGB LED મેટ્રિક્સ પ્રોજેક્ટ 3 - મોબાઇલ ફોનમાંથી ટેક્સ્ટ
- ESP32-S3 RGB LED મેટ્રિક્સ પ્રોજેક્ટ 4 - ટિલ્ટ ડોટ
- ESP32-S3 RGB LED મેટ્રિક્સ પ્રોજેક્ટ 5 - તીર હંમેશા ઉપર
- ESP32-S3 RGB LED મેટ્રિક્સ પ્રોજેક્ટ 6 - સિબલે ગેમ
- ESP32-S3 RGB LED મેટ્રિક્સ Wi-Fi + NTP સમય ઘડિયાળ પ્રોજેક્ટ -1 મૂળભૂત ઘડિયાળ
- ESP32-S3 RGB LED મેટ્રિક્સ ઇન્ટરનેટ ઘડિયાળ પ્રોજેક્ટ - 2 ઘડિયાળ બહુ રંગીન સમય અને તારીખ પ્રદર્શન
- ESP32-S3 RGB LED મેટ્રિક્સ ઇન્ટરનેટ ઘડિયાળ પ્રોજેક્ટ - તારીખ સાથે 3 રાત્રિ રંગ
- ESP32-S3 RGB LED મેટ્રિક્સ ઇન્ટરનેટ ઘડિયાળ પ્રોજેક્ટ - 5 મેઘધનુષ્ય રંગ
- ESP32-S3 RGB LED Matrix test for RGB, GRB setting
/*
* =====================================================================================
* ESP32-S3 INTERNET RGB CLOCK (8x8 Matrix) - Project 4- Random Color
* =====================================================================================
watch video https://youtube.com/shorts/4iWjLiD7fS8
📚⬇️ Download and resource page https://robojax.com/RJT843
* Author: Gemini (AI Thought Partner) & Ahmad Shamshiri (Robojax.com)
* Date: 07 Jan 2026
* * FEATURES:
* 1. WiFi/NTP Time: Syncs automatically with internet time servers.
* 2. Cycle-Based Color: Color changes ONLY after the time finishes a full scroll.
* 3. Auto-Brightness: Dims the LEDs during night hours (User-configurable).
* =====================================================================================
*/
/*
* =====================================================================================
* ESP32-S3 INTERNET CLOCK - MULTI-COLOR ELEMENTS
* =====================================================================================
* Each part of the time (HH : MM) gets a different random color from your list.
* Colors only change once the full scroll cycle is finished.
* =====================================================================================
*/
#include <WiFi.h>
#include "time.h"
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#define MATRIX_PIN 14
// --- CONFIGURATION ---
const int DAY_BRIGHTNESS = 40;
const int NIGHT_BRIGHTNESS = 5;
const int NIGHT_START_HOUR = 22;
const int NIGHT_END_HOUR = 6;
uint8_t userColors[][3] = {
{255, 0, 0}, // Red
{0, 255, 0}, // Green
{0, 0, 255}, // Blue
{255, 165, 0}, // Orange
{255, 0, 255}, // Magenta
{0, 255, 255}, // Cyan
{255, 255, 0} // Yellow
};
int totalColors = sizeof(userColors) / sizeof(userColors[0]);
// Variables to store the current random color indices
int hourColorIdx = 0;
int colonColorIdx = 1;
int minColorIdx = 2;
// --- GLOBALS ---
Adafruit_NeoMatrix matrix(8, 8, MATRIX_PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE,
NEO_RGB + NEO_KHZ800);
char hourText[3], minText[3];
int16_t scrollX = 8;
unsigned long lastScrollMs = 0;
const uint16_t scrollIntervalMs = 100;
// 👇 REPLACE these with your real home WiFi name & password
const char* WIFI_SSID = "your WiFi SSID";
const char* WIFI_PASSWORD = "passW0rd";
// NTP (time) server
const char* ntpServer = "pool.ntp.org";
// Toronto-ish: UTC-5, plus 1 hour DST
const long gmtOffset_sec = -5 * 3600; // -5 hours
const int daylightOffset_sec = 3600; // +1 hour for DST
void updateTimeParts() {
struct tm timeinfo;
if (!getLocalTime(&timeinfo)) return;
snprintf(hourText, sizeof(hourText), "%02d", timeinfo.tm_hour);
snprintf(minText, sizeof(minText), "%02d", timeinfo.tm_min);
if (timeinfo.tm_hour >= NIGHT_START_HOUR || timeinfo.tm_hour < NIGHT_END_HOUR) {
matrix.setBrightness(NIGHT_BRIGHTNESS);
} else {
matrix.setBrightness(DAY_BRIGHTNESS);
}
}
void scrollTime() {
matrix.fillScreen(0);
int x = scrollX;
// 1. Draw Hours
matrix.setTextColor(matrix.Color(userColors[hourColorIdx][0], userColors[hourColorIdx][1], userColors[hourColorIdx][2]));
matrix.setCursor(x, 0);
matrix.print(hourText);
x += 12; // Move 12 pixels (2 digits * 6px)
// 2. Draw Colon
matrix.setTextColor(matrix.Color(userColors[colonColorIdx][0], userColors[colonColorIdx][1], userColors[colonColorIdx][2]));
matrix.setCursor(x, 0);
matrix.print(":");
x += 6; // Move 6 pixels
// 3. Draw Minutes
matrix.setTextColor(matrix.Color(userColors[minColorIdx][0], userColors[minColorIdx][1], userColors[minColorIdx][2]));
matrix.setCursor(x, 0);
matrix.print(minText);
matrix.show();
scrollX--;
// Total width is roughly 30 pixels (HH=12, :=6, MM=12)
if (scrollX < -30) {
scrollX = matrix.width();
// Pick NEW random colors for the next cycle
hourColorIdx = random(0, totalColors);
colonColorIdx = random(0, totalColors);
minColorIdx = random(0, totalColors);
}
}
void setup() {
Serial.begin(115200);
// Seed the random generator using an unconnected analog pin
randomSeed(analogRead(0));
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) delay(500);
// Configure time via NTP
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
Serial.println("Waiting for time...");
delay(2000); // small wait for initial sync
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(DAY_BRIGHTNESS);
}
void loop() {
if (millis() % 1000 == 0) updateTimeParts();
if (millis() - lastScrollMs >= scrollIntervalMs) {
lastScrollMs = millis();
scrollTime();
}
}
Resources & references
-
Video
-
Internal🎨 Color picker Toolrobojax.com
Files📁
Fritzing File
-
esp32-S3-supermini-tht fritzing part
esp32-S3-supermini-tht.fzpz0.02 MB