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
Fading LEDs via PWM; v8c mod (LED = pin 9) to fix tone() conflict with PWM on pin 11; reverse relay control polarity (since HIGH = open circuit = device off); switchPower via Alt rather than Adj; retire SelFn/AdjFn variables; rename night-off and day-off to night and away modes
Copy file name to clipboardExpand all lines: README.md
+21-10Lines changed: 21 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -17,14 +17,25 @@ _Note: Many variations are possible, depending on your clock's hardware; but thi
17
17
18
18
| Function | Looks like | Notes |
19
19
| --- | --- | --- |
20
-
|**Time**|`12 34 56`| The time of day. You can choose 12h or 24h format in the options menu (1). When setting, it's in 24h format (so you can tell AM from PM) and the seconds will reset to :00 when you save. The clock keeps time during power outages and compensates for temperature effects.<br/><br/>If your clock is controlling an appliance ([relay in switched mode](#hardware-configuration)), use **Adjust** here to switch it on and off manually.|
20
+
|**Time**|`12 34 56`| The time of day. You can choose 12h or 24h format in the options menu (1). When setting, it's in 24h format (so you can tell AM from PM) and the seconds will reset to :00 when you save. The clock keeps time during power outages and compensates for temperature effects. |
21
21
|**Date**|`_2 _4 _0`<br/>(for Sun 2/4) | You can choose the date format in the options menu (2). Setting is done in three stages: first year, then month, then date.<br/>Weekdays are: 0=Sun, 1=Mon, 2=Tue, 3=Wed, 4=Thu, 5=Fri, 6=Sat |
22
-
|**Alarm**|`_7 00 1_`| Shows alarm time (always in 24hr format) and on/off status on 5th tube (1=on, 0=off) and by display brightness (bright=on, dim=off). Use **Adjust** to switch on/off. Hold **Select** to set time (same way as **Time**). When alarm sounds, press **Select** to snooze, or hold for 1sec (followed by a short beep) to silence the alarm for the day. Options menu lets you restrict the alarm to your workweek or weekend only. In a power outage, the alarm will remain set, but it will not sound if power is disconnected at alarm time. |
23
-
|**Timer**|`__ __ _0`| A countdown timer, in hours, minutes, and seconds; or `0` when stopped. Can be set to the minute, up to 18 hours. Begins running as soon as you set it, and will continue to run in the background if you change to a different function. To cancel while running, hold **Select**. When timer runs out, press **Select** to silence. If power is lost, the timer will reset to `0`. Can be configured to work as an interval timer in the options menu (10), or as an appliance timer instead ([relay in switched mode](#hardware-configuration)). |
22
+
|**Alarm**|`_7 00 1_`| Shows alarm time (always in 24hr format) and on/off status on 5th tube (1=on, 0=off) and by display brightness (bright=on, dim=off). Use **Adjust** to switch on/off. Hold **Select** to set time (same way as **Time**). When alarm sounds, press any button to snooze, or hold for 1sec (followed by a short beep) to silence the alarm for the day. Options menu lets you restrict the alarm to your workweek or weekend only. In a power outage, the alarm will remain set, but it will not sound if power is disconnected at alarm time. |
23
+
|**Timer**|`__ __ _0`| A countdown timer, in hours, minutes, and seconds; or `0` when stopped. Can be set to the minute, up to 18 hours. Begins running as soon as you set it, and will continue to run in the background if you change to a different function. To cancel while running, hold **Select**. When timer runs out, press **Select** to silence. If power is lost, the timer will reset to `0`. Can be configured to work as an interval timer in the options menu (10). |
24
24
|**Day counter**|`_1 23 __`| Shows the number of days until/since a date you specify. Set the same way as **Date.**|
25
25
|**Temperature**|`__ 38 25`| Shows the temperature of the onboard DS3231 chip (e.g. 38.25°C – I think). May not be very useful as it tends to read higher than ambient temperature and its tolerance is low. Negative temperatures indicated with leading zeroes. |
26
26
|**Tube tester**|`88 88 88`| (Disabled by default.) Cycles through all the digits on all the tubes. |
27
27
28
+
### LEDs and Relay
29
+
30
+
Later UNDBs (v8 with mods, or v9+) are equipped with controllable LEDs, as well as a relay, which can be enabled in the [hardware configuration](#hardware-configuration) in **switch mode** (such as for a radio) or **pulse mode** (such as for a bell striker). If you have one of these UNDBs:
31
+
32
+
* The LED behavior is configurable in option 7, and can be set to switch on and off with the relay if enabled (great for a radio!)
33
+
* The alarm, timer, and strike signals can be configured to use either the beeper or the relay if enabled (options 11, 21, and 31 – strike can only use the relay in pulse mode).
34
+
* With the relay in switch mode:
35
+
***Alt** will switch it on and off at any time (except in options menu). (Otherwise, **Alt** does nothing.)
36
+
* If the alarm is set to use the relay, it will switch on the relay at alarm time, and switch off two hours later. If **Alt** is used to switch it off, the alarm will be silenced for the day (skipping snooze).
37
+
* If the timer is set to use the relay, it will switch on while the timer is running, and switch off when it runs out, like a clock radio's sleep function. If **Alt** is used to switch it off, the timer will be cancelled. (The interval timer option cannot be used in this case.)
38
+
28
39
### Options Menu
29
40
30
41
* To access this, hold **Select** for 3 seconds until you see a single `1` on the hour tubes. This indicates option number 1.
@@ -36,13 +47,13 @@ _Note: Many variations are possible, depending on your clock's hardware; but thi
36
47
||**General**||
37
48
| 1 | Time format | 1 = 12-hour<br/>2 = 24-hour<br/>(time-of-day display only; setting times is always done in 24h) |
38
49
| 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/>TODO: implement options for full date every 5 minutes|
50
+
| 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 |
40
51
| 4 | Leading zero in hour, date, and month? | 0 = no<br/>1 = yes |
41
52
| 5 | Digit fade | 0–20 (in hundredths of a second) |
42
53
| 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+) |
54
+
| 7 | LED behavior | 0 = always off<br/>1 = always on<br/>2 = on, but follow night/away modes if enabled<br/>3 = off, but on when alarm/timer sounds</br>4 = off, but on with switched relay (if equipped)<br/>(Clocks with LED control only, UNDB v8+) |
44
55
| 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/>TODO: implement this|
56
+
| 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)|
46
57
||**Alarm**||
47
58
| 10 | Alarm days | 0 = every day<br/>1 = work week only (per settings below)<br/>2 = weekend only |
48
59
| 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) |
@@ -53,14 +64,14 @@ _Note: Many variations are possible, depending on your clock's hardware; but thi
53
64
| 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
65
| 22 | Timer beeper pitch | Set the same way as the alarm pitch, above<br/>(Clocks with beeper only) |
55
66
||**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) |
67
+
| 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 night/away modes (except when off starts at top of hour)<br/>(Clocks with beeper or pulse relay only) |
57
68
| 31 | Strike signal | 0 = beeper<br/>1 = relay<br/>(Clocks with both beeper and pulse relay only) |
58
69
| 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. |
70
+
||**Night mode and away mode**||
71
+
| 40 | Night mode| 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
72
| 41 | Night starts at | Time of day. |
62
73
| 42 | Night ends at | Time of day. Set to 0:00 to use the alarm time. |
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. |
74
+
| 43 |Away mode| 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
75
| 44 | First day of work week | 0–6 (Sunday–Saturday) |
65
76
| 45 | Last day of work week | 0–6 (Sunday–Saturday) |
// To control which of these display persistently vs. switch back to Time after a few seconds, search "Temporary-display mode timeout"
16
+
17
+
// These are the RLB board connections to Arduino analog input pins.
18
+
// S1/PL13 = Reset
19
+
// S2/PL5 = A1
20
+
// S3/PL6 = A0
21
+
// S4/PL7 = A6
22
+
// S5/PL8 = A3
23
+
// S6/PL9 = A2
24
+
// S7/PL14 = A7
25
+
// 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.
// -1 to disable feature (no relay item equipped); A3 if equipped (UNDB v8)
41
+
constbyterelayMode=0; //If relay is equipped, what does it do?
42
+
// 0 = switched mode: the relay will be switched to control an appliance like a radio or light fixture. If used with timer, it will switch on while timer is running (like a "sleep" function). If used with alarm, it will switch on when alarm trips; specify duration of this in switchDur.
43
+
// 1 = pulsed mode: the relay will be pulsed, like the beeper is, to control an intermittent signaling device like a solenoid or indicator lamp. Specify pulse duration in relayPulse.
44
+
constwordsignalDur=180; //sec - when pulsed signal is going, pulses are sent once/sec for this period (e.g. 180 = 3min)
45
+
constwordswitchDur=7200; //sec - when alarm triggers switched relay, it's switched on for this period (e.g. 7200 = 2hr)
46
+
constwordpiezoPulse=500; //ms - used with piezo via tone()
47
+
constwordrelayPulse=200; //ms - used with pulsed relay
48
+
49
+
//Soft power switches
50
+
constbyteenableSoftAlarmSwitch=1;
51
+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
52
+
// 0 = no. Alarm will be permanently on. Use with switched relay if the appliance has its own switch on this relay circuit.
53
+
constbyteenableSoftPowerSwitch=1; //works with switched relay only
54
+
// 1 = yes. Relay can be switched on and off directly when clock is displaying time of day (fnIsTime). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).
55
+
// 0 = no. Use if the connected appliance has its own power switch (independent of this relay circuit) or does not need to be manually switched.
56
+
57
+
//LED circuit control with PWM
58
+
constcharledPin=9;
59
+
// -1 to disable feature; 11 if equipped (UNDB v8 modded)
60
+
61
+
//When display is dim/off, a press will light the tubes for how long?
62
+
constbyteunoffDur=10; //sec
63
+
64
+
// How long (in ms) are the button hold durations?
65
+
constwordbtnShortHold=1000; //for setting the displayed feataure
66
+
constwordbtnLongHold=3000; //for for entering options menu
67
+
constbytevelThreshold=150; //ms
68
+
// When an adj up/down input (btn or rot) follows another in less than this time, value will change more (10 vs 1).
69
+
// Recommend ~150 for rotaries. If you want to use this feature with buttons, extend to ~400.
70
+
71
+
// What is the "frame rate" of the tube cleaning and display scrolling? up to 65535 ms
72
+
constwordcleanSpeed=200; //ms
73
+
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
74
+
75
+
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
76
+
constunsigned longtimeoutSet=120; //sec
77
+
constunsigned longtimeoutTempFn=5; //sec
78
+
79
+
//This clock is 2x3 multiplexed: two tubes powered at a time.
80
+
//The anode channel determines which two tubes are powered,
81
+
//and the two SN74141 cathode driver chips determine which digits are lit.
82
+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
83
+
constcharoutA1=2;
84
+
constcharoutA2=3;
85
+
constcharoutA3=4;
86
+
constcharoutA4=5;
87
+
constcharoutB1=6;
88
+
constcharoutB2=7;
89
+
constcharoutB3=8;
90
+
constcharoutB4=16; //A2 - was 9 before PWM fix pt2
0 commit comments