Marius M
ROMANIA • + Follow
Edit Project
Description
ESP01 - TM1637 NTP CLOCK
Basic PCB backplate board for a 0.56" display, that uses an ESP01 /ESP01S to get NTP Time and display it.
Sketch code is a little bit messy because is still in progress, but it gets the job done. Just make sure you have all the libraries installed.
Make sure you solder the desired jumper option to provide 3.3V or 5V to the display (i used 3.3V so the display can be as dim as possible).
If you want to print the support, make sure you have 4 x M3 insert nuts.
Code
ESP01 - TM1637 NTP Time - autoupdate
C/C++
#include <Arduino.h>
#include "TM1637.h"
#include <NTPClient.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <Timezone.h>
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
#include <ThingSpeak.h>
//pins definitions for TM1637 and can be changed to other ports
#define CLK 2 // 2 for esp-01 (12 for D1 mini)
#define DIO 0 // 0 for esp-01 (14 for D1 mini)
#define UPDATE 3000 // ms for updating screen
//const char *ssid = "xxxxxxx"; //your SSID
//const char *password = "xxxxxxx"; //your password
int status = WL_IDLE_STATUS;
WiFiClient client;
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "ro.pool.ntp.org", 0 /*10800 seconds for summer time, 7200 winter time*/, 60000); //NTPClient(UDP& udp, const char* poolServerName, int timeOffset, int updateInterval);
TM1637 tm1637(CLK, DIO);
bool points = true;
uint32_t time1, time2;
time_t local, utc;
String h, m;
WiFiManager wm;
uint8_t NumTab[] = { 1, 9, 2, 0xff, 1, 6, 8, 0xff, 4, 0xff, 1, 0xff, 0xff, 0xff, 0xff, 0xff }; // 192.168.4.1
uint8_t ListDisp[4];
unsigned char i = 0;
unsigned char count = 0;
void setup() {
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
Serial.begin(115200);
wm.setConfigPortalBlocking(false);
tm1637.init();
tm1637.set(0); //set the brightness DARKEST = 0, BRIGHTEST = 7
timeClient.begin();
//WiFi.begin(ssid, password);
///////reset settings - wipe credentials FOR TESTING
//wm.resetSettings();
wm.autoConnect("NTP_CLOCK_TM1637", "password#123"); // connect to 192.168.4.1 to configure WiFi
}
void loop(void) {
wm.process();
if (WiFi.status() != WL_CONNECTED) {
i = count;
count++;
if (count == sizeof(NumTab)) count = 0;
for (unsigned char BitSelect = 0; BitSelect < 4; BitSelect++) {
ListDisp[BitSelect] = NumTab[i];
i++;
if (i == sizeof(NumTab)) i = 0;
}
tm1637.display(0, ListDisp[0]);
tm1637.display(1, ListDisp[1]);
tm1637.display(2, ListDisp[2]);
tm1637.display(3, ListDisp[3]);
delay(300);
}
else {
timeClient.update();
unsigned long epochTime = timeClient.getEpochTime();
// convert received time stamp to time_t object
utc = epochTime;
// Then convert the UTC UNIX timestamp to local time
TimeChangeRule EEST = { "EEST", Last, Sun, Mar, 3, 180 }; //Ora de vara - //Central European Time (Frankfurt, Paris) *Sun, 2*
TimeChangeRule EET = { "EET", Last, Sun, Oct, 4, 120 }; //Ora de iarna - Central European Time (Frankfurt, Paris)
Timezone EE(EEST, EET);
local = EE.toLocal(utc);
displayTime();
delay(UPDATE);
}
}
void displayTime() {
//////// reduce brightness at night time (between 19:00 and 07:00)
tm1637.point(POINT_ON); //turn points on
if (hour(local) >= 19 || hour(local) <= 7) {
tm1637.set(1);
} else {
tm1637.set(7);
}
////////// "compose" time as String and display it
h = "";
// format the time to 12-hour format with AM/PM and no seconds
if (hour(local) < 10) // add a space if hour is under 10
h += "0";
h += hour(local);
int digitoneH = h.toInt() / 10;
int digittwoH = h.toInt() % 10;
tm1637.display(0, digitoneH);
tm1637.display(1, digittwoH);
//t += ":"; // colon is handled in display
m = "";
if (minute(local) < 10) // add a zero if minute is under 10
m += "0";
m += minute(local);
int digitoneM = m.toInt() / 10;
int digittwoM = m.toInt() % 10;
tm1637.display(2, digitoneM);
tm1637.display(3, digittwoM);
Serial.print("Time is: ");
Serial.print(digitoneH);
Serial.print(digittwoH);
Serial.print(":");
Serial.print(digitoneM);
Serial.println(digittwoM);
}
CAD-Custom parts and enclosures
Dec 26,2023
977 views
ESP01 - TM1637 NTP CLOCK
Basic ESP01 NTP clock with a 0.56'' TM1537 7 segments display.
977
1
0
Published: Dec 26,2023
BOM(Bill of materials)
Purchase
Donation Received ($)
PCBWay Donate 10% cost To Author
Only PCB
PCB+Assembly
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
Copy this HTML into your page to embed a link to order this shared project
Copy
Under the
Attribution-ShareAlike (CC BY-SA)
License.
- Comments(0)
- Likes(1)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
It looks like you have not written anything. Please add a comment and try again.
You can upload up to 5 images!
Image size should not exceed 2MB!
File format not supported!
View More
- Mr. Marsupial Mar 06,2024
View More
VOTING
0 votes
- 0 USER VOTES
0.00
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Design
1/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Usability
2/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Creativity
3/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Content
4/4
More by Marius M
- PCB Christmas Star 2024 - PCBWay Edition PCB Christmas Star 2024 - PCBWay EditionBring a festive sparkle to your celebrations with this delig...
- PCB Christmas Star 2024 -1 Bring a festive sparkle to your celebrations with this delightful Christmas-themed PCB badge! Design...
- PCB Christmas Tree 2023 A small PCB Christmas tree, using ATtiny85 / ATtiny13A and TTP223 touch sensor.There are 11 LEDs con...
- [ LedClock- MICRO - 24x41 ] - 7 Segment PCB [ LedClock- MICRO- 24x41 ] - 7 Segment PCB7 Segment PCB used in "LedClock- MICRO " project.!!! For s...
- PCB Christmas Star 2024 -2 Bring a festive sparkle to your celebrations with this delightful Christmas-themed PCB badge! Design...
- LedClock - ALL IN ONE PCB This version features an ALL IN ONE PCB of the LED clock project by @imeszaros. The PCB was specific...
- WLED controller SR - INMP441 adapter Basic 1x6 adapter for INMP441 sound module, so you can enable sound reactive on this WLED controller...
- ESP32 D1 mini - WLED Controller SR (5-12V) ESP32 D1 Mini compatible board for led control via WLED App, based on SN74LVC2T45 level shifter, wit...
- ESP32-S3 DevBoard Compact ESP32-S3 dev Board, that can be powered by both USB and battery.It features a LED on GPIO2, ...
- ESP01 - TM1637 NTP CLOCK Basic PCB backplate board for a 0.56" display, that uses an ESP01 /ESP01S to get NTP Time and displa...
- Fixed output MT3608 Small size MT3608 DC-DC boost converter with fixed output.You have to use the properly resistor valu...
- mUSB-CR2032 adapter This project is a handy CR2032 battery adapter I've designed for situations when you need a CR2032 b...
- ESP32-C3 DevBoard Simple but fancy ESP32-C3 Development Board.Also features a WS2812B 2020 RGB LED linked to IO8 pin.B...
- LedClock - Controller Board ESP32D/E Controller Board used for Led Clock project, based on ESP32D / ESP32E microcontroller.You have to us...
- [ LedClock- MICRO - 24x41 ] - Dots PCB [ LedClock- MICRO- 24x41 ] - Dots PCBDots PCB used in "LedClock- MICRO " project.!!! For some reason...
- [ LedClock-Resized 2 - 40x66 ] - 7 Segment PCB 7 Segment PCB used in "LedClock- Resized 2 -40x66mm " project.For some reason the online PCB preview...
- [ LedClock-Resized 2 - 40x66 ] - Dots PCB Dots PCB used in "LedClock- Resized 2 -40x66mm " project.For some reason the online PCB preview tool...
- [ LedClock ESP32 D1 Mini ] - Controller_Board PCB Controller Board used for making LedClock- Resized / Resized2 projects.You can read more here : http...
You may also like
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
129 0 0 -
DIY Laser Power Meter with Arduino
192 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
172 0 2 -