Hey fellas, First time posting here, Done quite a bit of lurking. Ton of intellectuals here, And a ton of neat ideas and conversations. I have been picking away at a arduino based nixie clock for a wile now. I tumbled upon scotts arduino clock http://scott-bot.com/nixie-bot/ a wile back and after scoring some NOS tubes from Moldova thought I would give it a go.
I am certainly hardware oriented and the arduino coding is the biggest issue I have. My setup is nearly Identical to the one on Scotts page. Here is an updated version of what I am using. http://www.imageshack.com/scaled/large/854/xuoz.png 6x IN8-2 tubes 6x K155ID1 drivers and 3x 595 shift registers, As well as a 1307 RTC ( later change to DS3231 ) I know for a fact my tubes drivers and registers work as I pump digits to them through a simple arduino code I got online, 0-9 on each tube. So that confirms that's okay, RTC also function correctly through the code below and verified in serial monitor. shiftreg code, //set up the pins for communication with the shift register int latchPin = 6; // rck int clockPin = 7; //sck int dataPin = 5; //ser int x; //create a counting variable // create an array that translates decimal numbers into an appropriate byte for sending to the shift register int charTable[] = {0,128,64,192,32,160,96,224,16,144,8,136,72,200,40,168,104,232,24,152,4,132,68,196,36,164,100,228,20,148,12,140,76,204,44, 172,108,236,28,156,2,130,66,194,34,162,98,226, 18,146,10,138,74,202,42,170,106,234,26,154,6,134,70,198,38,166,102,230,22,150,14,142,78,206,46,174,110,238,30,158,1,129, 65,193,33,161,97,225,17,145,9,137,73,201,41,169,105,233,25,153}; byte nixies = 255; //initiate the byte to be sent to the shift register and set it to blank the nixies void setup(){ pinMode(latchPin, OUTPUT); pinMode(dataPin, OUTPUT); pinMode(clockPin, OUTPUT); Serial.begin(9600); } void loop(){ nixies = 255; // create a blank byte updateShiftRegister(); // send the blank byte to the shift register delay(500); for (x = 0; x<100; x++){ // count from 0 to 99 nixies = charTable[x]; // translate into a byte to send to the shift register updateShiftRegister(); //send to the shift register delay(500); Serial.print("x = "); Serial.println(x); Serial.print("nixies = "); Serial.println(nixies);} } //the process of sending a byte to the shift register void updateShiftRegister(){ digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, nixies); digitalWrite(latchPin, HIGH); } RTC code, // Date and time functions using a DS1307 RTC connected via I2C and Wire lib #include <Wire.h> #include "RTClib.h" RTC_DS1307 RTC; void setup () { Serial.begin(57600); Wire.begin(); RTC.begin(); if (! RTC.isrunning()) { Serial.println("RTC is NOT running!"); // following line sets the RTC to the date & time this sketch was compiled RTC.adjust(DateTime(__DATE__, __TIME__)); } } void loop () { DateTime now = RTC.now(); Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(now.day(), DEC); Serial.print(' '); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); Serial.print(" since midnight 1/1/1970 = "); Serial.print(now.unixtime()); Serial.print("s = "); Serial.print(now.unixtime() / 86400L); Serial.println("d"); // calculate a date which is 7 days and 30 seconds into the future DateTime future (now.unixtime() + 7 * 86400L + 30); Serial.print(" now + 7d + 30s: "); Serial.print(future.year(), DEC); Serial.print('/'); Serial.print(future.month(), DEC); Serial.print('/'); Serial.print(future.day(), DEC); Serial.print(' '); Serial.print(future.hour(), DEC); Serial.print(':'); Serial.print(future.minute(), DEC); Serial.print(':'); Serial.print(future.second(), DEC); Serial.println(); Serial.println(); delay(1000); } So that covers that. My real issues starts when I try and run the code for the actual clock. I get nothing more then 49 49 49 on my tubes. Is there a way to backwards test my code or remove parts of it to confirm one section is the culprit or another? My software skills are very weak, And if there is an arduino guy out there willing to help I would appreciate it. I have contacted Scott and he is a very helpful fellow, But a busy one too. So replies could be days or weeks away. Code below. // Nixie-Bot // Created 2013 // Scott-Bot.com #include <Wire.h> #include "RTClib.h" const int button2Pin = 10; RTC_DS1307 RTC; DateTime now; //Pin connected to RCK of 74HC595 int latchPin = 6; //Pin connected to SCK of 74HC595 int clockPin = 7; ////Pin connected to SER of 74HC595 int dataPin = 5; int testpattern = 0; int button2State = 0; unsigned long SecondCount = 0; // Second counter unsigned long MinuteCount = 0; // Second counter int randint; byte DataOut1 = B11111111; byte DataOut2 = B11111111; byte DataOut3 = B11111111; void setup () { pinMode(button2Pin, INPUT); pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); Serial.begin(57600); Wire.begin(); RTC.begin(); if (! RTC.isrunning()) { Serial.println("RTC is NOT running!"); // following line sets the RTC to the date & time this sketch was compiled RTC.adjust(DateTime(__DATE__, __TIME__)); } //Wait for power supply to power up delay(1000); } void loop () { // Every minute display a test pattern if (millis()-MinuteCount > 60000) { MinuteCount = millis(); if (testpattern == 0) { ScrollPattern(); testpattern = 0; } button2State = digitalRead(button2Pin); if (button2State == HIGH) { // Display the scrolling pattern ScrollPattern(); MinuteCount = millis(); } } // Displays the time int hourdigit1 =(now.hour())/10; int hourdigit2 =(now.hour())%10; int mindigit1 =(now.minute())/10; int mindigit2 =(now.minute())%10; int secdigit1 =(now.second())/10; int secdigit2 =(now.second())%10; SetDigit(1, hourdigit1); SetDigit(2, hourdigit2); SetDigit(3, mindigit1); SetDigit(4, mindigit2); SetDigit(5, secdigit1); SetDigit(6, secdigit2); shiftOut(); } void ScrollPattern() { // Blank the digits SetDigit(1, 10); SetDigit(2, 10); SetDigit(3, 10); SetDigit(4, 10); SetDigit(5, 10); SetDigit(6, 10); delay(250); //Scroll Loop for (int i = 1; i<=6; i++) { SetDigit(1, i); SetDigit(2, i-1); SetDigit(3, i-2); SetDigit(4, i-3); SetDigit(5, i-4); SetDigit(6, i-5); shiftOut(); delay(200); } for (int i = 7; i<=39; i++) { SetDigit(1, (i)%10); SetDigit(2, (i-1)%10); SetDigit(3, (i-2)%10); SetDigit(4, (i-3)%10); SetDigit(5, (i-4)%10); SetDigit(6, (i-5)%10); shiftOut(); delay(200); } for (int i = 10; i<=16; i++) { SetDigit(1, i); SetDigit(2, i-1); SetDigit(3, i-2); SetDigit(4, i-3); SetDigit(5, i-4); SetDigit(6, i-5); shiftOut(); delay(200); } } // Sets a digit of the display void SetDigit(int Digit, int Number) { byte BinNum; if ( Number == 0) { BinNum= B0000; } else if ( Number == 1) { BinNum= B1001; } else if ( Number == 2) { BinNum= B1000; } else if ( Number == 3) { BinNum= B0111; } else if ( Number == 4) { BinNum= B0110; } else if ( Number == 5) { BinNum= B0101; } else if ( Number == 6) { BinNum= B0100; } else if ( Number == 7) { BinNum= B0011; } else if ( Number == 8) { BinNum= B0010; } else if ( Number == 9) { BinNum= B0001; } else { BinNum= B1010; } if ( Digit == 1) { DataOut1 &= B00001111; DataOut1 |= (BinNum << 4); } else if ( Digit == 2) { DataOut1 &= B11110000; DataOut1 |= BinNum; } else if ( Digit == 3) { DataOut2 &= B00001111; DataOut2 |= (BinNum << 4); } else if ( Digit == 4) { DataOut2 &= B11110000; DataOut2 |= BinNum; } else if ( Digit == 5) { DataOut3 &= B00001111; DataOut3 |= (BinNum << 4); } else if ( Digit == 6) { DataOut3 &= B11110000; DataOut3 |= BinNum; } } // Shifts out the data to the shift registers void shiftOut() { // This shifts 8 bits out MSB first, //on the rising edge of the clock, //clock idles low //internal function setup int i=0; int pinState; //clear everything out just in case to //prepare shift register for bit shifting //ground latchPin and hold low for as long as you are transmitting digitalWrite(latchPin, 0); digitalWrite(dataPin, 0); digitalWrite(clockPin, 0); //for each bit in the byte myDataOut� //NOTICE THAT WE ARE COUNTING DOWN in our for loop //This means that %00000001 or "1" will go through such //that it will be pin Q0 that lights. for (i=7; i>=0; i--) { digitalWrite(clockPin, 0); //if the value passed to myDataOut and a bitmask result // true then... so if we are at i=6 and our value is // %11010100 it would the code compares it to %01000000 // and proceeds to set pinState to 1. if ( DataOut1 & (1<<i) ) { pinState= 1; } else { pinState= 0; } //Sets the pin to HIGH or LOW depending on pinState digitalWrite(dataPin, pinState); //register shifts bits on upstroke of clock pin digitalWrite(clockPin, 1); //zero the data pin after shift to prevent bleed through digitalWrite(dataPin, 0); } //stop shifting digitalWrite(clockPin, 0); // Shift the second word for (i=7; i>=0; i--) { digitalWrite(clockPin, 0); if ( DataOut2 & (1<<i) ) { pinState= 1; } else { pinState= 0; } digitalWrite(dataPin, pinState); digitalWrite(clockPin, 1); digitalWrite(dataPin, 0); } digitalWrite(clockPin, 0); // Shift the third word for (i=7; i>=0; i--) { digitalWrite(clockPin, 0); if ( DataOut3 & (1<<i) ) { pinState= 1; } else { pinState= 0; } digitalWrite(dataPin, pinState); digitalWrite(clockPin, 1); digitalWrite(dataPin, 0); } digitalWrite(clockPin, 0); digitalWrite(latchPin, 1); } // Read from the real time clock void GetTime () { now = RTC.now(); } Thanks guys! Chris -- You received this message because you are subscribed to the Google Groups "neonixie-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send an email to [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/neonixie-l/495ba80f-09f1-4616-915c-13b75516ce5a%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
