Interface Numitron 7 segment displays w/7447 BCD converter to Arduino as clock

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.

If you want to use NTP, I would suggest that you get a Wemos D1 mini. I have used these to make several clocks. They replace the Uno, and no RTC will be needed. But they do not have enough pins to drive your display, so I would recommend to get a pcf8575 module also.
wemos.jpg
pcf8575.jpg

pcf8575.jpg

wemos.jpg

Never have had any experience with those at all. With how these tubes are setup with the 7447's to control them, I know I need 16 pins to control just the segments. Then if I wanted to drive something like a LED or something as a second blink, I'd need one more pin. Then more pins for input if they need some kind of control. Do you have any examples I could look at?

I'd like to figure out how to get this thing running as a clock for now just as is since that wouldn't cost anything. I know it won't retain the time without a RTC though.

I just realized it didn't auto link the URL for the video.

And here's a quick video of it in action.
Video of it in action

Ok, I’ve been reading up more about numitrons. While multiplexing is widely used for 7 segment displays (LED). It’s not advisable for the numitrons since they would dim as more segments were displayed. I guess I understand now why this board has the 7447’s on it. So that kinda locks me into needing 4 pins per segment. I think I’ll end up moving this over to a mega. I’m not sure if I could pack Time/temp/humidity/gps or ntp onto a uno. I’ve used up most of the pins already. (It might work though) I don’t think I need an alarm feature for it though, so that would make things a little more simple. (Although it would be neat to have a hourly chime or something to it using a PWM pin to output.

Seems like a better course of action would be to use a adafruit ultimate gps module with a coin battery to grab time and work as a RTC. And I’ve see the DTH11 modules for temp/humidity.

Yeah counting pins (need16 just for the display) I’ll need to use a mega for this.

patracy:
Yeah counting pins (need16 just for the display) I’ll need to use a mega for this.

Nonsense! :astonished:

You were advised sensibly in #1 to use an expansion board. That would go nicely with a Nano and a DS3231 clock. In fact, both the expansion board and the clock use the same tow I2C pins, so you now have 16 free pins (and an extra two analog inputs on a Nano).

Multiplexing is only suitable for diode displays, that is elements that respond only to current in one direction. Unsuitable for resistive loads or solenoids - unless that is, you add diodes. :grinning:

Well, at risk of wasting my breath by suggesting something you're "not familiar with", you could attach the I/o expansion board I suggested directly to the display's PCB, so only 4 wires trail back to the Uno, instead of 18 or however many. Use a ds3231 RTC which also has a built-in temperature sensor. But if you want humidity as well, get an sht21 or similar. Or even a bme280 which has temp, humidity and barometric pressure. A second I/o board could drive extra LEDs and read buttons if you want to save more Uno pins.

Paul__B:
Nonsense! :astonished:

You were advised sensibly in #1 to use an expansion board. That would go nicely with a Nano and a DS3231 clock. In fact, both the expansion board and the clock use the same tow I2C pins, so you now have 16 free pins (and an extra two analog inputs on a Nano).

Multiplexing is only suitable for diode displays, that is elements that respond only to current in one direction. Unsuitable for resistive loads or solenoids - unless that is, you add diodes. :grinning:

Sorry, that statement you quoted was me referring to the current state of the display using the 7447’s and adding the other functions (Not using the wemos or expansion). Each digit requires 4 pins for ABCD. Also in my post I noted that multiplexing isn’t that great of a idea for these. I spent a few hours reading up on this last night. So now I understand specifically why that board used 7447’s. Diodes would be another approach to make it behave like a LED. But no need to reinvent the wheel if the 7447 BCD converters will work.

PaulRB:
Well, at risk of wasting my breath by suggesting something you're "not familiar with", you could attach the I/o expansion board I suggested directly to the display's PCB, so only 4 wires trail back to the Uno, instead of 18 or however many. Use a ds3231 RTC which also has a built-in temperature sensor. But if you want humidity as well, get an sht21 or similar. Or even a bme280 which has temp, humidity and barometric pressure. A second I/o board could drive extra LEDs and read buttons if you want to save more Uno pins.

That would clean things up a bit. I could add a small section of perfboard and "stitch" that onto the existing board.

I also like the wemos idea too. Mainly because I could have a web front end for the device for control.

Ok then. As mentioned, you don't need an RTC with the Wemos. None of my clocks do. They just sync up with NTC every 24hrs and keep good enough time between.

Both the Wemos and, I suspect, your Numitron displays will get slightly warm in use, so you'll need to make sure the temp sensor is away from those heat sources to get a good reading.

PaulRB:
Ok then. As mentioned, you don't need an RTC with the Wemos. None of my clocks do. They just sync up with NTC every 24hrs and keep good enough time between.

Both the Wemos and, I suspect, your Numitron displays will get slightly warm in use, so you'll need to make sure the temp sensor is away from those heat sources to get a good reading.

Do you have any example sketches? Any that happen to output as BCD?

So I happened upon this project that someone else has already done.

I don’t have a DS1307, but I did find a DS3231. (The 3231 is better anyhow from what I’ve read)
I have a DS3231 here and it works correctly when I set the time to it. (Using DS1307) I’ve updated the code to use all 4 pins for the first digit. I also shifted around the definitions of pins. I’m able to see the clock “test” itself on boot with 0000. Then it sets to the compile time of the code. But doesn’t seem to be updating from the RTC which is already set. Nor is it advancing it’s clock. The decimal point blinks, but far too slow. I’m using some of the analog pins for digital, but I don’t see that being an issue? I have a mega that I could move this all over to? Here’s the code as I modified it.

clock.txt (11.3 KB)

clock.txt (11.3 KB)