Skip to content

Commit 96ddd54

Browse files
committed
Merge branch 'main' into ble-clockwise
2 parents c8d87cb + 58c07f1 commit 96ddd54

File tree

6 files changed

+165
-110
lines changed

6 files changed

+165
-110
lines changed

README.md

Lines changed: 63 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,100 @@
1-
> ![News 90s GIF](https://github.com/jnthas/clockwise/raw/gh-pages/static/images/news.gif)[2024-04-21] [Version 1.4.2 released!](https://github.com/jnthas/clockwise/releases/tag/v1.4.2) Check the [change log](https://github.com/jnthas/clockwise/blob/main/CHANGELOG.md#142---2024-04-21) to see the fixes and new features added. Be part of the [Clock Club](https://github.com/jnthas/clock-club) and create your own clockface using Canvas.
1+
![News GIF](https://github.com/jnthas/clockwise/raw/gh-pages/static/images/news.gif) **[Latest version 1.4.2 released!](https://github.com/jnthas/clockwise/releases/tag/v1.4.2)** | [See full change log](https://github.com/jnthas/clockwise/blob/main/CHANGELOG.md#142---2024-04-21)
22

3-
[![Clockwise CI/CD](https://github.com/jnthas/clockwise/actions/workflows/clockwise-ci.yml/badge.svg)](https://github.com/jnthas/clockwise/actions/workflows/clockwise-ci.yml)
3+
![Clockwise Logo](https://github.com/jnthas/clockwise/blob/gh-pages/static/images/clockwise_logo.png "Clockwise Logo")
44

5-
![Logo](https://github.com/jnthas/clockwise/blob/gh-pages/static/images/clockwise_logo.png "Logo")
5+
---
66

7-
> The DIY smart wall clock device
7+
**Clockwise** is an open-source smart wall clock that you can easily build yourself.
8+
It only needs:
89

9-
Clockwise was an idea I had while working with 64x64 LED matrices.
10-
These displays are about the size of a wall clock and with the ESP32, besides controlling the content presented on the display we also gain the functionality of
11-
WiFi, Bluetooth, touch buttons and other sensors, which gives us basically a smart wall clock.
12-
From there I started to develop a platform to create the _Clockfaces_, or skins that the clock can have. The possibilities are many and I hope that with help from contributors, we can grow the options even more.
10+
- 64x64 RGB LED Matrix (HUB75 or HUB75E)
11+
- ESP32 dev board
12+
- 5V 3A power supply
13+
- Jumpers
1314

14-
### ⏰ New Clockfaces
15-
Create a new custom Clockface starting from [here](https://github.com/jnthas/cw-cf-0x00) or take a look at the [Clock Club](https://github.com/jnthas/clock-club) and discover how to create new ones using just a JSON file with no coding.
15+
To simplify assembly, you can also use the [**WiseShield-32 DIY PCB kit**](https://www.elecrow.com/clockwise-diy-kit.html) — created in partnership with Elecrow especially for Clockwise.
1616

17+
---
1718

18-
## Available clockfaces
19+
## Features
1920

20-
Mario Bros. Clock | Time in Words
21-
:----------------:|:------------:
22-
![Mario Bros. Clockface](https://github.com/jnthas/cw-cf-0x01/blob/main/cf_0x01_thumb.jpg "Mario Bros. Clockface") | ![Time in Words Clockface](https://github.com/jnthas/cw-cf-0x02/blob/main/cf_0x02_thumb.jpg "Time in Words Clockface")
23-
https://github.com/jnthas/cw-cf-0x01 | https://github.com/jnthas/cw-cf-0x02
21+
- Real-time clock with customizable themes ("Clockfaces")
22+
- Web-based interface for configuration
23+
- Open-source hardware and firmware
24+
- Compatible with various PCBs or just simple wiring
25+
- Community-driven
2426

25-
World Map Clock | Castlevania Clock Tower
26-
:--------------:|:----------------------:
27-
![World Map Clockface](https://github.com/jnthas/cw-cf-0x03/blob/main/cf_0x03_thumb.jpg "World Map Clockface") | ![Castlevania Clockface](https://github.com/jnthas/cw-cf-0x04/blob/main/cf_0x04_thumb.jpg "Castlevania Clockface")
28-
https://github.com/jnthas/cw-cf-0x03 | https://github.com/jnthas/cw-cf-0x04
27+
---
2928

30-
Pacman | Pokedex
31-
:-----:|:------:
32-
![Pacman Clockface](https://github.com/jnthas/cw-cf-0x05/blob/main/cf_0x05_thumb.jpg "Pacman Clockface") | ![Pokedex Clockface](https://github.com/jnthas/cw-cf-0x06/blob/main/cf_0x06_thumb.jpg "Pokedex Clockface")
33-
https://github.com/jnthas/cw-cf-0x05 | https://github.com/jnthas/cw-cf-0x06
29+
## Quick Start
3430

35-
Canvas | Description
36-
:-----:|:------:
37-
<img id="cw-cf-0x07" src="https://github.com/jnthas/cw-cf-0x07/raw/main/cf_0x07_thumb.jpg" width="200" alt="Canvas Clockface"> | Canvas is a special type of Clockface<br>that is capable of rendering different<br>themes described in a JSON file.<br>Find out more [here](https://github.com/jnthas/clockwise/wiki/Canvas-Clockface).
38-
https://github.com/jnthas/cw-cf-0x07 |
31+
### 1. Required Hardware
3932

33+
If you want to build it from scratch, you will need at least these components below. Follow the instructions on [Wiki]() to assemble it.
34+
- 64x64 RGB LED matrix (HUB75 or HUB75E)
35+
- ESP32 Dev Board
36+
- 5V 3A power supply
37+
- Jumpers
4038

41-
## Driving the led matrix
39+
Alternatively, we created a custom PCB that simplifies this process a lot. The kit includes not only the PCB but all components including sensors to make your clock smarter. Check the [WiseShield-32 PCB kit](https://www.elecrow.com/clockwise-diy-kit.html) out now!
4240

43-
The three main hardware components of Clockwise are:
44-
- HUB75/HUB75E compatible LED matrix 64x64
45-
- an ESP32; and
46-
- a power supply of 3A or more
41+
### 2. Flash Firmware
4742

48-
With these components in hand, just follow the wiring instructions according to the library used, by default Clockwise uses the [ESP32-HUB75-MatrixPanel-I2S-DMA](https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA#2-wiring-esp32-with-the-led-matrix-panel) but any Adafruit GFX compatible library should work. The default wiring connection is showed below.
43+
- Go to: [https://clockwise.page](https://clockwise.page)
44+
- Follow the on-screen steps to flash Clockwise and configure WiFi
4945

50-
![ESP32-HUB75-MatrixPanel-I2S-DMA wiring](https://github.com/jnthas/clockwise/blob/gh-pages/static/images/display_esp32_wiring_thumb.png "ESP32-HUB75-MatrixPanel-I2S-DMA wiring")
46+
For detailed instructions:
47+
👉 [See Wiki: Getting Started](https://github.com/jnthas/clockwise/wiki/%F0%9F%9A%80-Getting-Started)
5148

52-
[Full size](https://github.com/jnthas/clockwise/blob/gh-pages/static/images/display_esp32_wiring_bb.png)
49+
---
5350

54-
- In case you want something ready to use, I recommend Brian Lough's [ESP32 Trinity](https://github.com/witnessmenow/ESP32-Trinity), basically it's connecting the board and uploading the firmware, as simple as that.
55-
- If you want a designed PCB, I recommend this project from @Alexvanheu. It's compatible with HUB75/HUB75E led matrices and already tested with Clockwise https://github.com/Alexvanheu/Mario-Clock-PCB-ESP32
56-
- [ESP32 D1 Mini D1 RGB Matrix Shield](https://github.com/hallard/WeMos-Matrix-Shield-DMA) from @hallard is another option
51+
## Clockfaces Gallery
5752

53+
You can choose from many creative Clockfaces — or make your own:
5854

59-
## How to change the clockface (web flashing)
55+
Mario Bros | Words | World Map | Castlevania | Pacman | Pokedex | Canvas
56+
:--:|:--:|:--:|:--:|:--:|:--:|:--:
57+
[![](https://github.com/jnthas/cw-cf-0x01/blob/main/cf_0x01_thumb.jpg)](https://github.com/jnthas/cw-cf-0x01) | [![](https://github.com/jnthas/cw-cf-0x02/blob/main/cf_0x02_thumb.jpg)](https://github.com/jnthas/cw-cf-0x02) | [![](https://github.com/jnthas/cw-cf-0x03/blob/main/cf_0x03_thumb.jpg)](https://github.com/jnthas/cw-cf-0x03) | [![](https://github.com/jnthas/cw-cf-0x04/blob/main/cf_0x04_thumb.jpg)](https://github.com/jnthas/cw-cf-0x04) | [![](https://github.com/jnthas/cw-cf-0x05/blob/main/cf_0x05_thumb.jpg)](https://github.com/jnthas/cw-cf-0x05) | [![](https://github.com/jnthas/cw-cf-0x06/blob/main/cf_0x06_thumb.jpg)](https://github.com/jnthas/cw-cf-0x06) | [![](https://github.com/jnthas/cw-cf-0x07/raw/main/cf_0x07_thumb.jpg)](https://github.com/jnthas/cw-cf-0x07)
6058

61-
1) Go to https://clockwise.page/ and select the desired clockface
62-
2) Connect the ESP32 device on your computer's USB port
63-
3) Click on the Flash button
64-
4) A dialog will appear, select the correct USB port and click in Connect ([screenshot](https://github.com/jnthas/clockwise/raw/gh-pages/static/images/usb-step1.png))
65-
5) Select the INSTALL and INSTALL again ([screenshot](https://github.com/jnthas/clockwise/raw/gh-pages/static/images/usb-step2.png))
66-
6) Wait while the flash tool uploads the firmware and finish ([screenshot](https://github.com/jnthas/clockwise/raw/gh-pages/static/images/usb-step3.png))
67-
7) From the version 1.1.0, click in NEXT on step 6, Improv will start looking for available WiFi networks to connect
68-
8) Select your local network (must be a 2.4GHz) and enter with your password ([screenshot](https://github.com/jnthas/clockwise/raw/gh-pages/static/images/usb-step4.png))
69-
9) If connection was successful, a message with button VISIT DEVICE will pop up and you can visit the Clockwise setting page ([screenshot](https://github.com/jnthas/clockwise/raw/gh-pages/static/images/usb-step5.png))
59+
> Canvas is a special type of Clockface that is capable of rendering different themes described in a JSON file. More about **Canvas Clockface**: [Wiki page](https://github.com/jnthas/clockwise/wiki/Canvas-Clockface)
7060
61+
---
7162

72-
### Configuring only WiFi
73-
After flashing your clockface, you will have a step to configure the WiFi. But in case you change your access point or password, you can set up just the WiFi connecting the Clockwise on USB, opening https://clockwise.page and clicking in Flash button, a window will pop up with a few options where you can re-configure your WiFi network ([screenshot](https://github.com/jnthas/clockwise/raw/gh-pages/static/images/usb-step6.png)) as well as open the Settings page to change preferences using button VISIT DEVICE. Remember: it is important to use a 2.4GHz WiFi, it will not work on 5GHz.
63+
## How to Build
7464

65+
You can start developing and customizing Clockwise in two different ways:
7566

76-
### Settings page
77-
The settings page have the following options
78-
- *Timezone*: The timezone must be in the format America/New_York, America/Sao_Paulo, Europe/Paris, Asia/Dubai, etc. so that the clock can connect to an NTP server to get the correct time.
79-
- *NTP Server*: By default the clock will sync with `pool.ntp.org`, but you can configure your own (local) NTP server to be used.
80-
- *Swap Blue/Green pins*: Some displays have the RGB order different, in this case RBG. You can use this options to change the order.
81-
- *Display Bright*: Change the display bright.
82-
- *Use 24h format*: You can choose between 20:00 or 8:00PM in your device.
83-
- *Automatic Bright*: Once you connect a LDR in the ESP32, Clockwise will be able to control the display bright based on the ambient light. Check the [Wiki](
84-
https://github.com/jnthas/clockwise/wiki/Connecting-the-LDR) about that.
85-
- *NTP Server*: Configure your prefered NTP Server. You can use one of the [NTP Pool Project](https://www.ntppool.org/) pools or a local one. Default is `time.google.com`.
86-
- *LDR Pin*: The ESP32 GPIO pin where the LDR is connected to. The default is 35. There is a link there where you can read the current value of LDR and test if it's working.
87-
- *Posix Timezone String*: To avoid remote lookups of ezTime, provide a Posix string that corresponds to your timezone ([explanation](https://github.com/ropg/ezTime#timezones-1)). Leave empty to obtain this automatically from the server.
88-
- *Display Rotation*: Allows you to rotate the display. This is useful if you need to adjust the direction in which cables protrude relative to the displayed image.
67+
1. **PlatformIO** — advanced usage for developers
68+
2. **ESP-IDF** — for full control
8969

90-
## How to change the clockface (PlatformIO)
70+
👉 [Both are described in the Flashing section of the Wiki](https://github.com/jnthas/clockwise/wiki/%F0%9F%92%BE-Flashing-the-Firmware)
9171

92-
Clockwise uses PlatformIO as IDE, so the configuration is already done if you use the same. The Clockwise structure consists mainly of three folders
93-
- clockfaces: contains the collection of available clockfaces. This folder is not included when compiling
94-
- lib: contains the basic code for Clockwise to work and in addition a symbolic link to the current clockface
95-
- src: contains the entry point for the clock code
72+
---
9673

97-
```
98-
.
99-
├── clockfaces
100-
│ ├── cw-cf-0x01
101-
│ ├── cw-cf-0x02
102-
│ └── cw-cf-0x03
103-
├── lib
104-
│ ├── cw-commons
105-
│ ├── cw-gfx-engine
106-
│ └── timeinwords -> ../clockfaces/cw-cf-0x02/
107-
└── src
108-
└── main.cpp
74+
## Advanced Configuration
10975

110-
```
111-
Clone this repository and then run the following command to clone the clockface submodules
76+
Clockwise offers a flexible set of options that you can adjust through its built-in Settings page:
11277

113-
``.../clockwise$ git submodule update --init firmware/clockfaces``
78+
* **WiFi settings** — easily update your network details without reflashing
79+
* **Timezone & NTP server** — sync the clock accurately for your region
80+
* **Display brightness** — manual or automatic control (with optional LDR sensor)
81+
* **Display rotation** — adjust orientation to match your wall setup
82+
* **Clockface selection** — switch between installed Clockfaces or use Canvas themes
83+
* **RGB order correction** — fix color mismatch on certain LED matrices
84+
* **POSIX timezone string** — fine-tune timezone behavior
11485

115-
To create the symbolic link run the following command inside lib/ folder:
86+
👉 See the full guide here: [Advanced Configuration Wiki](https://github.com/jnthas/clockwise/wiki/%E2%9A%99%EF%B8%8F-Configuring-Clockwise)
11687

117-
``.../clockwise/firmware/lib$ ln -s ../clockfaces/cw-cf-0x02/ timeinwords``
88+
---
11889

119-
Or, if you prefer, you can get the same result by copying the desired clockface folder into lib/
90+
## Community & Contributions
12091

121-
The same way as web flashing, when connecting for the first time you will have to configure the wifi, follow the instructions in Configuring WiFi section above.
92+
- Join the [Clock Club](https://github.com/jnthas/clock-club) to create your own Clockfaces
93+
- Contributions and pull requests are welcome!
94+
👉 [Contributing Guide](https://github.com/jnthas/clockwise/wiki/%F0%9F%A4%9D-Contributing)
12295

123-
## How to change the clockface (esp-idf)
96+
---
12497

125-
You can use the [official Esspressif IoT Development Framekwork (aka esp-idf)](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/) to build and upload this project to an ESP32 device, including the [ESP32-Trinity board](https://esp32trinity.com/).
98+
## License
12699

127-
### Install esp-idf
128-
Follow the [Step By Step installation instructions](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/#installation-step-by-step).
129-
130-
### Setup the environment variables
131-
Follow the [instructions here](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/#step-4-set-up-the-environment-variables).
132-
133-
### Clone and build this project
134-
* `git clone --recurse-submodules https://github.com/jnthas/clockwise.git`
135-
* `idf.py reconfigure`
136-
* `idf.py menuconfig` (select `Clockwise Configuration` and choose the clockface)
137-
* `idf.py flash`
138-
* `idf.py monitor`
100+
Clockwise is released under the MIT License.

firmware/lib/cw-commons/CWPreferences.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct ClockwiseParams
1212
Preferences preferences;
1313

1414
const char* const PREF_SWAP_BLUE_GREEN = "swapBlueGreen";
15+
const char* const PREF_SWAP_BLUE_RED = "swapBlueRed";
1516
const char* const PREF_USE_24H_FORMAT = "use24hFormat";
1617
const char* const PREF_DISPLAY_BRIGHT = "displayBright";
1718
const char* const PREF_DISPLAY_ABC_MIN = "autoBrightMin";
@@ -25,8 +26,12 @@ struct ClockwiseParams
2526
const char* const PREF_CANVAS_SERVER = "canvasServer";
2627
const char* const PREF_MANUAL_POSIX = "manualPosix";
2728
const char* const PREF_DISPLAY_ROTATION = "displayRotation";
29+
const char* const PREF_DRIVER = "driver";
30+
const char* const PREF_I2CSPEED = "i2cSpeed";
31+
const char* const PREF_E_PIN = "E_pin";
2832

2933
bool swapBlueGreen;
34+
bool swapBlueRed;
3035
bool use24hFormat;
3136
uint8_t displayBright;
3237
uint16_t autoBrightMin;
@@ -40,7 +45,9 @@ struct ClockwiseParams
4045
String canvasServer;
4146
String manualPosix;
4247
uint8_t displayRotation;
43-
48+
uint8_t driver;
49+
uint32_t i2cSpeed;
50+
uint8_t E_pin;
4451

4552
ClockwiseParams() {
4653
preferences.begin("clockwise", false);
@@ -56,6 +63,7 @@ struct ClockwiseParams
5663
void save()
5764
{
5865
preferences.putBool(PREF_SWAP_BLUE_GREEN, swapBlueGreen);
66+
preferences.putBool(PREF_SWAP_BLUE_RED, swapBlueRed);
5967
preferences.putBool(PREF_USE_24H_FORMAT, use24hFormat);
6068
preferences.putUInt(PREF_DISPLAY_BRIGHT, displayBright);
6169
preferences.putUInt(PREF_DISPLAY_ABC_MIN, autoBrightMin);
@@ -69,11 +77,15 @@ struct ClockwiseParams
6977
preferences.putString(PREF_CANVAS_SERVER, canvasServer);
7078
preferences.putString(PREF_MANUAL_POSIX, manualPosix);
7179
preferences.putUInt(PREF_DISPLAY_ROTATION, displayRotation);
80+
preferences.putUInt(PREF_DRIVER, driver);
81+
preferences.putUInt(PREF_I2CSPEED, i2cSpeed);
82+
preferences.putUInt(PREF_E_PIN, E_pin);
7283
}
7384

7485
void load()
7586
{
7687
swapBlueGreen = preferences.getBool(PREF_SWAP_BLUE_GREEN, false);
88+
swapBlueRed = preferences.getBool(PREF_SWAP_BLUE_RED, false);
7789
use24hFormat = preferences.getBool(PREF_USE_24H_FORMAT, true);
7890
displayBright = preferences.getUInt(PREF_DISPLAY_BRIGHT, 32);
7991
autoBrightMin = preferences.getUInt(PREF_DISPLAY_ABC_MIN, 0);
@@ -87,6 +99,9 @@ struct ClockwiseParams
8799
canvasServer = preferences.getString(PREF_CANVAS_SERVER, "raw.githubusercontent.com");
88100
manualPosix = preferences.getString(PREF_MANUAL_POSIX, "");
89101
displayRotation = preferences.getUInt(PREF_DISPLAY_ROTATION, 0);
102+
driver = preferences.getUInt(PREF_DRIVER, 0);
103+
i2cSpeed = preferences.getUInt(PREF_I2CSPEED, (uint32_t)8000000);
104+
E_pin = preferences.getUInt(PREF_E_PIN, 18);
90105
}
91106

92107
};

0 commit comments

Comments
 (0)