Nixie Clock with Arduino | Simplest Design

Making Nixie clock with Arduino UNO and opto-isolation chip only.

Feb 12, 2020

47618 views

23 respects

Components and supplies

1

UTSOURCE Electronic Parts

1

Arduino UNO

Project description

Code

Code snippet #1

text

Comments

Only logged in users can leave comments

redheaders

2 months ago

Hey, just (almost, will have RTC when it comes in the mail) completed my nixie clock project and I've found your approach hugely useful, so thanks for posting! The difference is that I started building the clock as 6 digits, and in the beginning the goal was to go all "analog" using just a bunch of 4017 counters to divide the mains frequency into seconds pulse and then just keep counting. After deciding to switch to arduino I kept one 4017 as digits switch/multiplexer. Hence the digits are chosen by sending pulses to the counter from A1 pin, and A0 resets the counter to the first digit. For some reason im displaying from the left to right lol. I've also added a BME280 temperature, humidity and pressure sensor I've had laying around for the good fun of it. I'm simply using transistors to operate the nixies, tho I wish i thought about the opto chips for the high side as now the 4017 first drives MPSA42s and only then they drive MPSA92s. Digital pins just drive the 42s. I've done streamlined the display function a bit as I found unnecessary to keep using the discrete "next digit" and "clear all" commands Dropping my code below for anyone's reference #include <TimeLib.h> #include <Wire.h> #include <Adafruit_BME280.h> int ontime = 2; int yea; int mon; int dai; int hou; int min; int sec; int temp; int hum; int press; uint32_t periodT = 30 * 1000L; // x * 1s time to display time uint32_t periodD = 3 * 1000L; // ttd date uint32_t periodTH = 3 * 1000L; // ttd temp and humidity uint32_t periodP = 3 * 1000L; //ttd pressure Adafruit_BME280 bme; void setup() { // put your setup code here, to run once: /*pin 3-12 nixie "rows" 3 - 0 12 - 9 pin a0 a1 digit rst clk */ for (int i = 2; i <= 13; i++) { pinMode(i, OUTPUT); } pinMode(A0, OUTPUT); //digit rst pinMode(A1, OUTPUT); //digit clk unsigned long time_t (); setTime(23,05,30,14,9,2024); //yeah for now im setting the time manually lol, RTC is on the way bool status = bme.begin(0x76); } void loop() { for( uint32_t tStart = millis(); (millis()-tStart) < periodT; ){ display_time(); } for( uint32_t tStart = millis(); (millis()-tStart) < periodD; ){ display_date(); } for( uint32_t tStart = millis(); (millis()-tStart) < periodTH; ){ display_humtemp(); } for( uint32_t tStart = millis(); (millis()-tStart) < periodP; ){ display_press(); } } void display_time() { digitalWrite(A0, HIGH); digitalWrite(A0, LOW); //digit reset sec = second(); min = minute(); hou = hour(); //-------------------show time---------------------- int j; //tens int k; //ones j = sec/10; k = sec%10; //-----------show second number of second display_digit(k+3); //-----------show first number of second display_digit(j+3); j = min/10; k = min%10; //-----------show second number of minute display_digit(k+3); //-----------show first number of minute display_digit(j+3); j = hou/10; k = hou%10; //-----------show second number of hour display_digit(k+3); //-----------show first number of hour display_digit(j+3); } void display_date() { digitalWrite(A0, HIGH); digitalWrite(A0, LOW); //digit reset dai = day(); mon = month(); yea = year()-2000; // didn't bothered to account for the previous century int j; //tens int k; //ones j = yea/10; k = yea%10; display_digit(k+3); display_digit(j+3); j = mon/10; k = mon%10; display_digit(k+3); display_digit(j+3); j = dai/10; k = dai%10; display_digit(k+3); display_digit(j+3); } void display_humtemp() { temp = bme.readTemperature(); hum = bme.readHumidity(); digitalWrite(A0, HIGH); digitalWrite(A0, LOW); //digit reset //-------------------show temp---------------------- int j; //tens int k; //ones j = temp/10; k = temp%10; display_digit(k+3); display_digit(j+3); //-------------------show hum---------------------- next_digit(); next_digit(); //skip two digits on display for separation j = hum/10; k = hum%10; display_digit(k+3); display_digit(j+3); } void display_press() { press=bme.readPressure()/100; int press_c=bme.seaLevelForAltitude(120.0,press); digitalWrite(A0, HIGH); digitalWrite(A0, LOW); //digit reset //-------------------show pressure---------------------- int l; //thousands int m; //hundreds int j; //tens int k; //ones l = press_c/1000; m = press_c%1000/100; j = press_c%100/10; k = press_c%10; //-----------show ones display_digit(k+3); //-----------show tens display_digit(j+3); //-----------show hundreds display_digit(m+3); //-----------show thousands display_digit(l+3); } void display_digit(int nnumber){ digitalWrite(nnumber, HIGH); next_digit(); } void next_digit(){ delay(ontime); for (int i=3; i <=12; i++) { //here I'm clearing the display digitalWrite(i, LOW); } digitalWrite(A1, HIGH); //sending a pulse to 4017 clock digitalWrite(A1, LOW); }

