Hey Guys,
I’ve been working on a Nixie Clock for the last couple of months after snapping up a couple of Nixie Tubes on Ebay Russia for cheap. I have now got it to the stage where is is up and running. I haven’t settled on a final housing yet so just knocked up a quick and dirty housing to keep the high voltage circuitry away from being touched while I burn it in. I have written the sketch so that between Minutes it will change numbers randomly, a random number of times and display for a random amount of time. This looks quite speccy and helps the tubes from getting Cathode Poising. I’m seeing if i’ll get sick of it happening every minute and might just re-code it so it happen at random intervals throughout the day.
Components ==>
1 x Arduino Nano Microcontroller
2 x INS-1 Nixie Lamp for Colon
4 x IN-12 Russian Nixie Tubes
4 x 74141 BCD to decimal decoder and Nixie driver IC
2 x 74HC595N 8 Bit Shift Registers IC
1 x DS1307 Real Time Clock
Lots and lots of wires and heatshrink.
Source Code ==>
// ROB NIXIE CLOCK
// 5/10/2012 v0.1
// Compiled on Arduino 1.0.1 using adafruitRTClib & ogi lumen Nixie Driver Libraries
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
// On most Arduino boards, SDA (data line) is on analog input pin 4, and SCL (clock line) is on analog input pin 5.
#include <NixieBeta4.h>
#include <Wire.h>
#include “RTClib.h”
// note the digital pins of the arduino that are connected to the nixie driver
#define dataPin 2 // data line or SER
#define clockPin 3 // clock pin or SCK
#define latchPin 4 // latch pin or RCK
// note the number of digits (nixie tubes) you have (buy more, you need more)
#define numDigits 4
// Create the Nixie object
// pass in the pin numbers in the correct order
Nixie nixie(dataPin, clockPin, latchPin);
RTC_DS1307 RTC;
int previoushour;
int previousminute;
int currenthour;
int currentminute;
int nixiedisplay;
int randNumber;
int randTime;
int randTimeCount = 0;
void setup () {
Serial.begin(57600);
Wire.begin();
RTC.begin();
// Clear the display if you wish
nixie.clear(numDigits);
// following line sets the RTC to the date & time this sketch was compiled
// RTC.adjust(DateTime(DATE, TIME));
}
void clock()
{
if (currenthour > 12) //Added for 12 Hour time instead of 24 hour
{
currenthour = currenthour - 12;
}
nixiedisplay = ((currenthour*100)+currentminute);
Serial.print(nixiedisplay);
Serial.println();
nixie.writeNumZero(nixiedisplay, numDigits);
}
void loop ()
{ //Display Initial Time once and then go into loop.
DateTime now = RTC.now();
previoushour = now.hour();
previousminute = now.minute();
currenthour = now.hour();
currentminute = now.minute();
clock();
while (1) //infinite loop
{
now = RTC.now();
currenthour = now.hour();
currentminute = now.minute();
if ((currenthour!=previoushour) | (currentminute!=previousminute)) // if either doesnt equal previous value display new values
{
// gemerate random numbers for a random period of time
randTime = random(15,30); // Change Values between 15 and 30 times before displaying Actual Time
while (randTimeCount != randTime)
{
randNumber = random(0,9999); //Display Random Number between 0 and 9999
Serial.println(randNumber);
nixie.writeNumZero(randNumber, numDigits);
delay(random(50,250)); //Delay for a random period of time between 50ms and 250ms
randTimeCount++;
}
randTimeCount = 0;
//
previoushour = now.hour();
previousminute = now.minute();
clock();
}
else //Do Nothing
{
// Serial.print(“Doing nothing”);
// Serial.println();
// delay(3000);
}
}
}