Turn tubes off at night

This topic contains 29 replies, has 9 voices, and was last updated by  gianfranco.masiello 2 years, 8 months ago.

Viewing 20 posts - 1 through 20 (of 30 total)
  • Author
    Posts
  • #28071

    patracy
    Participant

    Has anyone adjusted the firmware to incorporate turning off the tubes at night to prolong their life?

    #32560

    patracy
    Participant

    Anyone have any ideas?

    #33998

    vasques666
    Participant

    I did something like that, but I didn’t completely turn off tubes, I just dimmed them.
    I’d just edit firmware doIndicationXXX.ino (your board) to check current hour and if it >21 and <8 just not do “digitalWrite(LEpin, HIGH);”
    after this section:

    SPI.transfer(Var32>>24);
    SPI.transfer(Var32>>16);
    SPI.transfer(Var32>>8);
    SPI.transfer(Var32);

    #34002

    vasques666
    Participant

    I just slightly modded firmware for NCM107&NCT3XX to include latest updates (temperature sensor at most) and to show date+temperature every minute at 30 sec + antipoisoning at 00 sec. Also I added night dim feature from 21 to 8 hours.

    https://www.youtube.com/watch?v=LHEG2BAZatY – normal operation with modded firmware (added white colour to LED palette)

    #34003

    vasques666
    Participant

    now I’m trying to add smooth digits switch (fade-in)

    #34006

    vasques666
    Participant

    finished crossfade for digits, now it flickers only on video, but in real life it’s smooth

    #34329

    jpr984
    Participant

    I was able to do a work around by using a smart outlet timer… since the clock itself has a built in batter the time and date is kept correctly and it shuts the power off during the night and turns back on in the morning.

    does anyone know how I can lower the volume or turn off the pink panther theme from playing every time it restarts?

    #35100

    vasques666
    Participant

    I just turned it off in firmware by commenting all lines, containing word “song” (I just hate the way it sound)

    #35130

    vasques666
    Participant

    I added digital light sensor to clock

    #36273

    michaelvdheijden
    Participant

    Hi Vasques,

    Would you like to paste the code that needs to be added to get crossfade for digits?

    I really would like that option.

    I have a NCS314 shield.

    Thanks!

    Greetings Brutus.

    #36700

    michaelvdheijden
    Participant

    Hi Vasques or someone else,

    I compared the firmware from your NCM107&NCT3XX and mine NCS314 Shield. I have everything compared / copied and implemented for the fading. But it’s not working properly.

    I think the problem lays in the differents in the drivers:

    NCT818 (registers HV5122) 32-Channel, Serial-to-Parallel Converter with Open-Drain Outputs
    NCS314 (registers HV57708) 64-Channel 32-MHz Serial-to-Parallel Converter with Push-Pull Outputs.

    In the “doindication” files the SPI output is different. I think because the NCT818 needs to be writen once and the NCS314 twise?

    Here the parts that are NOT the same:
    NCT818:

    
    //-------- REG 1 ----------------------------------------------- 
      Var32=0;
     
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(5)&blankDigit(2))<<20; // s2
      digits=digits/10;
    
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(4)&blankDigit(3))<<10; //s1
      digits=digits/10;
    
      Var32|=(unsigned long) (SymbolArray[digits%10]&doEditBlink(3)&blankDigit(4)); //m2
      digits=digits/10;
    
      if (LD) Var32&=~LowerDotsMask;
        else  Var32|=LowerDotsMask;
      
      if (UD) Var32&=~UpperDotsMask; 
        else  Var32|=UpperDotsMask; 
    
      SPI.transfer(Var32>>24);
      SPI.transfer(Var32>>16);
      SPI.transfer(Var32>>8);
      SPI.transfer(Var32);
    
     //-------------------------------------------------------------------------
    
     //-------- REG 0 ----------------------------------------------- 
      Var32=0;
      
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(2)&blankDigit(5))<<20; // m1
      digits=digits/10;
    
      Var32|= (unsigned long)(SymbolArray[digits%10]&doEditBlink(1)&blankDigit(6))<<10; //h2
      digits=digits/10;
    
      Var32|= (unsigned long)SymbolArray[digits%10]&doEditBlink(0)&blankDigit(7); //h1
      digits=digits/10;
    
      if (LD) Var32&=~LowerDotsMask;  
        else  Var32|=LowerDotsMask;
      
      if (UD) Var32&=~UpperDotsMask; 
        else  Var32|=UpperDotsMask; 
         
      SPI.transfer(Var32>>24);
      SPI.transfer(Var32>>16);
      SPI.transfer(Var32>>8);
      SPI.transfer(Var32);
      if ((hour() < TimeToSleep) & (hour() >= TimeToWake))
    //  if (!light)
      {
        digitalWrite(LEpin, HIGH);
      } else {    
        if ((counter2 % SleepDim) == 0) digitalWrite(LEpin, HIGH);   
      }
    //-------------------------------------------------------------------------
    

    NCS314:

    
    //-------- REG 1 ----------------------------------------------- 
      Var32=0;
     
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(5))<<20; // s2
      digits=digits/10;
    
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(4))<<10; //s1
      digits=digits/10;
    
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(3)); //m2
      digits=digits/10;
    
      if (LD) Var32|=LowerDotsMask;
        else  Var32&=~LowerDotsMask;
      
      if (UD) Var32|=UpperDotsMask;
        else Var32&=~UpperDotsMask;  
    
      for (int i=1; i<=32; i++)
      {
       i=i+32;
       int newindex=16*(3-(ceil((float)i/4)*4-i))+ceil((float)i/4); 
       i=i-32;
       /*Serial.print("i=");
       Serial.print(i);
       Serial.print(" newindex=");
       Serial.println(newindex);*/
       if (newindex<=32) bitWrite(New32_L, newindex-1, bitRead(Var32, i-1));
        else bitWrite(New32_H, newindex-32-1, bitRead(Var32, i-1));
      }
     //-------------------------------------------------------------------------
    
     //-------- REG 0 ----------------------------------------------- 
      Var32=0;
      
      Var32|=(unsigned long)(SymbolArray[digits%10]&doEditBlink(2))<<20; // m1
      digits=digits/10;
    
      Var32|= (unsigned long)(SymbolArray[digits%10]&doEditBlink(1))<<10; //h2
      digits=digits/10;
    
      Var32|= (unsigned long)SymbolArray[digits%10]&doEditBlink(0); //h1
      digits=digits/10;
    
      if (LD) Var32|=LowerDotsMask;
        else  Var32&=~LowerDotsMask;
      
      if (UD) Var32|=UpperDotsMask;
        else Var32&=~UpperDotsMask;  
    
      for (int i=1; i<=32; i++)
      {
       int newindex=16*(3-(ceil((float)i/4)*4-i))+ceil((float)i/4); 
       if (newindex<=32) bitWrite(New32_L, newindex-1, bitRead(Var32, i-1));
        else bitWrite(New32_H, newindex-32-1, bitRead(Var32, i-1));
      }
    
      SPI.transfer((New32_H)>>24);
      SPI.transfer((New32_H)>>16);
      SPI.transfer((New32_H)>>8);
      SPI.transfer(New32_H);
      
      SPI.transfer((New32_L)>>24);
      SPI.transfer((New32_L)>>16);
      SPI.transfer((New32_L)>>8);
      SPI.transfer(New32_L);
    
      digitalWrite(LEpin, HIGH); //<<-- это правильно H -> L
      digitalWrite(LEpin, LOW); // <<-- это правильно H -> L
    //-------------------------------------------------------------------------
    

    Pasting the NCT818 to NCS314 results in perfect fading but no logical orders. The numers jump from left to right in random order.

    Can somebody help in adjusting this SPI output so it can work on the NCS314 with the HV57708?

    Thank you very much!

    #36930

    JvS
    Participant

    Hallo Michael and or Vasques666,

    I got my NCS314 working over the weekend and have also been looking into the possibility to fade in/out. I got the NCS314 v2.3 that uses 2 HV5122 drivers and I have the feeling that the fading is not possible with these drivers but then I saw your post where you mention that an NCT818 with the same driver chips has working fade in/out. Looking at the code pasted above though I do not see how that code would enable fading.

    If someone can share the entire code for a working fade in/out with the HV5122 driver would be great.

    @michael, I see you also have the NCS314 but with the single 64-bit driver (so version 3.x of the hardware I guess). If the fading works for you but the digits get mixed up you likely have a mixup somewhere with the bitpatterns you send over SPI.

    For the HV5122 you send twice 32bit unsigned longs, in both cases the 2 most significant bits are for the dots and then you have 3 * 10 bits for the numbers. It took me while to figure it out, not sure how good you are with bit-logic but if you share your code (the original and the mixed up fading code) happy to have a look.

    Groeten Johan

    #36931

    michaelvdheijden
    Participant

    @Johan,

    Take a look at this code. Here you can find exactly what you need for your board! 😉 (Code added by Vasques666).

    The most of the fading code is found in the top of the “doIndication818.ino” file. Compare this with you standard firmware file and add the changes to yours.
    In the “doIndication818.h” only one line needs to be changed:
    const unsigned int fpsLimit=1000;

    In the “NixieclockNCT818.ino” file some things are added search for:

    const int TimeToSleep = 21;
    const int TimeToWake = 8;
    
    static String prevstringToDisplay = "000000";
    
    prevstringToDisplay = PreZero(hour()) + PreZero(minute()) + PreZero(second()-1);

    Hope this will help you.

    I see you are dutch, maybe you can take a look at this page here I explained some more detailes on the problem I have.
    Maybe we can get in touch with each other through that forum so we can take a look at my code.

    Thanks!

    Greetings.

    #38723

    gg
    Participant

    this msg is for vasques666, of whom i got their modified firmware for this board.

    the firmware is great, in that now i can have the tubes dim at the times i desire.
    it also gets rid of that startup song when the units powered up.
    it also has a better color selection ability of the colored leds on the base of each tube.

    but there is one feature in this custom firmware that i would like to remove, because i do not have a temperature sensor.
    can i know what lines can be removed from the firmware to disable this feature – the clock, every minute at the :30 second mark for a few seconds shows the temperature. i have no sensor so it means every minute i see 5 seconds of 01.0

    thanks for any help. also, for anyone looking to install this custom firmware, he posted a link to it on his youtube page here (in the comments section)

    • This reply was modified 3 years, 5 months ago by  gg.
    #38980

    vasques666
    Participant

    Hi, gg!
    Sorry for late answer, if you want to disable temperature indication, you need to change function modesChanger() from

    {
      if (editMode == true) return;
      if (value[ModeChangeInIndex] == 0) return;
      static unsigned long lastTimeModeChanged = millis();
      static unsigned long lastTimeAntiPoisoningIterate = millis();
      static int transnumber = 0;
      if (((millis() - lastTimeModeChanged) > modesChangePeriod) && (second() >= 30))
      {
        lastTimeModeChanged = millis();
        if (transnumber == 0) {
          menuPosition = DateIndex;
          modesChangePeriod = value[ModeChangeOutIndex] * 1000;
        }
        if (transnumber == 1) {
          menuPosition = TemperatureIndex;
          modesChangePeriod = value[ModeChangeOutIndex] * 1000;
        }
        if (transnumber == 2) {
          menuPosition = TimeIndex;
          modesChangePeriod = value[ModeChangeInIndex] * 40000;
        }
        transnumber++;
        if (transnumber > 2) transnumber = 0;
        if (modeChangedByUser == true)
        {
          menuPosition = TimeIndex;
        }
        modeChangedByUser = false;
      }
      if (((millis() - lastTimeModeChanged) < 1000) || (second() == 0))
      {
        if ((millis() - lastTimeAntiPoisoningIterate) > 50)
        {
          lastTimeAntiPoisoningIterate = millis();
          if (menuPosition == TimeIndex) stringToDisplay = antiPoisoning2(updateTemperatureString(getTemperature(value[DegreesFormatIndex])), getTimeNow());
          if (menuPosition == DateIndex) stringToDisplay = antiPoisoning2(getTimeNow(), PreZero(day()) + PreZero(month()) + PreZero(year() % 1000) );
          if (menuPosition == TemperatureIndex) stringToDisplay = antiPoisoning2(PreZero(day()) + PreZero(month()) + PreZero(year() % 1000), updateTemperatureString(getTemperature(value[DegreesFormatIndex])));
          // Serial.println("StrTDInToModeChng="+stringToDisplay);
        }
      } else
      {
        transactionInProgress = false;
      }
    }

    to

    {
      if (editMode == true) return;
      if (value[ModeChangeInIndex] == 0) return;
      static unsigned long lastTimeModeChanged = millis();
      static unsigned long lastTimeAntiPoisoningIterate = millis();
      static int transnumber = 0;
      if (((millis() - lastTimeModeChanged) > modesChangePeriod) && (second() >= 30))
      {
        lastTimeModeChanged = millis();
        if (transnumber == 0) {
          menuPosition = DateIndex;
          modesChangePeriod = value[ModeChangeOutIndex] * 1000;
        }
    //    if (transnumber == 1) {
    //      menuPosition = TemperatureIndex;
    //      modesChangePeriod = value[ModeChangeOutIndex] * 1000;
    //    }
        if (transnumber == 1) {
          menuPosition = TimeIndex;
          modesChangePeriod = value[ModeChangeInIndex] * 40000;
        }
        transnumber++;
        if (transnumber > 1) transnumber = 0;
        if (modeChangedByUser == true)
        {
          menuPosition = TimeIndex;
        }
        modeChangedByUser = false;
      }
      if (((millis() - lastTimeModeChanged) < 1000) || (second() == 0))
      {
        if ((millis() - lastTimeAntiPoisoningIterate) > 50)
        {
          lastTimeAntiPoisoningIterate = millis();
          if (menuPosition == TimeIndex) stringToDisplay = antiPoisoning2(PreZero(day()) + PreZero(month()) + PreZero(year() % 1000), getTimeNow());
          if (menuPosition == DateIndex) stringToDisplay = antiPoisoning2(getTimeNow(), PreZero(day()) + PreZero(month()) + PreZero(year() % 1000) );
        }
      } else
      {
        transactionInProgress = false;
      }
    }
    • This reply was modified 3 years, 3 months ago by  vasques666.
    #38990

    gg
    Participant

    thank you so much vasques for that replacement info,
    now the clock does not show the temperature every minute since i do not have anything to monitor temperature.

    if you should happen to stop by here again, i did have two final things, that would make this modded firmware by you perfect for me –

    1. is there code i can alter in order to not have it show both forms of the hour every second )i.e. when it flashes between 08 and 20, or 11 and 23, every second), i would like it to either show one or the other constantly

    2. is it possible to have the date show as MONTH DAY YEAR instead of the default DAY MONTH YEAR

    thanks again for all you effort, as this nixie board is nice but its shame the creators haven’t done much with updating firmware and adding options, whereas you yourself have taken it on and done a good job allowing me to alter many options i always wanted instead of the default firmware.
    take care

    #38996

    vasques666
    Participant

    As far as I can understand, you are using AM PM time format and I use 24h format, so I’ll look forward to modify firmware for you.
    Date format is set by
    if (menuPosition == DateIndex) stringToDisplay = antiPoisoning2(getTimeNow(), PreZero(day()) + PreZero(month()) + PreZero(year() % 1000) );
    so you need to modify it to
    if (menuPosition == DateIndex) stringToDisplay = antiPoisoning2(getTimeNow(), PreZero(month()) + PreZero(day()) + PreZero(year() % 1000) );
    and modify

    String updateDateString()
    {
     // static unsigned long lastTimeDateUpdate = millis();
      static unsigned long lastTimeDateUpdate = millis()+1001;
      static String DateString = PreZero(day()) + PreZero(month()) + PreZero(year() % 1000);
      if ((millis() - lastTimeDateUpdate) > 1000)
      {
        lastTimeDateUpdate = millis();
    #ifdef tubes8
        DateString = PreZero(day()) + PreZero(month()) + year();
    #endif
    #ifdef tubes6
        DateString = PreZero(day()) + PreZero(month()) + PreZero(year() % 1000);
    #endif
      }
      return DateString;

    to

    String updateDateString()
    {
     // static unsigned long lastTimeDateUpdate = millis();
      static unsigned long lastTimeDateUpdate = millis()+1001;
      static String DateString = PreZero(month()) + PreZero(day()) + PreZero(year() % 1000);
      if ((millis() - lastTimeDateUpdate) > 1000)
      {
        lastTimeDateUpdate = millis();
    #ifdef tubes8
        DateString = PreZero(month()) + PreZero(day()) + year();
    #endif
    #ifdef tubes6
        DateString = PreZero(month()) + PreZero(day()) +  PreZero(year() % 1000);
    #endif
      }
      return DateString;

    please write back with results

    #38997

    vasques666
    Participant

    Just remember, in setup mode you need to set date by Day/Month/Year format (I don’t want to mess with settings right now) 😉

    To use 12h format you need to change

    String updateDisplayString()
    {
      static int prevS=-1;
      prevstringToDisplay = PreZero(hour()) + PreZero(minute()) + PreZero(second()-1);
      if (second()!=prevS)
      {
        prevS=second();
        return getTimeNow();
    
      } else  return stringToDisplay;
    }

    to

    String updateDisplayString()
    {
      static int prevS=-1;
      prevstringToDisplay = PreZero(hourFormat12()) + PreZero(minute()) + PreZero(second()-1);
      if (second()!=prevS)
      {
        prevS=second();
        return getTimeNow();
    
      } else  return stringToDisplay;
    }
    • This reply was modified 3 years, 3 months ago by  vasques666.
    • This reply was modified 3 years, 3 months ago by  vasques666.
    #39000

    vasques666
    Participant
    #39002

    vasques666
    Participant

    oh, I forgot, that in this firmware I added lighting sensor to dim tubes, if you need firmware without it, here it is

    • This reply was modified 3 years, 3 months ago by  vasques666.
    • This reply was modified 3 years, 3 months ago by  vasques666.
    • This reply was modified 3 years, 3 months ago by  vasques666.
Viewing 20 posts - 1 through 20 (of 30 total)

You must be logged in to reply to this topic.