You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-31Lines changed: 37 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3

4
4
5
-
**A digital clock with perpetual calendar, alarm, countdown timer/appliance timer, and day counter.** Written for the Arduino Nano at the heart of [RLB Designs'](http://rlb-designs.com/) Universal Nixie Driver Board (UNDB) v5.0, featuring a DS3231 real-time clock, and driving up to 6 digits multiplexed in pairs via two SN74141 driver chips.
5
+
**A digital clock with perpetual calendar, alarm, countdown timer/appliance timer, and day counter.** Written for the Arduino Nano at the heart of [RLB Designs'](http://rlb-designs.com/) Universal Nixie Driver Board (UNDB), featuring a DS3231 real-time clock, and driving up to 6 digits multiplexed in pairs via two SN74141 driver chips. Includes support for LED and relay control for UNDB v8+.
6
6
7
7
[The latest release can be downloaded here.](https://github.com/clockspot/arduino-nixie/releases/latest) Skip to [Hardware Configuration](#hardware-configuration) for details on how to tweak the sketch.
8
8
@@ -31,40 +31,46 @@ _Note: Many variations are possible, depending on your clock's hardware; but thi
31
31
* Use **Adjust** to go to the option number you want to set (see table below); press **Select** to open it for setting (display will flash); use **Adjust** to set; and **Select** to save.
32
32
* When all done, hold **Select** to exit the options menu.
33
33
34
-
| Option | Settings |
35
-
| --- | --- |
36
-
| 1. Time format | 1 = 12-hour<br/>2 = 24-hour<br/>(time-of-day display only; setting times is always done in 24h) |
37
-
| 2. Date format | 1 = month/date/weekday<br/>2 = date/month/weekday<br/>3 = month/date/year<br/>4 = date/month/year<br/>5 = year/month/date<br/>Note that four-tube clocks will display only the first two values in each of these options. |
38
-
| 3. Display date during time? | 0 = never<br/>1 = date instead of seconds<br/>2 = full date (as above) every minute at :30 seconds<br/>3 = same as 2, but scrolls in and out |
39
-
| 4. Leading zero in hour, date, and month? | 0 = no<br/>1 = yes |
40
-
| 5. Digit fade | 0–20 (in hundredths of a second) |
41
-
| 6. Auto DST | Add 1h for daylight saving time between these dates (at 2am):<br/>0 = off<br/>1 = second Sunday in March to first Sunday in November (US/CA)<br/>2 = last Sunday in March to last Sunday in October (UK/EU)<br/>3 = first Sunday in April to last Sunday in October (MX)<br/>4 = last Sunday in September to first Sunday in April (NZ)<br/>5 = first Sunday in October to first Sunday in April (AU)<br/>6 = third Sunday in October to third Sunday in February (BZ) |
42
-
| 7. Alarm days | 0 = every day<br/>1 = work week only (per settings below)<br/>2 = weekend only |
| 9. Alarm signal | 0 = beeper<br/>1 = relay (if in switch mode, will stay on for 2 hours)<br/>(Clocks with both beeper and relay only) |
45
-
| 10. Alarm beeper pitch |[Note number on a piano keyboard](https://en.wikipedia.org/wiki/Piano_key_frequencies), from 49 (A4) to 88 (C8). Some are louder than others!<br/>(Clocks with beeper only) |
46
-
| 11. Timer signal | 0 = beeper<br/>1 = relay (if in switch mode, will stay on until timer runs down)</br>(Clocks with both beeper and relay only) |
47
-
| 12. Timer interval mode | 0 = count down and stop<br/>1 = count down and restart (interval mode)<br/>(Clocks with beeper and/or pulse relay only) |
48
-
| 13. Timer beeper pitch | Set the same way as the alarm pitch, above<br/>(Clocks with beeper only) |
49
-
| 14. Strike | Make noise on the hour:<br/>0 = off<br/>1 = single beep<br/>2 = pips<br/>3 = strike the hour (1 to 12)<br/>4 = ship's bell (hour and half hour)<br/>Will not sound during day-off/night-off (except when off starts at top of hour)<br/>(Clocks with beeper or pulse relay only) |
50
-
| 15. Strike signal | 0 = beeper<br/>1 = relay<br/>(Clocks with both beeper and pulse relay only) |
51
-
| 16. Strike beeper pitch | Set the same way as the alarm signal pitch, above. If using the pips, 63 (987 Hz) is closest to the real BBC pips frequency (1000 Hz).<br/>(Clocks with beeper only) |
52
-
| 17. Night-off | To save tube life and/or preserve your sleep, dim or shut off tubes nightly when you're not around or sleeping.<br/>0 = none (tubes fully on at night)<br/>1 = dim tubes at night<br/>2 = shut off tubes at night<br/>When off, you can press **Select** to illuminate the tubes briefly. |
53
-
| 18. Night starts at | Time of day. |
54
-
| 19. Night ends at | Time of day. Set to 0:00 to use the alarm time. At this time (whether night-off/alarm is enabled or not), all tubes will briefly cycle through all digits at full brightness to help prevent [cathode poisoning](http://www.tube-tester.com/sites/nixie/different/cathode%20poisoning/cathode-poisoning.htm). |
55
-
| 20. Day-off | To further save tube life, shut off tubes during the day when you're not around.<br/>0 = none (tubes fully on during the day)<br/>1 = clock at work (shut off all day on weekends)<br/>2 = clock at home (shut off during work hours)<br/>When off, you can press **Select** to illuminuate the tubes briefly. |
56
-
| 21. First day of work week | 0–6 (Sunday–Saturday) |
57
-
| 22. Last day of work week | 0–6 (Sunday–Saturday) |
58
-
| 23. Work starts at | Time of day. |
59
-
| 24. Work ends at | Time of day. |
60
-
| 25. LED behavior | 0 = always off<br/>1 = always on<br/>2 = on, but follow day-off and night-off if enabled<br/>3 = off, but on when alarm/timer sounds</br>4 = off, but on with switched relay (if equipped – great for radios!)<br/>(Clocks with LED control only, UNDB v5.x+) |
61
-
| 26. Temperature format | 0 = Celsius<br/>1 = Fahrenheit<br/>(Clocks with temperature function enabled only) |
34
+
|| Option | Settings |
35
+
| --- | --- | --- |
36
+
||**General**||
37
+
| 1 | Time format | 1 = 12-hour<br/>2 = 24-hour<br/>(time-of-day display only; setting times is always done in 24h) |
38
+
| 2 | Date format | 1 = month/date/weekday<br/>2 = date/month/weekday<br/>3 = month/date/year<br/>4 = date/month/year<br/>5 = year/month/date<br/>Note that four-tube clocks will display only the first two values in each of these options. |
39
+
| 3 | Display date during time? | 0 = never<br/>1 = date instead of seconds<br/>2 = full date (as above) every minute at :30 seconds<br/>3 = same as 2, but scrolls in and out<br/>4 = full date every 5 minutes at :30 seconds<br/>3 = same as 4, but scrolls in and out |
40
+
| 4 | Leading zero in hour, date, and month? | 0 = no<br/>1 = yes |
41
+
| 5 | Digit fade | 0–20 (in hundredths of a second) |
42
+
| 6 | Auto DST | Add 1h for daylight saving time between these dates (at 2am):<br/>0 = off<br/>1 = second Sunday in March to first Sunday in November (US/CA)<br/>2 = last Sunday in March to last Sunday in October (UK/EU)<br/>3 = first Sunday in April to last Sunday in October (MX)<br/>4 = last Sunday in September to first Sunday in April (NZ)<br/>5 = first Sunday in October to first Sunday in April (AU)<br/>6 = third Sunday in October to third Sunday in February (BZ) |
43
+
| 7 | LED behavior | 0 = always off<br/>1 = always on<br/>2 = on, but follow day-off and night-off if enabled<br/>3 = off, but on when alarm/timer sounds</br>4 = off, but on with switched relay (if equipped – great for radios!)<br/>(Clocks with LED control only, UNDB v8+) |
44
+
| 8 | Temperature format | 0 = Celsius<br/>1 = Fahrenheit<br/>(Clocks with temperature function enabled only) |
45
+
| 9 | Anti-cathode poisoning | Briefly cycles all digits to prevent [cathode poisoning](http://www.tube-tester.com/sites/nixie/different/cathode%20poisoning/cathode-poisoning.htm):<br/>0 = once a day, at "Night ends at" time<br/>1 = once a day, at midnight<br/>2 = every hour, at minute :01<br/>3 = every minute, at second :01 |
46
+
||**Alarm**||
47
+
| 10 | Alarm days | 0 = every day<br/>1 = work week only (per settings below)<br/>2 = weekend only |
48
+
| 11 | Alarm signal | 0 = beeper<br/>1 = relay (if in switch mode, will stay on for 2 hours)<br/>(Clocks with both beeper and relay only) |
49
+
| 12 | Alarm beeper pitch |[Note number on a piano keyboard](https://en.wikipedia.org/wiki/Piano_key_frequencies), from 49 (A4) to 88 (C8). Some are louder than others!<br/>(Clocks with beeper only) |
| 20 | Timer interval mode | 0 = count down and stop<br/>1 = count down and restart (interval mode)<br/>(Clocks with beeper and/or pulse relay only) |
53
+
| 21 | Timer signal | 0 = beeper<br/>1 = relay (if in switch mode, will stay on until timer runs down)</br>(Clocks with both beeper and relay only) |
54
+
| 22 | Timer beeper pitch | Set the same way as the alarm pitch, above<br/>(Clocks with beeper only) |
55
+
||**Strike**||
56
+
| 30 | Strike | Make noise on the hour:<br/>0 = off<br/>1 = single beep<br/>2 = pips<br/>3 = strike the hour (1 to 12)<br/>4 = ship's bell (hour and half hour)<br/>Will not sound during day-off/night-off (except when off starts at top of hour)<br/>(Clocks with beeper or pulse relay only) |
57
+
| 31 | Strike signal | 0 = beeper<br/>1 = relay<br/>(Clocks with both beeper and pulse relay only) |
58
+
| 32 | Strike beeper pitch | Set the same way as the alarm signal pitch, above. If using the pips, 63 (987 Hz) is closest to the real BBC pips frequency (1000 Hz).<br/>(Clocks with beeper only) |
59
+
||**Night-off and day-off**||
60
+
| 40 | Night-off | To save tube life and/or preserve your sleep, dim or shut off tubes nightly when you're not around or sleeping.<br/>0 = none (tubes fully on at night)<br/>1 = dim tubes at night<br/>2 = shut off tubes at night<br/>When off, you can press **Select** to illuminate the tubes briefly. |
61
+
| 41 | Night starts at | Time of day. |
62
+
| 42 | Night ends at | Time of day. Set to 0:00 to use the alarm time. At this time (whether night-off/alarm is enabled or not), all tubes will briefly cycle through all digits at full brightness to help prevent . |
63
+
| 43 | Day-off | To further save tube life, shut off tubes during the day when you're not around.<br/>0 = none (tubes fully on during the day)<br/>1 = clock at work (shut off all day on weekends)<br/>2 = clock at home (shut off during work hours)<br/>When off, you can press **Select** to illuminuate the tubes briefly. |
64
+
| 44 | First day of work week | 0–6 (Sunday–Saturday) |
65
+
| 45 | Last day of work week | 0–6 (Sunday–Saturday) |
66
+
| 46 | Work starts at | Time of day. |
67
+
| 47 | Work ends at | Time of day. |
62
68
63
69
To reset the options menu settings to "factory" defaults, hold **Select** while connecting the clock to power.
64
70
65
71
## Hardware Configuration
66
72
67
-
A number of hardware-related settings are specified in consts at the top of the sketch, which can be edited to suit the clock's hardware configuration. These include:
73
+
A number of hardware-related settings are specified in config files, one of which is included at the top of the sketch (so you can easily maintain multiple clocks with different hardware). These settings include:
68
74
69
75
***How many tubes** in the display module. Default is 6; small display adjustments are made for 4-tube clocks.
70
76
***Which functions** are enabled. Default is all but temperature and tube tester.
@@ -79,7 +85,7 @@ A number of hardware-related settings are specified in consts at the top of the
79
85
***Soft power switch** enabled (switched relay only): default is yes; appliance can be switched manually with Adjust while viewing the time of day. Change to no if the appliance has its own power switch (independent of this relay circuit) or does not need to be manually switched.
80
86
***Various other durations** for things like scrolling speed, set mode timeouts, short and long button holds, "hold to set faster" thresholds, etc.
81
87
82
-
You can also set the **defaults for the options menu** to better suit the clock's intended use.
88
+
You can also set the **defaults for the options menu**(in main code, currently) to better suit the clock's intended use.
83
89
84
90
**To compile the edited sketch:** You will need to add the [ooPinChangeInt](https://code.google.com/archive/p/oopinchangeint/downloads) and [NorthernWidget DS3231](https://github.com/NorthernWidget/DS3231) libraries to your Arduino IDE.
// To control which of these display persistently vs. switch back to Time after a few seconds, search "Temporary-display mode timeout"
14
+
15
+
// These are the UNDB v5 board connections to Arduino analog input pins.
16
+
// S1/PL13 = Reset
17
+
// S2/PL5 = A1
18
+
// S3/PL6 = A0
19
+
// S4/PL7 = A6
20
+
// S5/PL8 = A3
21
+
// S6/PL9 = A2
22
+
// S7/PL14 = A7
23
+
// A6-A7 are analog-only pins that aren't quite as responsive and require a physical pullup resistor (1K to +5V), and can't be used with rotary encoders because they don't support pin change interrupts.
24
+
25
+
// What input is associated with each control?
26
+
constbytemainSel=A2; //main select button - must be equipped
27
+
constbytemainAdjUp=A1; //main up/down buttons or rotary encoder - must be equipped
28
+
constbytemainAdjDn=A0;
29
+
constbytealtSel=0; //alt select button - if unequipped, set to 0
// In normal running mode, what do the controls do?
36
+
// -1 = nothing/switch, -2 = cycle through functions, fn in fnsEnabled[] = go to that function
37
+
// If using soft alarm/power switch per below, the control(s) set to -1 will do the switching.
38
+
constcharmainSelFn=-2;
39
+
constcharmainAdjFn=-1;
40
+
constbytealtSelFn=-1;
41
+
42
+
//What are the signal pin(s) connected to?
43
+
constcharpiezoPin=10;
44
+
constcharrelayPin=-1; //don't change - not available until UNDB v8
45
+
constbyterelayMode=0; //don't change - not available until UNDB v8
46
+
constwordsignalDur=180; //sec - when pulsed signal is going, pulses are sent once/sec for this period (e.g. 180 = 3min)
47
+
constwordswitchDur=7200; //sec - when alarm triggers switched relay, it's switched on for this period (e.g. 7200 = 2hr)
48
+
constwordpiezoPulse=500; //ms - used with piezo via tone()
49
+
constwordrelayPulse=200; //ms - used with pulsed relay
50
+
51
+
//Soft power switches
52
+
constbyteenableSoftAlarmSwitch=1;
53
+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
54
+
// 0 = no. Alarm will be permanently on. Use with switched relay if the appliance has its own switch on this relay circuit.
55
+
constbyteenableSoftPowerSwitch=0; //don't change - not available until UNDB v8
56
+
57
+
//LED circuit control
58
+
constcharledPin=-1; //don't change - not available until UNDB v8
59
+
60
+
//When display is dim/off, a press will light the tubes for how long?
61
+
constbyteunoffDur=10; //sec
62
+
63
+
// How long (in ms) are the button hold durations?
64
+
constwordbtnShortHold=1000; //for setting the displayed feataure
65
+
constwordbtnLongHold=3000; //for for entering options menu
66
+
constbytevelThreshold=150; //ms
67
+
// When an adj up/down input (btn or rot) follows another in less than this time, value will change more (10 vs 1).
68
+
// Recommend ~150 for rotaries. If you want to use this feature with buttons, extend to ~400.
69
+
70
+
// What is the "frame rate" of the tube cleaning and display scrolling? up to 65535 ms
71
+
constwordcleanSpeed=200; //ms
72
+
constwordscrollSpeed=100; //ms - e.g. scroll-in-and-out date at :30 - to give the illusion of a slow scroll that doesn't pause, use (timeoutTempFn*1000)/(displaySize+1) - e.g. 714 for displaySize=6 and timeoutTempFn=5
73
+
74
+
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
// To control which of these display persistently vs. switch back to Time after a few seconds, search "Temporary-display mode timeout"
14
+
15
+
// These are the UNDB v5 board connections to Arduino analog input pins.
16
+
// S1/PL13 = Reset
17
+
// S2/PL5 = A1
18
+
// S3/PL6 = A0
19
+
// S4/PL7 = A6
20
+
// S5/PL8 = A3
21
+
// S6/PL9 = A2
22
+
// S7/PL14 = A7
23
+
// A6-A7 are analog-only pins that aren't quite as responsive and require a physical pullup resistor (1K to +5V), and can't be used with rotary encoders because they don't support pin change interrupts.
24
+
25
+
// What input is associated with each control?
26
+
constbytemainSel=A2; //main select button - must be equipped
27
+
constbytemainAdjUp=A0; //main up/down buttons or rotary encoder - must be equipped
28
+
constbytemainAdjDn=A1;
29
+
constbytealtSel=0; //alt select button - if unequipped, set to 0
// In normal running mode, what do the controls do?
36
+
// -1 = nothing/switch, -2 = cycle through functions, fn in fnsEnabled[] = go to that function
37
+
// If using soft alarm/power switch per below, the control(s) set to -1 will do the switching.
38
+
constcharmainSelFn=-2;
39
+
constcharmainAdjFn=-1;
40
+
constbytealtSelFn=-1;
41
+
42
+
//What are the signal pin(s) connected to?
43
+
constcharpiezoPin=10;
44
+
constcharrelayPin=-1; //don't change - not available until UNDB v8
45
+
constbyterelayMode=0; //don't change - not available until UNDB v8
46
+
constwordsignalDur=180; //sec - when pulsed signal is going, pulses are sent once/sec for this period (e.g. 180 = 3min)
47
+
constwordswitchDur=7200; //sec - when alarm triggers switched relay, it's switched on for this period (e.g. 7200 = 2hr)
48
+
constwordpiezoPulse=500; //ms - used with piezo via tone()
49
+
constwordrelayPulse=200; //ms - used with pulsed relay
50
+
51
+
//Soft power switches
52
+
constbyteenableSoftAlarmSwitch=1;
53
+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
54
+
// 0 = no. Alarm will be permanently on. Use with switched relay if the appliance has its own switch on this relay circuit.
55
+
constbyteenableSoftPowerSwitch=0; //don't change - not available until UNDB v8
56
+
57
+
//LED circuit control
58
+
constcharledPin=-1; //don't change - not available until UNDB v8
59
+
60
+
//When display is dim/off, a press will light the tubes for how long?
61
+
constbyteunoffDur=10; //sec
62
+
63
+
// How long (in ms) are the button hold durations?
64
+
constwordbtnShortHold=1000; //for setting the displayed feataure
65
+
constwordbtnLongHold=3000; //for for entering options menu
66
+
constbytevelThreshold=150; //ms
67
+
// When an adj up/down input (btn or rot) follows another in less than this time, value will change more (10 vs 1).
68
+
// Recommend ~150 for rotaries. If you want to use this feature with buttons, extend to ~400.
69
+
70
+
// What is the "frame rate" of the tube cleaning and display scrolling? up to 65535 ms
71
+
constwordcleanSpeed=200; //ms
72
+
constwordscrollSpeed=100; //ms - e.g. scroll-in-and-out date at :30 - to give the illusion of a slow scroll that doesn't pause, use (timeoutTempFn*1000)/(displaySize+1) - e.g. 714 for displaySize=6 and timeoutTempFn=5
73
+
74
+
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
0 commit comments