Skip to content

Commit 5799f3e

Browse files
Merge pull request #69 from techniccontroller/temp_main
merge changes from main
2 parents 1e5b882 + dceb7dc commit 5799f3e

4 files changed

Lines changed: 145 additions & 80 deletions

File tree

README.md

Lines changed: 61 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,60 @@
11
# Wordclock 2.0
22
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=main)
33

4-
Wordclock 2.0 with ESP8266 and NTP time
4+
A modern Wi-Fi Word Clock powered by the ESP8266 and synchronized via NTP (Network Time Protocol).
5+
Displays time in words with support for multiple languages and colorful NeoPixel LED effects.
6+
Additional gaming modes, such as PONG, SNAKE, and TETRIS, can be played via an interactive Web UI.
57

6-
More details on my website: https://techniccontroller.com/word-clock-with-wifi-and-neopixel/
8+
**Project Details and Guide:**
79

10+
Full tutorial and build instructions on https://techniccontroller.com/word-clock-with-wifi-and-neopixel/
811

9-
**Languages**
10-
11-
The Wordclock is available in **German**, **English**, **Italian**, **French** and **Javanese** language. By default the language is German.
12-
To use other languages like English or Italian please replace the file *wordclockfunctions.ino* with *wordclockfunctions.ino_english* or *wordclockfunctions.ino_italian*.
13-
The code compiles only with one file named *wordclockfunctions.ino*. So please rename the file you want to use to *wordclockfunctions.ino* and replace the existing file.
12+
## Features
13+
- 6 modes
14+
- Word Clock
15+
- Digital Clock
16+
- SPIRAL animation
17+
- TETRIS (playable via web interface)
18+
- SNAKE (playable via web interface)
19+
- PONG (playable via web interface)
20+
- Interactive Web-Based Games: Control PONG, TETRIS, and SNAKE directly through the built-in web UI
21+
- Real-time clock synchronized over Wi-Fi using NTP
22+
- Automatic daylight saving time (summer/winter) switching
23+
- Automatic timezone detection
24+
- Easy Wi-Fi setup with WiFiManager
25+
- Configurable color themes
26+
- Customizable night mode (start/end time)
27+
- Adjustable brightness settings
28+
- Automatic mode rotation
29+
- Web interface for configuration and control
30+
- Physical button for quick mode change or night mode toggle
31+
- Intelligent current limiting of LEDs
32+
- Dynamic color shifting mode
33+
34+
## Supported Languages
35+
36+
The WordClock currently supports the following languages:
37+
- **German (default)**
38+
- **English**
39+
- **Italian**
40+
- **French**
41+
- **Swiss German**
42+
- **Javanese**
43+
44+
**How to Change the Language**
45+
46+
To switch to another language:
47+
1. Go to the `wordclockfunctions.ino_<language>` file (e.g., `wordclockfunctions.ino_english`)
48+
2. Rename it to `wordclockfunctions.ino`
49+
3. Replace the existing `wordclockfunctions.ino` file
50+
4. Compile and upload the code to your ESP8266
51+
52+
Only one language file should be named wordclockfunctions.ino at any time for successful compilation.
1453

1554
Thank you to everyone who provided feedback on adding new languages and testing their accuracy — your efforts have been invaluable in making this project truly inclusive and reliable!
1655

