This tutorial is part of: ESP32-S3 RGB LED 매트릭스
ESP32-S3 RGB 매트릭스 모듈을 활용한 재미있고 실용적인 프로젝트를 만들어 보세요. 다른 영상 링크는 이 글 아래에 있습니다.
ESP32-S3 RGB LED 매트릭스 인터넷 시계 프로젝트 - 2개의 시계 멀티 컬러 시간 및 날짜 표시
ESP32-S3 RGB 네오매트릭스 인터넷 시계 - 시간 및 날짜 표시
이 프로젝트는 향상된 ESP32-S3 RGB 매트릭스 인터넷 시계로, 현재 시간뿐만 아니라 주기적으로 날짜도 표시합니다. ESP32-S3는 Wi-Fi에 연결되고, NTP 서버에서 시간을 동기화하며, 8×8 RGB 네오매트릭스에 HH:MM 또는 날짜(예: SEP 21)를 스크롤하여 표시합니다. 디스플레이는 자동 주야간 밝기 제어와 사용자 지정 RGB 색상을 지원합니다.

이 시계의 기능
Wi-Fi 네트워크에 연결된 후, ESP32-S3는 인터넷에서 현재 현지 시간을 가져옵니다. 시계는 일반적으로 시간을 스크롤하지만, 고정된 간격으로 날짜 표시로 전환됩니다. 텍스트 색상은 단일 색상으로 고정하거나 여러 사용자 정의 색상을 자동으로 순환할 수 있습니다. 밝기는 야간에 자동으로 줄어들어 디스플레이가 눈에 부담을 덜 줍니다.
사용된 라이브러리
이 스케치는 다음 라이브러리에 의존합니다:

#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과 같은 모든 필수 종속성은 자동으로 설치됩니다.

중요한 사용자 설정
Wi-Fi SSID 및 비밀번호(대소문자 구분)
Wi-Fi 자격 증명을 자신의 네트워크 정보로 반드시 교체해야 합니다:

