Skip to content

Commit 9126d9d

Browse files
Merge pull request #64 from techniccontroller/main
update with fixes from main
2 parents 6a7c685 + 80160cd commit 9126d9d

File tree

4 files changed

+277
-36
lines changed

4 files changed

+277
-36
lines changed

README.md

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +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-
- [**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)
23-
- [**rgbw_leds**](https://github.com/techniccontroller/wordclock_esp8266/tree/rgbw_leds): This branch uses RGBW LEDs instead of RGB LEDs.
24-
- [**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.
25-
2656

2757

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

@@ -64,6 +79,19 @@ We've got some interesting branches in this repo inspired by user feedback. Thes
6479

6580
<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" />
6681

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+
6795
## Install needed Libraries
6896

6997
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ void setup() {
249249

250250
// set a custom hostname
251251
wifiManager.setHostname(hostname);
252+
253+
// set timeout of config portal to 10min, continue even if not connected,
254+
// clock will show wrong time, but eventually restart after watchdog counter is 0 (after ~5min)
255+
wifiManager.setConfigPortalTimeout(600);
252256

253257
// fetches ssid and pass from eeprom and tries to connect
254258
// 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: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
// Thanks to Sandro for providing this swiss german version
2+
const String clockStringSwiss = "ESPESCHAFUFVIERTUBFZAAZWANZGSIVORABOHWORTUHRHAUBIANESSIEISZWOISDRUVIERIYFUFIOSACHSISEBNIACHTINUNIELZANIERBEUFIZWOUFINAGSI";
3+
4+
/**
5+
* @brief control the four minute indicator LEDs
6+
*
7+
* @param minutes minutes to be displayed [0 ... 59]
8+
* @param color 24bit color value
9+
*/
10+
void drawMinuteIndicator(uint8_t minutes, uint32_t color){
11+
//separate LEDs for minutes in an additional row
12+
switch (minutes%5)
13+
{
14+
case 0:
15+
break;
16+
17+
case 1:
18+
ledmatrix.setMinIndicator(0b1000, color);
19+
break;
20+
21+
case 2:
22+
ledmatrix.setMinIndicator(0b1100, color);
23+
break;
24+
25+
case 3:
26+
ledmatrix.setMinIndicator(0b1110, color);
27+
break;
28+
29+
case 4:
30+
ledmatrix.setMinIndicator(0b1111, color);
31+
break;
32+
}
33+
}
34+
35+
/**
36+
* @brief Draw the given sentence to the word clock
37+
*
38+
* @param message sentence to be displayed
39+
* @param color 24bit color value
40+
* @return int: 0 if successful, -1 if sentence not possible to display
41+
*/
42+
int showStringOnClock(String message, uint32_t color){
43+
String word = "";
44+
int lastLetterClock = 0;
45+
int positionOfWord = 0;
46+
int index = 0;
47+
48+
// add space on the end of message for splitting
49+
message = message + " ";
50+
51+
// empty the targetgrid
52+
ledmatrix.gridFlush();
53+
54+
while(true){
55+
// extract next word from message
56+
word = split(message, ' ', index);
57+
index++;
58+
59+
if(word.length() > 0){
60+
// find word in clock string
61+
positionOfWord = clockStringSwiss.indexOf(word, lastLetterClock);
62+
63+
if(positionOfWord >= 0){
64+
// word found on clock -> enable leds in targetgrid
65+
for(unsigned int i = 0; i < word.length(); i++){
66+
int x = (positionOfWord + i)%WIDTH;
67+
int y = (positionOfWord + i)/WIDTH;
68+
ledmatrix.gridAddPixel(x, y, color);
69+
}
70+
// remember end of the word on clock
71+
lastLetterClock = positionOfWord + word.length();
72+
}
73+
else{
74+
// word is not possible to show on clock
75+
logger.logString("word is not possible to show on clock: " + String(word));
76+
return -1;
77+
}
78+
}else{
79+
// end - no more word in message
80+
break;
81+
}
82+
}
83+
// return success
84+
return 0;
85+
}
86+
87+
/**
88+
* @brief Converts the given time as sentence (String)
89+
*
90+
* @param hours hours of the time value
91+
* @param minutes minutes of the time value
92+
* @return String time as sentence
93+
*/
94+
String timeToString(uint8_t hours, uint8_t minutes){
95+
96+
//ES IST
97+
String message = "ES ESCH ";
98+
99+
//show minutes
100+
if(minutes >= 5 && minutes < 10)
101+
{
102+
message += "FUF AB ";
103+
}
104+
else if(minutes >= 10 && minutes < 15)
105+
{
106+
message += "ZAA AB ";
107+
}
108+
else if(minutes >= 15 && minutes < 20)
109+
{
110+
message += "VIERTU AB ";
111+
}
112+
else if(minutes >= 20 && minutes < 25)
113+
{
114+
message += "ZWANZG AB "; //Sandro
115+
}
116+
else if(minutes >= 25 && minutes < 30)
117+
{
118+
message += "FUF VOR HAUBI ";
119+
}
120+
else if(minutes >= 30 && minutes < 35)
121+
{
122+
message += "HAUBI ";
123+
}
124+
else if(minutes >= 35 && minutes < 40)
125+
{
126+
message += "FUF AB HAUBI ";
127+
}
128+
else if(minutes >= 40 && minutes < 45)
129+
{
130+
message += "ZWANZG VOR "; //Sandro
131+
}
132+
else if(minutes >= 45 && minutes < 50)
133+
{
134+
message += "VIERTU VOR ";
135+
}
136+
else if(minutes >= 50 && minutes < 55)
137+
{
138+
message += "ZAA VOR ";
139+
}
140+
else if(minutes >= 55 && minutes < 60)
141+
{
142+
message += "FUF VOR ";
143+
}
144+
145+
//convert hours to 12h format
146+
if(hours >= 12)
147+
{
148+
hours -= 12;
149+
}
150+
if(minutes >= 25) //Sandro 20
151+
{
152+
hours++;
153+
}
154+
if(hours == 12)
155+
{
156+
hours = 0;
157+
}
158+
159+
// show hours
160+
switch(hours)
161+
{
162+
case 0:
163+
message += "ZWOUFI ";
164+
break;
165+
case 1:
166+
message += "EIS ";
167+
// //EIN(S)
168+
// if(minutes > 4){ // Sandro
169+
// message += "S";
170+
// }
171+
// message += " ";
172+
break;
173+
case 2:
174+
message += "ZWOI ";
175+
break;
176+
case 3:
177+
message += "DRU ";
178+
break;
179+
case 4:
180+
message += "VIERI ";
181+
break;
182+
case 5:
183+
message += "FUFI ";
184+
break;
185+
case 6:
186+
message += "SACHSI ";
187+
break;
188+
case 7:
189+
message += "SEBNI ";
190+
break;
191+
case 8:
192+
message += "ACHTI ";
193+
break;
194+
case 9:
195+
message += "NUNI ";
196+
break;
197+
case 10:
198+
message += "ZANI ";
199+
break;
200+
case 11:
201+
message += "EUFI ";
202+
break;
203+
}
204+
if(minutes < 5)
205+
{
206+
message += "GSI ";
207+
}
208+
209+
logger.logString("time as String: " + String(message));
210+
211+
return message;
212+
}
213+

0 commit comments

Comments
 (0)