So I was given a display out of some piece of old equipment. The display is 4 RCA Numitron DR2000 tubes. These are a lot like a LED 7 segment display in a common anode configuration. I’d like to convert this into a clock of some sort. As of right now, I’ve managed to get it working with a uno as simply a counter. (0-9999) Here’s the code I’ve got for that:
/* Count seconds from 0-9999 BCD on using pins defined below. This facilitates output on a 7-segment display driven by a 7447. */
unsigned long t0; //This will be a global variable.
// The setup routine runs once when you press reset or power up:
void setup() {
// initialize pins 2-5 for digital output. This is the ones digit.
pinMode(0, OUTPUT);
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
// Initialize pins 6-9 for digital output. This is the tens digit.
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
// Initialize pins 8-11 for digital output. This is the hundreds digit.
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
// Initialize pins A0-A3 for digital output. This is the thousands digit.
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
// Start the timer here:
t0 = millis(); // Record current time in milliseconds.
}
// The loop routine runs over and over again forever:
void loop() {
for (byte thousands=0; thousands <= 9; thousands++) {
digitalWrite(A0, (thousands >> 0) % 2); // LSB
digitalWrite(A1, (thousands >> 1) % 2);
digitalWrite(A2, (thousands >> 2) % 2);
digitalWrite(A3, (thousands >> 3) % 2); // MSB
for (byte hundreds=0; hundreds <= 9; hundreds++) {
digitalWrite(8, (hundreds >> 0) % 2); // LSB
digitalWrite(9, (hundreds >> 1) % 2);
digitalWrite(10, (hundreds >> 2) % 2);
digitalWrite(11, (hundreds >> 3) % 2); // MSB
for (byte tens=0; tens <= 9; tens++) {
digitalWrite(4, (tens >> 0) % 2); // LSB
digitalWrite(5, (tens >> 1) % 2);
digitalWrite(6, (tens >> 2) % 2);
digitalWrite(7, (tens >> 3) % 2); // MSB
for (byte ones=0; ones <= 9; ones++) {
digitalWrite(0, (ones >> 0) % 2); // LSB
digitalWrite(1, (ones >> 1) % 2);
digitalWrite(2, (ones >> 2) % 2);
digitalWrite(3, (ones >> 3) % 2); // MSB
while( millis() < t0+10 ){} // Delay until 1s after t0.
t0 = millis(); // Record current time in milliseconds.
}
}
}
}
}
Does anyone have a sketch that would work to convert this into a working clock? I’d like to add a RTC module to it as well. And figure out a way to use either GPS or NTP to keep it in sync. Also a alarm clock and temp/date function would be nice too.
And here’s a quick video of it in action.