const char* WIFI_SSID = "WiFi";
const char* WIFI_PASSWORD = "passW0rd";
중요: Wi-Fi SSID는 대소문자를 구분합니다. 예를 들어, "Book"이라는 SSID는 "book"과 다릅니다. 대문자/소문자가 정확히 일치하지 않으면 ESP32는 연결에 실패합니다.
NTP 서버, 시간대 및 일광 절약 시간
시계는 인터넷 시간 서버를 사용합니다:
const char* ntpServer = "pool.ntp.org";
현지 시간은 다음 오프셋을 사용하여 계산됩니다:
const long gmtOffset_sec = -5 * 3600;
const int daylightOffset_sec = 3600;
gmtOffset_sec: UTC 오프셋(초 단위)(예: UTC-5 =-5 * 3600)daylightOffset_sec: DST 사용 시3600, DST 미사용 시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 색상은 배열에 저장됩니다:
uint8_t userColors[][3] = {
{17, 43, 171}, // 밝은 파란색
{255, 0, 0}, // 빨간색
{0, 255, 0}, // 초록색
{255, 165, 0}, // 주황색
{255, 0, 255} // 자홍색
};
각 색상은 0~255 범위의 RGB(빨강, 초록, 파랑) 값을 사용합니다. 이 숫자를 변경하면 디스플레이에 거의 모든 색상을 만들 수 있습니다. useFixedColor가 true로 설정되면 시계는 항상 하나의 색상을 사용합니다. false로 설정하면 각 전체 스크롤 후 색상이 자동으로 변경됩니다.
원하는 색상의 정확한 RGB 값을 빠르게 찾으려면 RGB 색상 선택 도구 색상 선택기 를 사용하세요.
시간 및 날짜 형식
시간은 HH:MM 형식으로 지정되어 작은 문자 버퍼에 저장됩니다. 날짜는 SEP 21과 같은 대문자 문자열로 형식화됩니다. 디스플레이는 고정된 간격으로 시간과 날짜 사이를 자동으로 전환합니다.
8×8 디스플레이의 스크롤 로직
8×8 매트릭스는 전체 텍스트를 한 번에 표시하기에는 너무 작기 때문에, 스케치는 텍스트를 가로로 스크롤합니다. 텍스트가 디스플레이에서 완전히 사라지면 색상이 업데이트되고 필요에 따라 시간과 날짜 사이에서 콘텐츠가 전환됩니다.
데모
스케치 업로드 후:
- ESP32가 Wi-Fi에 연결됩니다
- 시간이 인터넷에서 동기화됩니다
- 현재 시간이 매트릭스에 스크롤됩니다
- 날짜가 주기적으로 표시됩니다
- 밝기가 주야간에 따라 자동으로 조정됩니다
다운로드 및 링크
전체 소스 코드는 이 문서 아래에 제공됩니다. 부품, 도구 및 데이터시트 링크도 이 문서 아래에서 확인할 수 있습니다.
This tutorial is part of: ESP32-S3 RGB LED 매트릭스
- 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 매트릭스 인터넷 시계 프로젝트 - 날짜 포함 3가지 야간 색상
- ESP32-S3 RGB LED 매트릭스 인터넷 시계 프로젝트 - 5 무지개 색상
- ESP32-S3 RGB LED 매트릭스 인터넷 시계 프로젝트 - 4가지 랜덤 색상
- ESP32-S3 RGB LED Matrix test for RGB, GRB setting
/*
* =====================================================================================
* ESP32-S3 INTERNET RGB CLOCK (8x8 Matrix) - Project 2
Multi color
* =====================================================================================
watch video https://youtube.com/shorts/4iWjLiD7fS8
📚⬇️ Download and resource page https://robojax.com/RJT839
* Author: 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 when text finishes a full scroll.
* 3. Auto-Brightness: Dims the LEDs during night hours (User-configurable).
* 4. Periodic Date: Scrolls the date (e.g., "JAN 07") every 2 minutes.
* * USER CONFIGURATION GUIDE:
* -------------------------
* - WiFi: Change 'WIFI_SSID' and 'WIFI_PASSWORD' to your local network.
* - Colors: Add or remove {R, G, B} sets in the 'userColors' array.
* - Night Mode: Adjust 'NIGHT_START_HOUR' and 'NIGHT_BRIGHTNESS'.
* =====================================================================================
*/
#include <WiFi.h>
#include "time.h"
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#define MATRIX_PIN 14
// --- BRIGHTNESS CONFIGURATION ---
const int DAY_BRIGHTNESS = 40;
const int NIGHT_BRIGHTNESS = 5;
const int NIGHT_START_HOUR = 22;
const int NIGHT_END_HOUR = 6;
// --- COLOR CONFIGURATION ---
bool useFixedColor = false;
int fixedColorIndex = 0;
uint8_t userColors[][3] = {
{17, 43, 171}, // Light Blue
{255, 0, 0}, // Red
{0, 255, 0}, // Green
{255, 165, 0}, // Orange
{255, 0, 255} // Magenta
};
// 👇 REPLACE these with your real home WiFi name & password
const char* WIFI_SSID = "WiFi";
const char* WIFI_PASSWORD = "passW0rd";
int currentColorIndex = 0;
int totalColors = sizeof(userColors) / sizeof(userColors[0]);
// --- DATE/TIME INTERVALS ---
unsigned long lastDateShowMs = 0;
const uint32_t dateIntervalMs = 30000; // 2 minutes
unsigned long lastTimeUpdateMs = 0;
const uint16_t timeUpdateIntervalMs = 1000;
unsigned long lastScrollMs = 0;
const uint16_t scrollIntervalMs = 100;
// --- GLOBAL VARIABLES ---
Adafruit_NeoMatrix matrix(8, 8, MATRIX_PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE,
NEO_RGB + NEO_KHZ800);
char timeText[6] = "00:00";
char dateText[10] = "";
char currentDisplayText[12] = "";
int16_t scrollX = 8;
const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = -5 * 3600;
const int daylightOffset_sec = 3600;
void updateTimeAndDate() {
struct tm timeinfo;
if (!getLocalTime(&timeinfo)) return;
snprintf(timeText, sizeof(timeText), "%02d:%02d", timeinfo.tm_hour, timeinfo.tm_min);
strftime(dateText, sizeof(dateText), "%b %d", &timeinfo);
for (int i = 0; dateText[i]; i++) dateText[i] = toupper(dateText[i]);
if (timeinfo.tm_hour >= NIGHT_START_HOUR || timeinfo.tm_hour < NIGHT_END_HOUR) {
matrix.setBrightness(NIGHT_BRIGHTNESS);
} else {
matrix.setBrightness(DAY_BRIGHTNESS);
}
}
void scrollDisplay() {
matrix.fillScreen(0);
// FIXED LOGIC: Uses currentColorIndex which only changes at the end of a scroll
int idx = useFixedColor ? fixedColorIndex : currentColorIndex;
matrix.setTextColor(matrix.Color(userColors[idx][0], userColors[idx][1], userColors[idx][2]));
matrix.setCursor(scrollX, 0);
matrix.print(currentDisplayText);
matrix.show();
scrollX--;
int16_t textWidth = strlen(currentDisplayText) * 6;
// THE TRIGGER POINT: This happens only when text is fully off-screen
if (scrollX < -textWidth) {
scrollX = matrix.width();
// 1. Cycle the color now and only now
if (!useFixedColor) {
currentColorIndex = (currentColorIndex + 1) % totalColors;
}
// 2. Decide whether to switch between Time and Date
if (millis() - lastDateShowMs > dateIntervalMs) {
strcpy(currentDisplayText, dateText);
lastDateShowMs = millis();
} else {
strcpy(currentDisplayText, timeText);
}
}
}
void setup() {
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(DAY_BRIGHTNESS);
updateTimeAndDate();
strcpy(currentDisplayText, timeText);
}
void loop() {
unsigned long now = millis();
if (now - lastTimeUpdateMs >= timeUpdateIntervalMs) {
lastTimeUpdateMs = now;
updateTimeAndDate();
}
if (now - lastScrollMs >= scrollIntervalMs) {
lastScrollMs = now;
scrollDisplay();
}
}
필요할 수 있는 것들
-
아마존
-
이베이
-
알리익스프레스Purchase ESP32-S3 RGB Matrix from AliExpresss.click.aliexpress.com
-
알리익스프레스Purchase ESP32-S3 RGB Matrix from AliExpress (2)s.click.aliexpress.com
자원 및 참고자료
-
비디오
파일📁
프리징 파일
-
esp32-S3-supermini-tht fritzing part
esp32-S3-supermini-tht.fzpz0.02 MB