I bought an IN-18 Russian Nixie Tube clock that can be controlled by RS-232 (Serial), so obviously I got to work writing a program to control it through an arduino uno.  The materials that you will need:

  • Arduino
  • Breadboard
  • Chronodot 2.0 or other RTC chip
  • Chronodot arduino library
  • RS-232 controllable clock or display
  • Thermistor (optional)
  • Solid State Relay and Motion PIR (optional)
  1. Breadboard the Chronodot and connect SCL to A5 and SDA to A4.  Connect the serial to 8 for RX and 7 for TX.  Connect solid state relay to output of PIR OR to pin 4. Connect the DHT-11 thermometer to pin 2 if you have it and connect the output of the PIR to pin 3 if you want the arduino to control the on and offness.
  2. Arduino sketch below and the Chronodot and DHT-11 libraries here.  This sketch will, every 5 minutes, scroll the time across a 6 digit display and then show the temperature in Fahrenheit. In my clock to blank the display you send ‘b’, so change that to match your own implementation.  If you are not using an SSR and PIR comment out the entire Void intrUp() and also comment out “digitalWrite(ssrPin, LOW);” near the end of the sketch.  If you are not using the DHT-11 or other thermometers comment out the #include <DHT.h>, the #define s for it and also remove void getTempClock() and the call to it near the end of the sketch.


#include <DHT.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <Chronodot.h>


#define DHTTYPE DHT11 // DHT 11
#define DHTPIN 2
int pirPin = 3;
DHT dht(DHTPIN, DHTTYPE);
int ssrPin = 4;
//int sensorPin = 0;
Chronodot chronodot = Chronodot();
SoftwareSerial nixSerial = SoftwareSerial(8,7); //8 is rx and 7 is tx


void setup() {
pinMode(ssrPin, OUTPUT);
nixSerial.begin(9600);
attachInterrupt(1, intrUp, RISING);
dht.begin();
}


void intrUp(){
digitalWrite(ssrPin, HIGH);
}


void loop() {
sendToClock();
//sendToSerial();
delay(1000);
}


void sendToClock(){
chronodot.readTimeDate(); //get date from RTC
//Now send to clock
printPadded(chronodot.timeDate.hours);
printPadded(chronodot.timeDate.minutes);
printPadded(chronodot.timeDate.seconds);
nixSerial.println("");


int minutes = chronodot.timeDate.minutes;
int hours = chronodot.timeDate.hours;
int seconds = chronodot.timeDate.seconds;


String minutes2 = String(minutes);
String hours2 = String(hours);
String seconds2 = String(seconds);


if (seconds == 00){
if ((minutes == 0) || (minutes == 5) || (minutes == 10) || (minutes == 15) || (minutes == 20) || (minutes == 25) || (minutes == 30) || (minutes == 35) || (minutes == 40) || (minutes == 45) || (minutes == 50) || (minutes == 55)) {

int i = 0;

if (i == 0, i++) {
nixSerial.print(hours2.substring(0,1));
nixSerial.print(hours2.substring(1,2));
nixSerial.print(minutes2.substring(0,1));
nixSerial.print(minutes2.substring(1,2));
nixSerial.print(seconds2.substring(0,1));
nixSerial.println(seconds2.substring(1,2));
delay(1000);
}
if (i == 1, i++) {
nixSerial.print(hours2.substring(1,2));
nixSerial.print(minutes2.substring(0,1));
nixSerial.print(minutes2.substring(1,2));
nixSerial.print(seconds2.substring(0,1));
nixSerial.print(seconds2.substring(1,2));
nixSerial.println(" ");
delay(1000);
}


if (i == 2, i++) {
nixSerial.print(minutes2.substring(0,1));
nixSerial.print(minutes2.substring(1,2));
nixSerial.print(seconds2.substring(0,1));
nixSerial.print(seconds2.substring(1,2));
nixSerial.println(" ");
delay(1000);
}


if (i == 3, i++) {
nixSerial.print(minutes2.substring(1,2));
nixSerial.print(seconds2.substring(0,1));
nixSerial.print(seconds2.substring(1,2));
nixSerial.println(" ");
delay(1000);
}


if (i == 4, i++) {
nixSerial.print(seconds2.substring(0,1));
nixSerial.print(seconds2.substring(1,2));
nixSerial.println(" ");
delay(1000);
}


if (i == 5, i++) {
nixSerial.print(seconds2.substring(1,2));
nixSerial.println(" ");
delay(1000);
}


if (i == 6, i++) {
nixSerial.println("b");
delay(1000);
}


if (i == 7, i++) {
getTempClock();
delay(6000);
digitalWrite(ssrPin, LOW);
}
}
}
}


void getTempClock() {
float temperatureC = dht.readTemperature();
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
nixSerial.println(temperatureF);
}


void printPadded(int num) {
if(num < 10)
nixSerial.print('0');
nixSerial.print(num);
}

Leave a Reply