Skip to content

Commit 9348917

Browse files
committed
External config files, option number changes, v8 config file set up for input mod testing
1 parent dc16152 commit 9348917

File tree

6 files changed

+404
-170
lines changed

6 files changed

+404
-170
lines changed

README.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![Nixie clocks](https://i.imgur.com/FemMWax.jpg)
44

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+.
66

77
[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.
88

@@ -31,40 +31,46 @@ _Note: Many variations are possible, depending on your clock's hardware; but thi
3131
* 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.
3232
* When all done, hold **Select** to exit the options menu.
3333

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 |
43-
| 8. Alarm snooze | 0–60 minutes. 0 disables snooze. |
44-
| 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) |
50+
| 13 | Alarm snooze | 0–60 minutes. 0 disables snooze. |
51+
| | **Timer** | |
52+
| 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. |
6268

6369
To reset the options menu settings to "factory" defaults, hold **Select** while connecting the clock to power.
6470

6571
## Hardware Configuration
6672

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:
6874

6975
* **How many tubes** in the display module. Default is 6; small display adjustments are made for 4-tube clocks.
7076
* **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
7985
* **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.
8086
* **Various other durations** for things like scrolling speed, set mode timeouts, short and long button holds, "hold to set faster" thresholds, etc.
8187

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.
8389

8490
**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.
8591

sixtube_lm/configs/v5-4tube.h

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
const byte displaySize = 4; //number of tubes in display module. Small display adjustments are made for 4-tube clocks
2+
3+
// available clock functions, and unique IDs (between 0 and 200)
4+
const byte fnIsTime = 0;
5+
const byte fnIsDate = 1;
6+
const byte fnIsAlarm = 2;
7+
const byte fnIsTimer = 3;
8+
const byte fnIsDayCount = 4;
9+
const byte fnIsTemp = 5;
10+
const byte fnIsTubeTester = 6; //cycles all digits on all tubes 1/second, similar to anti-cathode-poisoning cleaner
11+
// functions enabled in this clock, in their display order. Only fnIsTime is required
12+
const byte fnsEnabled[] = {fnIsTime, fnIsDate, fnIsAlarm, fnIsTimer, fnIsDayCount}; //, fnIsTemp, fnIsTubeTester
13+
// 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+
const byte mainSel = A2; //main select button - must be equipped
27+
const byte mainAdjUp = A1; //main up/down buttons or rotary encoder - must be equipped
28+
const byte mainAdjDn = A0;
29+
const byte altSel = 0; //alt select button - if unequipped, set to 0
30+
31+
// What type of adj controls are equipped?
32+
// 1 = momentary buttons. 2 = quadrature rotary encoder.
33+
const byte mainAdjType = 2;
34+
35+
// 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+
const char mainSelFn = -2;
39+
const char mainAdjFn = -1;
40+
const byte altSelFn = -1;
41+
42+
//What are the signal pin(s) connected to?
43+
const char piezoPin = 10;
44+
const char relayPin = -1; //don't change - not available until UNDB v8
45+
const byte relayMode = 0; //don't change - not available until UNDB v8
46+
const word signalDur = 180; //sec - when pulsed signal is going, pulses are sent once/sec for this period (e.g. 180 = 3min)
47+
const word switchDur = 7200; //sec - when alarm triggers switched relay, it's switched on for this period (e.g. 7200 = 2hr)
48+
const word piezoPulse = 500; //ms - used with piezo via tone()
49+
const word relayPulse = 200; //ms - used with pulsed relay
50+
51+
//Soft power switches
52+
const byte enableSoftAlarmSwitch = 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+
const byte enableSoftPowerSwitch = 0; //don't change - not available until UNDB v8
56+
57+
//LED circuit control
58+
const char ledPin = -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+
const byte unoffDur = 10; //sec
62+
63+
// How long (in ms) are the button hold durations?
64+
const word btnShortHold = 1000; //for setting the displayed feataure
65+
const word btnLongHold = 3000; //for for entering options menu
66+
const byte velThreshold = 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+
const word cleanSpeed = 200; //ms
72+
const word scrollSpeed = 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
75+
const unsigned long timeoutSet = 120; //sec
76+
const unsigned long timeoutTempFn = 5; //sec

sixtube_lm/configs/v5-6tube-rotary.h

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
const byte displaySize = 6; //number of tubes in display module. Small display adjustments are made for 4-tube clocks
2+
3+
// available clock functions, and unique IDs (between 0 and 200)
4+
const byte fnIsTime = 0;
5+
const byte fnIsDate = 1;
6+
const byte fnIsAlarm = 2;
7+
const byte fnIsTimer = 3;
8+
const byte fnIsDayCount = 4;
9+
const byte fnIsTemp = 5;
10+
const byte fnIsTubeTester = 6; //cycles all digits on all tubes 1/second, similar to anti-cathode-poisoning cleaner
11+
// functions enabled in this clock, in their display order. Only fnIsTime is required
12+
const byte fnsEnabled[] = {fnIsTime, fnIsDate, fnIsAlarm, fnIsTimer, fnIsDayCount}; //, fnIsTemp, fnIsTubeTester
13+
// 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+
const byte mainSel = A2; //main select button - must be equipped
27+
const byte mainAdjUp = A0; //main up/down buttons or rotary encoder - must be equipped
28+
const byte mainAdjDn = A1;
29+
const byte altSel = 0; //alt select button - if unequipped, set to 0
30+
31+
// What type of adj controls are equipped?
32+
// 1 = momentary buttons. 2 = quadrature rotary encoder.
33+
const byte mainAdjType = 1;
34+
35+
// 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+
const char mainSelFn = -2;
39+
const char mainAdjFn = -1;
40+
const byte altSelFn = -1;
41+
42+
//What are the signal pin(s) connected to?
43+
const char piezoPin = 10;
44+
const char relayPin = -1; //don't change - not available until UNDB v8
45+
const byte relayMode = 0; //don't change - not available until UNDB v8
46+
const word signalDur = 180; //sec - when pulsed signal is going, pulses are sent once/sec for this period (e.g. 180 = 3min)
47+
const word switchDur = 7200; //sec - when alarm triggers switched relay, it's switched on for this period (e.g. 7200 = 2hr)
48+
const word piezoPulse = 500; //ms - used with piezo via tone()
49+
const word relayPulse = 200; //ms - used with pulsed relay
50+
51+
//Soft power switches
52+
const byte enableSoftAlarmSwitch = 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+
const byte enableSoftPowerSwitch = 0; //don't change - not available until UNDB v8
56+
57+
//LED circuit control
58+
const char ledPin = -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+
const byte unoffDur = 10; //sec
62+
63+
// How long (in ms) are the button hold durations?
64+
const word btnShortHold = 1000; //for setting the displayed feataure
65+
const word btnLongHold = 3000; //for for entering options menu
66+
const byte velThreshold = 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+
const word cleanSpeed = 200; //ms
72+
const word scrollSpeed = 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
75+
const unsigned long timeoutSet = 120; //sec
76+
const unsigned long timeoutTempFn = 5; //sec

0 commit comments

Comments
 (0)