Skip to content

Commit c9aa08e

Browse files
authored
Update ReadMe
1 parent e76e9a3 commit c9aa08e

File tree

1 file changed

+219
-79
lines changed
  • usermods/seven_segment_display_reloaded

1 file changed

+219
-79
lines changed
Lines changed: 219 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,272 @@
11
# Seven Segment Display Reloaded
22

33
Uses the overlay feature to create a configurable seven segment display.
4-
Optimized for maximum configurability and use with seven segment clocks by parallyze (https://www.instructables.com/member/parallyze/instructables/)
4+
Optimized for maximum configurability and use with seven segment clocks by [parallyze](https://www.instructables.com/member/parallyze/instructables/).
55
Very loosely based on the existing usermod "seven segment display".
66

7-
87
## Installation
98

109
Add the compile-time option `-D USERMOD_SSDR` to your `platformio.ini` (or `platformio_override.ini`) or use `#define USERMOD_SSDR` in `my_config.h`.
1110

12-
For the auto brightness option, the usermod SN_Photoresistor or BH1750_V2 has to be installed as well. See SN_Photoresistor/readme.md or BH1750_V2/readme.md for instructions.
11+
For the auto brightness option, the usermod **SN_Photoresistor** or **BH1750_V2** has to be installed as well. See [SN_Photoresistor/readme.md](SN_Photoresistor/readme.md) or [BH1750_V2/readme.md](BH1750_V2/readme.md) for instructions.
12+
13+
## Available Compile-Time Parameters
14+
15+
These parameters can be configured at compile time using `#define` statements in `my_config.h`. The following table summarizes the available options:
16+
17+
| Parameter | Default Value | Description |
18+
|-----------------------------------|---------------|-------------|
19+
| SSDR_ENABLED | true | Enable SSDR usermod |
20+
| SSDR_ENABLE_AUTO_BRIGHTNESS | false | Enable auto brightness (requires USERMOD_SN_PHOTORESISTOR) |
21+
| SSDR_BRIGHTNESS_MIN | 0 | Minimum brightness value for auto brightness mapping |
22+
| SSDR_BRIGHTNESS_MAX | 128 | Maximum brightness value for auto brightness mapping |
23+
| SSDR_INVERTED | false | Inverted display (background on, digits off) |
24+
| SSDR_COLONBLINK | true | Enable blinking colon(s) |
25+
| SSDR_LEADING_ZERO | false | Show leading zero for hours (e.g., "07" instead of "7") |
26+
| SSDR_DISPLAY_MASK | "H:m" | Display mask for time format (see below) |
27+
| SSDR_HOURS | (see example) | LED definition for hours digits |
28+
| SSDR_MINUTES | (see example) | LED definition for minutes digits |
29+
| SSDR_SECONDS | "" | Reserved for seconds if needed |
30+
| SSDR_COLONS | "266-275" | Segment range for colon separators |
31+
| SSDR_LIGHT | "252-265" | Segment range for light indicator |
32+
| SSDR_DAYS | "" | Reserved for day display if needed |
33+
| SSDR_MONTHS | "" | Reserved for month display if needed |
34+
| SSDR_YEARS | "" | Reserved for year display if needed |
35+
| umSSDR_INVERT_AUTO_BRIGHTNESS | false | Invert brightness mapping (maps lux min to brightness max) |
36+
| umSSDR_LUX_MIN | 0 | Minimum lux level for brightness mapping |
37+
| umSSDR_LUX_MAX | 1000 | Maximum lux level for brightness mapping |
38+
39+
Additionally, the usermod allows overriding the internal LED segment number mapping with the optional macro:
40+
- umSSDR_NUMBERS
1341

1442
## Settings
43+
1544
All settings can be controlled via the usermod settings page.
16-
Part of the settings can be controlled through MQTT with a raw payload or through a json request to /json/state.
45+
Some settings can also be controlled through MQTT with a raw payload or via a JSON request to `/json/state`.
46+
47+
### Parameters Controlled in the Settings Page
48+
49+
- **enabled**
50+
Enables/disables this usermod.
1751

18-
### enabled
19-
Enables/disables this usermod
52+
- **inverted**
53+
Enables the inverted mode in which the background is lit and the digits are off (black).
2054

21-
### inverted
22-
Enables the inverted mode in which the background should be enabled and the digits should be black (LEDs off)
55+
- **Colon-blinking**
56+
Enables the blinking colon(s) if they are defined.
2357

24-
### Colon-blinking
25-
Enables the blinking colon(s) if they are defined
58+
- **Leading-Zero**
59+
Shows a leading zero for hours when applicable (e.g., "07" instead of "7").
2660

27-
### Leading-Zero
28-
Shows the leading zero of the hour if it exists (i.e. shows `07` instead of `7`)
61+
- **enable-auto-brightness**
62+
Enables the auto brightness feature. This works only when the usermod **SN_Photoresistor** or **BH1750_V2** is installed.
2963

30-
### enable-auto-brightness
31-
Enables the auto brightness feature. Can be used only when the usermods SN_Photoresistor or BH1750_V2 are installed.
64+
- **auto-brightness-min / auto-brightness-max**
65+
Maps the lux value from the SN_Photoresistor or BH1750_V2 to brightness values.
66+
The mapping (default: 0–1000 lux) is mapped to the defined auto brightness limits. Note that WLED current protection might override the calculated value if it is too high.
3267

33-
### auto-brightness-min / auto-brightness-max
34-
The lux value calculated from usermod SN_Photoresistor or BH1750_V2 will be mapped to the values defined here.
35-
The mapping, 0 - 1000 lux, will be mapped to auto-brightness-min and auto-brightness-max
68+
- **lux-min**
69+
Defines the minimum lux level for brightness mapping. When the lux value is at or below this level, the display brightness is set to the minimum brightness. Default is `0` lux.
3670

37-
WLED current protection will override the calculated value if it is too high.
71+
- **lux-max**
72+
Defines the maximum lux level for brightness mapping. When the lux value is at or above this level, the display brightness is set to the maximum brightness. Default is `1000` lux.
3873

39-
### Display-Mask
40-
Defines the type of the time/date display.
41-
For example "H:m" (default)
42-
- H - 00-23 hours
43-
- h - 01-12 hours
44-
- k - 01-24 hours
45-
- m - 00-59 minutes
46-
- s - 00-59 seconds
47-
- d - 01-31 day of month
48-
- M - 01-12 month
49-
- y - 21 last two positions of year
50-
- Y - 2021 year
51-
- : for a colon
74+
- **invert-auto-brightness**
75+
Inverts the mapping logic for brightness. When enabled (`true`), `lux-min` maps to the maximum brightness and `lux-max` maps to the minimum brightness. When disabled (`false`), `lux-min` maps to the minimum brightness and `lux-max` to the maximum brightness.
5276

53-
### LED-Numbers
54-
- LED-Numbers-Hours
55-
- LED-Numbers-Minutes
56-
- LED-Numbers-Seconds
57-
- LED-Numbers-Colons
58-
- LED-Numbers-Day
59-
- LED-Numbers-Month
60-
- LED-Numbers-Year
77+
- **Display-Mask**
78+
Defines the layout for the time/date display. For example, `"H:m"` is the default. The mask characters include:
79+
- **H** - 00–23 hours
80+
- **h** - 01–12 hours
81+
- **k** - 01–24 hours
82+
- **m** - 00–59 minutes
83+
- **s** - 00–59 seconds
84+
- **d** - 01–31 day of month
85+
- **M** - 01–12 month
86+
- **y** - Last two digits of year
87+
- **Y** - Full year (e.g., 2021)
88+
- **L** - Light LED indicator
89+
- **:** - Colon separator
6190

62-
See following example for usage.
91+
- **LED-Numbers**
92+
LED segment definitions for various parts of the display:
93+
- LED-Numbers-Hours
94+
- LED-Numbers-Minutes
95+
- LED-Numbers-Seconds
96+
- LED-Numbers-Colons
97+
- LED-Numbers-Light
98+
- LED-Numbers-Day
99+
- LED-Numbers-Month
100+
- LED-Numbers-Year
63101

102+
## Example LED Definitions
64103

65-
## Example
104+
The following is an example of an LED layout for a seven segment display. The diagram below shows the segment positions:
66105

67-
Example of an LED definition:
68106
```
69107
< A >
70108
/\ /\
71-
F B
109+
F B
72110
\/ \/
73111
< G >
74112
/\ /\
75-
E C
113+
E C
76114
\/ \/
77115
< D >
78116
```
79117

80-
LEDs or Range of LEDs are separated by a comma ","
118+
A digit segment can consist of single LED numbers and LED ranges, separated by commas (,)
119+
An example would be 1,3,6-8,23,30-32. In this example the LEDs with the numbers 1,3,6,7,8,23,30,31 and 32 would make up a Segment.
120+
Segments for each digit are separated by semicolons (;) and digits are separated by a colon (:).
81121

82-
Segments are separated by a semicolon ";" and are read as A;B;C;D;E;F;G
122+
### Example for a Clock Display
83123

84-
Digits are separated by colon ":" -> A;B;C;D;E;F;G:A;B;C;D;E;F;G
124+
- **Hour Definition Example:**
125+
126+
59,46;47-48;50-51;52-53;54-55;57-58;49,56:0,13;1-2;4-5;6-7;8-9;11-12;3,10
127+
128+
The definition above represents two digits (separated by ":"):
129+
130+
**First digit (of the hour):**
131+
- Segment A: 59, 46
132+
- Segment B: 47, 48
133+
- Segment C: 50, 51
134+
- Segment D: 52, 53
135+
- Segment E: 54, 55
136+
- Segment F: 57, 58
137+
- Segment G: 49, 56
85138

86-
Ranges are defined as lower to higher (lower first)
139+
**Second digit (of the hour):**
140+
- Segment A: 0, 13
141+
- Segment B: 1, 2
142+
- Segment C: 4, 5
143+
- Segment D: 6, 7
144+
- Segment E: 8, 9
145+
- Segment F: 11, 12
146+
- Segment G: 3, 10
87147

88-
For example, a clock definition for the following clock (https://www.instructables.com/Lazy-7-Quick-Build-Edition/) is
148+
- **Minute Definition Example:**
149+
150+
37-38;39-40;42-43;44,31;32-33;35-36;34,41:21-22;23-24;26-27;28,15;16-17;19-20;18,25
151+
152+
(Definitions can be adjusted according to the physical orientation of your LEDs.)
89153

90-
- hour "59,46;47-48;50-51;52-53;54-55;57-58;49,56:0,13;1-2;4-5;6-7;8-9;11-12;3,10"
154+
## Additional Notes
91155

92-
- minute "37-38;39-40;42-43;44,31;32-33;35-36;34,41:21-22;23-24;26-27;28,15;16-17;19-20;18,25"
156+
- **Dynamic Brightness Control:**
157+
Auto brightness is computed using sensor readings from either the SN_Photoresistor or BH1750. The value is mapped between the defined brightness and lux limits, with an option to invert the mapping.
93158

94-
or
159+
- **Disabling LED Output:**
160+
A public function `disableOutputFunction(bool state)` is provided to externally disable or enable the LED output.
95161

96-
- hour "6,7;8,9;11,12;13,0;1,2;4,5;3,10:52,53;54,55;57,58;59,46;47,48;50,51;49,56"
162+
## Additional Projects
97163

98-
- minute "15,28;16,17;19,20;21,22;23,24;26,27;18,25:31,44;32,33;35,36;37,38;39,40;42,43;34,41"
164+
### 1. Giant Hidden Shelf Edge Clock
165+
166+
This project, available on [Thingiverse](https://www.thingiverse.com/thing:4207524), uses a large hidden shelf edge as the display for a clock. If you build the modified clock that also shows 24 hours, use the following settings in your configuration:
167+
168+
my_config.h Settings:
169+
--------------------------------
170+
171+
```
172+
#define USERMOD_SSDR
173+
174+
#define umSSDR_ENABLED true // Enable SSDR usermod
175+
#define umSSDR_ENABLE_AUTO_BRIGHTNESS false // Enable auto brightness (requires USERMOD_SN_PHOTORESISTOR)
176+
#define umSSDR_INVERTED false // Inverted display
177+
#define umSSDR_COLONBLINK true // Colon blink enabled
178+
#define umSSDR_LEADING_ZERO false // Leading zero disabled
179+
#define umSSDR_DISPLAY_MASK "H:mL" // Display mask for time format
180+
181+
// Segment definitions for hours, minutes, seconds, colons, light, days, months, and years
182+
#define umSSDR_HOURS "135-143;126-134;162-170;171-179;180-188;144-152;153-161:198-206;189-197;225-233;234-242;243-251;207-215;216-224"
183+
#define umSSDR_MINUTES "9-17;0-8;36-44;45-53;54-62;18-26;27-35:72-80;63-71;99-107;108-116;117-125;81-89;90-98"
184+
#define umSSDR_SECONDS ""
185+
#define umSSDR_COLONS "266-275" // Segment range for colons
186+
#define umSSDR_LIGHT "252-265" // Segment range for light indicator (added for this project)
187+
#define umSSDR_DAYS "" // Reserved for days if needed
188+
#define umSSDR_MONTHS "" // Reserved for months if needed
189+
#define umSSDR_YEARS "" // Reserved for years if needed
190+
191+
#define umSSDR_INVERT_AUTO_BRIGHTNESS true
192+
#define umSSDR_LUX_MIN 50
193+
#define umSSDR_LUX_MAX 1000
194+
195+
// Brightness limits
196+
#define umSSDR_BRIGHTNESS_MIN 0 // Minimum brightness
197+
#define umSSDR_BRIGHTNESS_MAX 128 // Maximum brightness
198+
```
99199

100-
depending on the orientation.
200+
--------------------------------
101201

102-
# Example details:
103-
hour "59,46;47-48;50-51;52-53;54-55;57-58;49,56:0,13;1-2;4-5;6-7;8-9;11-12;3,10"
202+
*Note:* For this project, the `umSSDR_LIGHT` parameter was added to provide a dedicated segment for a light indicator.
104203

105-
there are two digits separated by ":"
204+
---
106205

107-
- 59,46;47-48;50-51;52-53;54-55;57-58;49,56
108-
- 0,13;1-2;4-5;6-7;8-9;11-12;3,10
206+
### 2. EleksTube Retro Glows Analog Nixie Tube Clock (Non-IPS Version)
109207

110-
In the first digit,
111-
the **segment A** consists of the LEDs number **59 and 46**., **segment B** consists of the LEDs number **47, 48** and so on
208+
The EleksTube project, available at [EleksTube Retro Glows Analog Nixie Tube Clock](https://elekstube.com/products/elekstube-r2-6-bit-electronic-led-luminous-retro-glows-analog-nixie-tube-clock). With the following settings, the SSDR usermod becomes more versatile and can be used with this clock as well:
112209

113-
The second digit starts again with **segment A** and LEDs **0 and 13**, **segment B** consists of the LEDs number **1 and 2** and so on
210+
my_config.h Settings:
211+
--------------------------------
212+
213+
```
214+
#define umSSDR_ENABLED true // Enable SSDR usermod
215+
#define umSSDR_ENABLE_AUTO_BRIGHTNESS false // Enable auto brightness (requires USERMOD_SN_PHOTORESISTOR)
216+
#define umSSDR_INVERTED false // Inverted display
217+
#define umSSDR_COLONBLINK false // Colon blink disabled
218+
#define umSSDR_LEADING_ZERO true // Leading zero enabled
219+
#define umSSDR_DISPLAY_MASK "H:m:s" // Display mask for time format
220+
221+
// Segment definitions for hours, minutes, seconds, colons, light, days, months, and years
222+
#define umSSDR_HOURS "20,30;21,31;22,32;23,33;24,34;25,35;26,36;27,37;28,38;29,39:0,10;1,11;2,12;3,13;4,14;5,15;6,16;7,17;8,18;9,19"
223+
#define umSSDR_MINUTES "60,70;61,71;62,72;63,73;64,74;65,75;66,76;67,77;68,78;69,79:40,50;41,51;42,52;43,53;44,54;45,55;46,56;47,57;48,58;49,59"
224+
#define umSSDR_SECONDS "100,110;101,111;102,112;103,113;104,114;105,115;106,116;107,117;108,118;109,119:80,90;81,91;82,92;83,93;84,94;85,95;86,96;87,97;88,98;89,99"
225+
#define umSSDR_COLONS "" // No colon segment mapping needed
226+
#define umSSDR_LIGHT "" // No light indicator defined
227+
#define umSSDR_DAYS "" // Reserved for days if needed
228+
#define umSSDR_MONTHS "" // Reserved for months if needed
229+
#define umSSDR_YEARS "" // Reserved for years if needed
230+
231+
#define umSSDR_INVERT_AUTO_BRIGHTNESS true
232+
#define umSSDR_LUX_MIN 50
233+
#define umSSDR_LUX_MAX 1000
234+
235+
// Brightness limits
236+
#define umSSDR_BRIGHTNESS_MIN 0 // Minimum brightness
237+
#define umSSDR_BRIGHTNESS_MAX 128 // Maximum brightness
238+
239+
#define umSSDR_NUMBERS { \
240+
{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, /* 0 */ \
241+
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* 1 */ \
242+
{ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, /* 2 */ \
243+
{ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, /* 3 */ \
244+
{ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, /* 4 */ \
245+
{ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, /* 5 */ \
246+
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, /* 6 */ \
247+
{ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, /* 7 */ \
248+
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, /* 8 */ \
249+
{ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }, /* 9 */ \
250+
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } /* Blank */ \
251+
}
252+
```
253+
254+
### 3. Lazy Clock(s) by paralyze
255+
[Lazy 7 Quick build edition](https://www.instructables.com/Lazy-7-Quick-Build-Edition/). The SSDR usermod can be used to drive this and other clock designs by [paralyze](https://www.instructables.com/member/parallyze/)
256+
For example the Lazy 7 Quick build edition has the following settings - depending on the orientation.
257+
258+
- hour "59,46;47-48;50-51;52-53;54-55;57-58;49,56:0,13;1-2;4-5;6-7;8-9;11-12;3,10"
259+
260+
- minute "37-38;39-40;42-43;44,31;32-33;35-36;34,41:21-22;23-24;26-27;28,15;16-17;19-20;18,25"
261+
262+
or
263+
264+
- hour "6,7;8,9;11,12;13,0;1,2;4,5;3,10:52,53;54,55;57,58;59,46;47,48;50,51;49,56"
265+
266+
- minute "15,28;16,17;19,20;21,22;23,24;26,27;18,25:31,44;32,33;35,36;37,38;39,40;42,43;34,41"
114267

115-
### first digit of the hour
116-
- Segment A: 59, 46
117-
- Segment B: 47, 48
118-
- Segment C: 50, 51
119-
- Segment D: 52, 53
120-
- Segment E: 54, 55
121-
- Segment F: 57, 58
122-
- Segment G: 49, 56
268+
--------------------------------
123269

124-
### second digit of the hour
270+
With these modifications, the SSDR usermod becomes even more versatile, allowing it to be used on a wide variety of segment clocks and projects.
125271

126-
- Segment A: 0, 13
127-
- Segment B: 1, 2
128-
- Segment C: 4, 5
129-
- Segment D: 6, 7
130-
- Segment E: 8, 9
131-
- Segment F: 11, 12
132-
- Segment G: 3, 10
272+
*Note:* The ability to override the LED segment mapping via `umSSDR_NUMBERS` provides additional flexibility for adapting to different physical displays.

0 commit comments

Comments
 (0)