dr_mihav

a year ago

Hi, Do you have any recommendation for other type of Nixie tubes? Would like to use IN-14 or IN-8, but is it possible to use same setup?

Anonymous user

2 years ago

Hello, very interesting product. i will also wait for the keys to add. But I am interested in the following, is it possible to use DS1302 RTC? I currently have no DS3231 in stock. I'm not a good programmer ... Thanks.

Anonymous user

2 years ago

As I sad, I'm not a well programming man, so I think it's not enough to change only include DS3231 with Include DS1302, how about wirring CE, SCLK, I/O?

Anonymous user

2 years ago

Wow, I checked out your code. Even tho I am far from a coding expert I can see you put a lot of work into the time set function. Thanks for your hard work!

whitebank

2 years ago

Hi friend, i've finished nixie clock with two button to adjust the time, please check out here https://www.hackster.io/whitebank/make-nixie-clock-with-arduino-in-mdf-wood-case-3ef66d

whitebank

2 years ago

yes, you can use DS1302 instead of DS3231.

whitebank

2 years ago

Hi, DS1302 uses SPI communication which need 3 pins, while DS3231 uses I2C communication that needs 2 pins. Basically, you can use DS1302 for this project, but DS3231 is used to save pin for button (in next project). You can search around internet to see how to use DS1302 with Arduino. However, to save time, you should purchase DS3231, it's not expensive :)

whitebank

2 years ago

yes, take me a lot of time, anyway, i'm happy with the result. I'm not expert in programming, just program as my way, so the code looks not clearly :))

Anonymous user

2 years ago

Yes, you are right as the price is not a problem, the delivery time is a bit longer. I got the order. I'll have to wait, and in the meantime there will probably be code with buttons to set the time. thanks anyway.

Anonymous user

2 years ago

Hi! Nice project! I really love it, but I have a problem.. When turning on the clock, every single number in every tube is on. Do you know what could cause the problem? Greetings!

Anonymous user

2 years ago

are you able to write code with date displaying every 30s? or some nice renumbering effects when the numbers are changed?

Anonymous user

3 years ago

are you able to write code with date displaying every 30s? or some nice renumbering effects when the numbers are changed?

Anonymous user

4 years ago

Hi! Nice project! I really love it, but I have a problem.. When turning on the clock, every single number in every tube is on. Do you know what could cause the problem? Greetings!

Anonymous user

5 years ago

Hello, very interesting product. i will also wait for the keys to add. But I am interested in the following, is it possible to use DS1302 RTC? I currently have no DS3231 in stock. I'm not a good programmer ... Thanks.

Anonymous user

2 years ago

Yes, you are right as the price is not a problem, the delivery time is a bit longer. I got the order. I'll have to wait, and in the meantime there will probably be code with buttons to set the time. thanks anyway.

Anonymous user

2 years ago

As I sad, I'm not a well programming man, so I think it's not enough to change only include DS3231 with Include DS1302, how about wirring CE, SCLK, I/O?

Anonymous user

2 years ago

Wow, I checked out your code. Even tho I am far from a coding expert I can see you put a lot of work into the time set function. Thanks for your hard work!

whitebank

2 years ago

yes, take me a lot of time, anyway, i'm happy with the result. I'm not expert in programming, just program as my way, so the code looks not clearly :))

whitebank

2 years ago

Hi, DS1302 uses SPI communication which need 3 pins, while DS3231 uses I2C communication that needs 2 pins. Basically, you can use DS1302 for this project, but DS3231 is used to save pin for button (in next project). You can search around internet to see how to use DS1302 with Arduino. However, to save time, you should purchase DS3231, it's not expensive :)

whitebank

2 years ago

Hi friend, i've finished nixie clock with two button to adjust the time, please check out here https://www.hackster.io/whitebank/make-nixie-clock-with-arduino-in-mdf-wood-case-3ef66d

whitebank

2 years ago

yes, you can use DS1302 instead of DS3231.

Anonymous user

5 years ago

Forgive me if this is dumb question. How do you set the clock first time around?

Anonymous user

2 years ago

Thanks! I'm new to arduino. Love these nixie clocks and I want to build your design. Looking forward to the two buttons....

whitebank

2 years ago

Hi, it's a good question! I also think about that, however, i set the clock by another source code. This project just focus on how Arduino control Nixie tube as a clock. In next project, i will make complete project with two button to adjust the time

whitebank

2 years ago

Now i'm racing with time to finish it with complete MDF case. Please wait me about 2 weeks.

whitebank

2 years ago

Hi friend, i've finished nixie clock with two button to adjust the time, please check out here https://www.hackster.io/whitebank/make-nixie-clock-with-arduino-in-mdf-wood-case-3ef66d

whitebank

4 Followers

7 Projects

23

27