17-
**Special Branches**
18-
19-
We've got some interesting branches in this repo inspired by user feedback. These branches explore unique features and experimental ideas. Some will stay updated with the main branch's features.
20-
21-
- [**hour_animation**](https://github.com/techniccontroller/wordclock_esp8266/tree/hour_animation): This branch replaces the spiral animation with some custom pattern animation defined as x/y coordinate pattern including custom color for each letter. Also, this animation is show ones per hour.
22-
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=hour_animation)
23-
- [**mode_seconds**](https://github.com/techniccontroller/wordclock_esp8266/tree/mode_seconds): This branch adds one additional mode to show the seconds as numbers on the clock. Thanks to [@Bram](https://github.com/BramWerbrouck)
24-
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=mode_seconds)
25-
- [**rgbw_leds**](https://github.com/techniccontroller/wordclock_esp8266/tree/rgbw_leds): This branch uses RGBW LEDs instead of RGB LEDs.
26-
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=rgbw_leds)
27-
- [**static_background_pattern**](https://github.com/techniccontroller/wordclock_esp8266/tree/static_background_pattern): This branch allows to light up specific letters always during clock mode. E.G., to display some special words in another color.
28-
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=static_background_pattern)
29-
3056

3157

32-
## Features
33-
- 6 modes (Clock, Digital Clock, SPIRAL animation, TETRIS, SNAKE, PONG)
34-
- time update via NTP server
35-
- automatic summer/wintertime change
36-
- automatic timezone selection
37-
- easy WIFI setup with WifiManager
38-
- configurable color
39-
- configurable night mode (start and end time)
40-
- configurable brightness
41-
- automatic mode change
42-
- webserver interface for configuration and control
43-
- physical button to change mode or enable night mode without webserver
44-
- automatic current limiting of LEDs
45-
- dynamic color shift mode
46-
4758
## Pictures of clock
4859
![modes_images2](https://user-images.githubusercontent.com/36072504/156947689-dd90874d-a887-4254-bede-4947152d85c1.png)
4960

@@ -68,6 +79,21 @@ We've got some interesting branches in this repo inspired by user feedback. Thes
6879

6980
<img src="https://techniccontroller.com/wp-content/uploads/filemanager1-1.png" height="300px" /> <img src="https://techniccontroller.com/wp-content/uploads/filemanager2-1.png" height="300px" /> <img src="https://techniccontroller.com/wp-content/uploads/filemanager3-1.png" height="300px" />
7081

82+
## Special Branches
83+
84+
We've got some interesting branches in this repo inspired by user feedback. These branches explore unique features and experimental ideas. Some will stay updated with the main branch's features.
85+
86+
- [**hour_animation**](https://github.com/techniccontroller/wordclock_esp8266/tree/hour_animation): This branch replaces the spiral animation with some custom pattern animation defined as x/y coordinate pattern including custom color for each letter. Also, this animation is show ones per hour.
87+
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=hour_animation)
88+
- [**mode_seconds**](https://github.com/techniccontroller/wordclock_esp8266/tree/mode_seconds): This branch adds one additional mode to show the seconds as numbers on the clock. Thanks to [@Bram](https://github.com/BramWerbrouck)
89+
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=mode_seconds)
90+
- [**rgbw_leds**](https://github.com/techniccontroller/wordclock_esp8266/tree/rgbw_leds): This branch uses RGBW LEDs instead of RGB LEDs.
91+
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=rgbw_leds)
92+
- [**static_background_pattern**](https://github.com/techniccontroller/wordclock_esp8266/tree/static_background_pattern): This branch allows to light up specific letters always during clock mode. E.G., to display some special words in another color.
93+
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=static_background_pattern)
94+
- [**frame_light**](https://github.com/techniccontroller/wordclock_esp8266/tree/frame_light): This branch allows to add an additional LEDs around the clock, as background/frame light it has the same color as the clock. Thanks to Sandro for the idea.
95+
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=frame_light)
96+
7197
## Install needed Libraries
7298

7399
Please download all these libraries as ZIP from GitHub, and extract them in the *libraries* folder of your Sketchbook location (see **File -> Preferences**):

wordclock_esp8266.ino

Lines changed: 82 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,46 @@
4949
// CONSTANTS
5050
// ----------------------------------------------------------------------------------
5151

52-
#define EEPROM_SIZE 30 // size of EEPROM to save persistent variables
53-
#define ADR_NM_START_H 0
54-
#define ADR_NM_END_H 1
55-
#define ADR_NM_START_M 2
56-
#define ADR_NM_END_M 3
57-
#define ADR_BRIGHTNESS 4
58-
#define ADR_MC_RED 5
59-
#define ADR_MC_GREEN 6
60-
#define ADR_MC_BLUE 7
61-
#define ADR_PURIST_MODE_ACTIVE 8
62-
#define ADR_STATICBACKGROUND 9
63-
#define ADR_BRIGHTNESS_FRAME 10
64-
#define ADR_FRAMELIGHTACTIVE 11
65-
#define ADR_FRAMELIGHTSECONDSACTIVE 12
66-
#define ADR_FRAMELIGHTSECONDSSINGLE 13
67-
#define ADR_FRAMELIGHTSECONDSINCDECCYCLE 14
68-
#define ADR_STATICBACKGROUND2 15
69-
#define ADR_STATE 26
70-
#define ADR_NM_ACTIVATED 27
71-
#define ADR_COLSHIFTSPEED 28
72-
#define ADR_COLSHIFTACTIVE 29
52+
53+
#define EEPROM_VERSION_CODE 2 // Change this value when defaults settings change
54+
55+
// EEPROM address map (all uint8_t, 1 byte each)
56+
#define EEPROM_SIZE 25 // size of EEPROM to save persistent variables
57+
#define ADR_EEPROM_VERSION 0 // uint8_t
58+
#define ADR_NM_START_H 1 // uint8_t
59+
#define ADR_NM_END_H 2 // uint8_t
60+
#define ADR_NM_START_M 3 // uint8_t
61+
#define ADR_NM_END_M 4 // uint8_t
62+
#define ADR_BRIGHTNESS 5 // uint8_t
63+
#define ADR_MC_RED 6 // uint8_t
64+
#define ADR_MC_GREEN 7 // uint8_t
65+
#define ADR_MC_BLUE 8 // uint8_t
66+
#define ADR_STATE 9 // uint8_t
67+
#define ADR_NM_ACTIVATED 10 // uint8_t
68+
#define ADR_COLSHIFTSPEED 11 // uint8_t
69+
#define ADR_COLSHIFTACTIVE 12 // uint8_t
70+
#define ADR_PURIST_MODE_ACTIVE 13 // uint8_t
71+
#define ADR_STATICBACKGROUND 14 // uint8_t
72+
#define ADR_BRIGHTNESS_FRAME 15 // uint8_t
73+
#define ADR_FRAMELIGHTACTIVE 16 // uint8_t
74+
#define ADR_FRAMELIGHTSECONDSACTIVE 17 // uint8_t
75+
#define ADR_FRAMELIGHTSECONDSSINGLE 18 // uint8_t
76+
#define ADR_FRAMELIGHTSECONDSINCDECCYCLE 19 // uint8_t
77+
#define ADR_STATICBACKGROUND2 20 // uint8_t
78+
79+
// DEFAULT SETTINGS (if one changes this, also increment the EEPROM_VERSION_CODE, to ensure that the EEPROM is updated with the new defaults)
80+
#define DEFAULT_NM_START_HOUR 22 // default start hour of nightmode (0-23)
81+
#define DEFAULT_NM_START_MIN 5 // default start minute of nightmode (0-59)
82+
#define DEFAULT_NM_END_HOUR 7 // default end hour of nightmode (0-23)
83+
#define DEFAULT_NM_END_MIN 0 // default end minute of nightmode (0-59)
84+
#define DEFAULT_BRIGHTNESS 40 // default brightness of LEDs (0-255)
85+
#define DEFAULT_MC_RED 200 // default main color red value
86+
#define DEFAULT_MC_GREEN 200 // default main color green value
87+
#define DEFAULT_MC_BLUE 0 // default main color blue value
88+
#define DEFAULT_NM_ACTIVATED 1 // if function nightmode is activated (0 = deactivated, 1 = activated)
89+
#define DEFAULT_COLSHIFT_SPEED 1 // needs to be between larger than 0 (1 = slowest, 255 = fastest)
90+
#define DEFAULT_COLSHIFT_ACTIVE 0 // if dynamic color shift is active (0 = deactivated, 1 = activated)
91+
#define DEFAULT_BRIGHTNESSFRAME 40 // default brightness of Frame LEDs (0-255)
7392

7493

7594
#define NEOPIXELPIN 5 // pin to which the NeoPixels are attached
@@ -170,8 +189,10 @@ const uint32_t colors24bit[NUM_COLORS] = {
170189
LEDMatrix::Color24bit(0, 128, 0),
171190
LEDMatrix::Color24bit(0, 0, 255) };
172191

173-
uint8_t brightness = 40; // current brightness of leds
174-
uint8_t brightnessFrame = 40; // brightness of leds for frame light
192+
193+
uint8_t brightness = DEFAULT_BRIGHTNESS; // current brightness of leds
194+
uint8_t brightnessFrame = DEFAULT_BRIGHTNESSFRAME; // current brightness of frame leds
195+
175196
bool sprialDir = false;
176197

177198
// timestamp variables
@@ -195,18 +216,18 @@ Tetris mytetris = Tetris(&ledmatrix, &logger);
195216
Snake mysnake = Snake(&ledmatrix, &logger);
196217
Pong mypong = Pong(&ledmatrix, &logger);
197218

198-
float filterFactor = DEFAULT_SMOOTHING_FACTOR;// stores smoothing factor for led transition
199-
uint8_t currentState = st_clock; // stores current state
200-
bool stateAutoChange = false; // stores state of automatic state change
201-
bool nightMode = false; // stores state of nightmode
202-
bool nightModeActivated = true; // stores if the function nightmode is activated (its not the state of nightmode)
203-
bool ledOff = false; // stores state of led off
204-
uint32_t maincolor_clock = colors24bit[2]; // color of the clock and digital clock
205-
uint32_t maincolor_snake = colors24bit[1]; // color of the random snake animation
206-
bool apmode = false; // stores if WiFi AP mode is active
207-
bool dynColorShiftActive = false; // stores if dynamic color shift is active
208-
uint8_t dynColorShiftPhase = 0; // stores the phase of the dynamic color shift
209-
uint8_t dynColorShiftSpeed = 1; // stores the speed of the dynamic color shift -> used to calc update period
219+
float filterFactor = DEFAULT_SMOOTHING_FACTOR; // stores smoothing factor for led transition
220+
uint8_t currentState = st_clock; // stores current state
221+
bool stateAutoChange = false; // stores state of automatic state change
222+
bool nightMode = false; // stores state of nightmode
223+
bool nightModeActivated = DEFAULT_NM_ACTIVATED; // stores if the function nightmode is activated (its not the state of nightmode)
224+
bool ledOff = false; // stores state of led off
225+
uint32_t maincolor_clock = colors24bit[2]; // color of the clock and digital clock
226+
uint32_t maincolor_snake = colors24bit[1]; // color of the random snake animation
227+
bool apmode = false; // stores if WiFi AP mode is active
228+
bool dynColorShiftActive = DEFAULT_COLSHIFT_ACTIVE; // stores if dynamic color shift is active
229+
uint8_t dynColorShiftPhase = 0; // stores the phase of the dynamic color shift
230+
uint8_t dynColorShiftSpeed = DEFAULT_COLSHIFT_SPEED; // stores the speed of the dynamic color shift -> used to calc update period
210231
bool puristModeActive = false; // stores if purist mode is active
211232
bool staticBackgroundActive = false; // stores if static background is active
212233
bool staticBackground2Active = false; // stores if static background is active
@@ -217,10 +238,10 @@ bool frameSecondsIncDecCycle = false; // stores if frame light should be
217238

218239

219240
// nightmode settings
220-
uint8_t nightModeStartHour = 22;
221-
uint8_t nightModeStartMin = 0;
222-
uint8_t nightModeEndHour = 7;
223-
uint8_t nightModeEndMin = 0;
241+
uint8_t nightModeStartHour = DEFAULT_NM_START_HOUR;
242+
uint8_t nightModeStartMin = DEFAULT_NM_START_MIN;
243+
uint8_t nightModeEndHour = DEFAULT_NM_END_HOUR;
244+
uint8_t nightModeEndMin = DEFAULT_NM_END_MIN;
224245

225246
// Watchdog counter to trigger restart if NTP update was not possible 30 times in a row (5min)
226247
int watchdogCounter = 30;
@@ -242,6 +263,24 @@ void setup() {
242263
//Init EEPROM
243264
EEPROM.begin(EEPROM_SIZE);
244265

266+
// Check EEPROM version code
267+
uint8_t storedVersion = EEPROM.read(ADR_EEPROM_VERSION);
268+
if (storedVersion != EEPROM_VERSION_CODE) {
269+
// Set new defaults
270+
EEPROM.write(ADR_EEPROM_VERSION, EEPROM_VERSION_CODE);
271+
EEPROM.write(ADR_NM_START_H, DEFAULT_NM_START_HOUR);
272+
EEPROM.write(ADR_NM_START_M, DEFAULT_NM_START_MIN);
273+
EEPROM.write(ADR_NM_END_H, DEFAULT_NM_END_HOUR);
274+
EEPROM.write(ADR_NM_END_M, DEFAULT_NM_END_MIN);
275+
EEPROM.write(ADR_BRIGHTNESS, DEFAULT_BRIGHTNESS);
276+
setMainColor(DEFAULT_MC_RED, DEFAULT_MC_GREEN, DEFAULT_MC_BLUE);
277+
EEPROM.write(ADR_STATE, st_clock);
278+
EEPROM.write(ADR_NM_ACTIVATED, DEFAULT_NM_ACTIVATED);
279+
EEPROM.write(ADR_COLSHIFTSPEED, DEFAULT_COLSHIFT_SPEED);
280+
EEPROM.write(ADR_COLSHIFTACTIVE, DEFAULT_COLSHIFT_ACTIVE);
281+
EEPROM.commit();
282+
}
283+
245284
// configure button pin as input
246285
pinMode(BUTTONPIN, INPUT_PULLUP);
247286

@@ -273,6 +312,10 @@ void setup() {
273312

274313
// set a custom hostname
275314
wifiManager.setHostname(hostname);
315+
316+
// set timeout of config portal to 10min, continue even if not connected,
317+
// clock will show wrong time, but eventually restart after watchdog counter is 0 (after ~5min)
318+
wifiManager.setConfigPortalTimeout(600);
276319

277320
// fetches ssid and pass from eeprom and tries to connect
278321
// if it does not connect it starts an access point with the specified name

wordclockfunctions.ino_italian

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,7 @@ String timeToString(uint8_t hours,uint8_t minutes){
114114
}
115115

116116
//SONO LE
117-
if(hours == 1 && minutes < 35)
118-
{
119-
message += "= # "; //E' L' -> = is for E' and # is for L'
120-
}
121-
else if (hours == 0 && minutes >= 35)
117+
if(hours == 1)
122118
{
123119
message += "= # "; //E' L' -> = is for E' and # is for L'
124120
}

wordclockfunctions.ino_swiss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// Thanks to Sandro for providing this swiss german version
22
const String clockStringSwiss = "ESPESCHAFUFVIERTUBFZAAZWANZGSIVORABOHWORTUHRHAUBIANESSIEISZWOISDRUVIERIYFUFIOSACHSISEBNIACHTINUNIELZANIERBEUFIZWOUFINAGSI";
33

44
/**

0 commit comments

Comments
 (0)