• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » ESP32 Neopixel Ring Clock

By Abhishek Ghosh October 20, 2023 7:46 pm Updated on October 20, 2023

ESP32 Neopixel Ring Clock

Advertisement

Previously we have published a few articles on Neopixel Ring, such as spindicator/chase effect with NeoPixel ring. Also, we have published one article on Get Time & Date From NTP Server (you can read about NTP server here).

If you combine these two principles, you can build a simple clock based around an ESP32 Arduino to fetch time from an NTP server and a Neopixel Ring to display hours, minutes and seconds. However, instead of the NTP library, we will use the TimeClient library. This library connects to the internet via WiFi and scrapes the header of Google’s default page to obtain the time from the header.

The original code was written by Mike McRoberts (on Hackster) for ESP8266 (his website thearduinoguy.org, his GitHub username thearduinoguy). I have modified it a bit to make it work for ESP32. This is the simplest method to get the clock but this has certain limitations. With this type of project, you can add a dynamic lighting on your analog clock, like the below image (you will probably use the hands in real life):

Advertisement

---

ESP32 Neopixel Ring Clock

 

Components and Libraries to Build ESP32 NeoPixel Ring Clock

 

You need an ESP32 development board, one 24 LED NeoPixel ring and a few jumper wires to connect ESP32 with the 24 LED NeoPixel ring. Your connection will be:

GND -> GND
3.3v -> Vin
Pin 23 -> DI

You need to install two libraries to get it correctly complied. From Arduino IDE, choose Sketch > Include Library > Manage Libraries. Search for “esp8266-weather-station” and install it. The TimeClient.h will be used from this library.

Then search for “json streaming parser” and install that library. JsonListener.h will be used from this library.

Below is the sketch for Arduino IDE:

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include
#include
#include "TimeClient.h"
 
#define PIN 23
long lastUpdate = millis();
long lastSecond = millis();
 
String hours, minutes, seconds;
int currentSecond, currentMinute, currentHour;
 
char ssid[] = "xxxx";  //  your network SSID (name)
char pass[] = "xxxx";       // your network password
 
// to set for India change zero to +0530
const float UTC_OFFSET = 0;
TimeClient timeClient(UTC_OFFSET);
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN);
 
void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println();
 
  strip.begin();
  strip.setBrightness(128);
  strip.show();
 
  // We start by connecting to a WiFi network
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, pass);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
 
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  timeClient.updateTime();
  updateTime() ;
  lastUpdate = millis();
  lastSecond = millis();
}
 
void loop()
{
  if ((millis() - lastUpdate) > 1800000) updateTime();
 
  if ((millis() - lastSecond) > 1000)
  {
    strip.setPixelColor(currentSecond / 2.5, 0, 0, 0);
    strip.setPixelColor(currentMinute / 2.5, 0, 0, 0);
    strip.setPixelColor(currentHour * 2, 0, 0, 0);
 
    strip.show();
    lastSecond = millis();
    currentSecond++;
    if (currentSecond > 59)
    { currentSecond = 0;
      currentMinute++;
      if (currentMinute > 59) {
        currentMinute = 0;
        currentHour++;
        if (currentHour > 12) currentHour = 0;
      }
    }
    String currentTime = String(currentHour) + ':' + String(currentMinute) + ':' + String(currentSecond);
    Serial.println(currentTime);
    
  strip.setPixelColor(currentSecond / 2.5, 0, 0, 255);
  strip.setPixelColor(currentMinute / 2.5, 0, 255, 0);
  strip.setPixelColor(currentHour * 2, 255, 0, 0);
    strip.show();
  }
}
 
void updateTime()
{
  hours = timeClient.getHours();
  minutes = timeClient.getMinutes();
  seconds = timeClient.getSeconds();
  currentHour = hours.toInt();
  if (currentHour >= 12) currentHour = currentHour - 12;
  currentMinute = minutes.toInt();
  currentSecond = seconds.toInt();
  lastUpdate = millis();
}

Tagged With givenii0
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to ESP32 Neopixel Ring Clock

  • WROOM ESP32 Example Codes For IBM Watson IoT Platform

    Here Are Few WROOM ESP32 Example Codes For IBM Watson IoT Platform So That Anyone Can Get Started With Both of Them Without Huge Experience.

  • Detect Smartwatch With ESP32 on IBM Watson IoT Widget

    In our previous guide, we have shown that we can trigger ESP32 (with Arduino IDE) to send message to IBM Watson IoT in Presence of a Particular Samsung Galaxy Smartwatch. That process involves BLE and WiFi. In our one series of articles on Samsung Smartwatch as Proximity Switch, we triggered a local event, such as […]

  • How to Control Multiple Relays With Single Arduino ESP32?

    Before How to Control Multiple Relays With Single Arduino ESP32 Testing, You Need to Learn How to Create Multiple MQTT Channels & Fetch Data.

  • Connecting ESP32 Arduino with DHT11 with IBM Watson IoT

    Earlier, we described how to create graph on IBM Watson IoT dashboard by using the default widgets. In previous guide, we described how to use ESP32 Arduino with DHT11 sensor. Here is the Code and Diagram to Connect ESP32 Arduino with DHT11 with IBM Watson IoT and Get Odometer Like Gauges on Dashboard. For this […]

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

vpsdime

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Cloud-Powered Play: How Streaming Tech is Reshaping Online GamesSeptember 3, 2025
  • How to Use Transcribed Texts for MarketingAugust 14, 2025
  • nRF7002 DK vs ESP32 – A Technical Comparison for Wireless IoT DesignJune 18, 2025
  • Principles of Non-Invasive Blood Glucose Measurement By Near Infrared (NIR)June 11, 2025
  • Continuous Non-Invasive Blood Glucose Measurements: Present Situation (May 2025)May 23, 2025
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2026 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy