M5StickC Nixie tube Clock



  • @skink said in M5StickC Nixie tube Clock:

    Grus skink

    When you change something like adding library you need to restart arduino

    Try upload speed 150000 as that was what mine was set to when I installed it.
    BTW are you suing the provided black usb cable?



  • @ajb2k3 Hello @all,
    I've done everything like this, I also have a few more library´s.
    But the program doesn't want to run on the M5Stick-C.
    It is always only shown to me that an error occurred during compiling for the board M5Stick-C.
    The program stops and that was it.
    Means I don't get the program complicated at all, so I didn't even install it.
    Can someone send me the link to the program again or send me a copy.
    I am really in despair, because all examples from the Arduino environment for the M5Stick-C can be installed and run problem-free!
    Greetings Skink



  • If @ajb2k3's suggestion didn't help, you could look into this:

    I am not sure, but did you this: (from: https://github.com/McOrts/M5StickC_Nixie_tube_Clock)

    Update Nixie Tube images

    Execute the lcd-image-converter.exe include in this repository.

    " Png or Jpg is read from File->Open Menu. The image will be displayed when loaded.
    Select: Option->Conversions Menu. The top Preset: selects "Color R5G6B5".
    Select: Image tap and select “8 bit” for Block size :. Press "OK".
    The example "vfd_35x67_8.c" is output by "Convert ..." in File-Convert Menu. Know in advance the destination path. Tick: Import All Images You can also output all the images with “Convert ... all”.
    Edit .c converted file. You will get an error as it is, so fix it with your editor.

    " Change: "Static const uint8_t image_data_vfd_35x67 [4690] = {" at the top of the file deleting "image_data_" as result of "static const uint8_t vfd_35x67_8 [4690] = {".
    At the bottom of delete de entire line: "const tImage vfd_35x67 = {image_data_vfd_35x67, 35, 67, 8};
    Save the example "vfd_35x67_8".c***

    May be you could send us the complete compiler-error-listing again, as the board-selection is correct now.

    (Btw: as I don't have a M5Stick-C, i can not check even my own suggestions!)



  • I'm not sure what could be wrong as I have just compiled it

    #include <M5StickC.h>
    #include "vfd_18x34.c"
    #include "vfd_35x67.c"
    
    RTC_TimeTypeDef RTC_TimeStruct;
    RTC_DateTypeDef RTC_DateStruct;
    
    int mode_ = 3; // 3:2Lines 2: 2Lines(YYMM), 1:1Line
    const uint8_t*n[] = { // vfd font 18x34
      vfd_18x34_0,vfd_18x34_1,vfd_18x34_2,vfd_18x34_3,vfd_18x34_4,
      vfd_18x34_5,vfd_18x34_6,vfd_18x34_7,vfd_18x34_8,vfd_18x34_9
      };
    const uint8_t*m[] = { // vfd font 35x67
      vfd_35x67_0,vfd_35x67_1,vfd_35x67_2,vfd_35x67_3,vfd_35x67_4,
      vfd_35x67_5,vfd_35x67_6,vfd_35x67_7,vfd_35x67_8,vfd_35x67_9
      };
    const char *monthName[12] = {
      "Jan", "Feb", "Mar", "Apr", "May", "Jun",
      "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
    };
    
    
    void setup(void){ 
      M5.begin();
      pinMode(M5_BUTTON_HOME, INPUT);
      M5.Lcd.fillScreen(BLACK);
      M5.Lcd.setRotation(1);
      M5.Axp.ScreenBreath(10);             // 7-15
      // rtc setup start ---------------------------------------------
      String pt = (__DATE__ " " __TIME__); // PC DATE TIME READ
      //000000000011111111112  Read data
      //012345678901234567890
      //Jun  6 2019 07:20:41
      char m1[3]; int  m2; // Month conversion ( Jun to 6 )
      (pt.substring(0,3)).toCharArray(m1,4);
      for (int mx = 0; mx < 12; mx ++) {
        if (strcmp(m1, monthName[mx]) == 0){m2 = mx + 1; break;}
      }
      RTC_DateTypeDef DateStruct;         // Month, Date, Year 
      DateStruct.Month   = m2;
      DateStruct.Date    = (pt.substring(4, 6)).toInt();
      DateStruct.Year    = (pt.substring(7,11)).toInt();
      M5.Rtc.SetData(&DateStruct);
      RTC_TimeTypeDef TimeStruct;         // Hours, Minutes, Seconds 
      TimeStruct.Hours   = (pt.substring(12,14)).toInt();
      TimeStruct.Minutes = (pt.substring(15,17)).toInt();
      TimeStruct.Seconds = (pt.substring(18,20)).toInt();
      M5.Rtc.SetTime(&TimeStruct);
      // rtc setup end -----------------------------------------------
    }
     
    void loop(void){ 
      if(digitalRead(M5_BUTTON_HOME) == LOW){
        if (mode_ == 3){mode_ = 1;M5.Lcd.fillScreen(BLACK);return;}
        if (mode_ == 2){mode_ = 3;M5.Lcd.fillScreen(BLACK);return;}
        if (mode_ == 1){mode_ = 2;M5.Lcd.fillScreen(BLACK);return;}
      }
      if ( mode_ == 3 ){ vfd_3_line();}   // hh,mm,ss
      if ( mode_ == 2 ){ vfd_2_line();}   // yyyy,mm,dd,hh,mm,ss
      if ( mode_ == 1 ){ vfd_1_line();}   // mm,ss
      delay(500);
    }
     
    void vfd_3_line(){
      M5.Rtc.GetTime(&RTC_TimeStruct);
      M5.Rtc.GetData(&RTC_DateStruct);
      int h1 = int(RTC_TimeStruct.Hours / 10 );
      int h2 = int(RTC_TimeStruct.Hours - h1*10 );
      int i1 = int(RTC_TimeStruct.Minutes / 10 );
      int i2 = int(RTC_TimeStruct.Minutes - i1*10 );
      int s1 = int(RTC_TimeStruct.Seconds / 10 );
      int s2 = int(RTC_TimeStruct.Seconds - s1*10 );
      
      M5.Lcd.pushImage(  2,0,35,67, (uint16_t *)m[h1]);
      M5.Lcd.pushImage( 41,0,35,67, (uint16_t *)m[h2]);
      M5.Lcd.drawPixel( 79,22, ORANGE); M5.Lcd.drawPixel( 79,48,ORANGE); 
      M5.Lcd.drawPixel( 79,21, YELLOW); M5.Lcd.drawPixel( 79,47,YELLOW); 
      M5.Lcd.pushImage( 83,0,35,67, (uint16_t *)m[i1]);
      M5.Lcd.pushImage(121,0,35,67, (uint16_t *)m[i2]);
      M5.Lcd.pushImage(120,45,18,34, (uint16_t *)n[s1]);
      M5.Lcd.pushImage(140,45,18,34, (uint16_t *)n[s2]);
      
      if ( s1 == 0 && s2 == 0 ){ fade();}
    }
    
    void vfd_2_line(){
      M5.Rtc.GetTime(&RTC_TimeStruct);
      M5.Rtc.GetData(&RTC_DateStruct);
      //Serial.printf("Data: %04d-%02d-%02d\n",RTC_DateStruct.Year,RTC_DateStruct.Month,RTC_DateStruct.Date);
      //Serial.printf("Week: %d\n",RTC_DateStruct.WeekDay);
      //Serial.printf("Time: %02d : %02d : %02d\n",RTC_TimeStruct.Hours,RTC_TimeStruct.Minutes,RTC_TimeStruct.Seconds);
      // Data: 2019-06-06
      // Week: 0
      // Time: 09 : 55 : 26
      int y1 = int(RTC_DateStruct.Year    / 1000 );
      int y2 = int((RTC_DateStruct.Year   - y1*1000 ) / 100 );
      int y3 = int((RTC_DateStruct.Year   - y1*1000 - y2*100 ) / 10 );
      int y4 = int(RTC_DateStruct.Year    - y1*1000 - y2*100 - y3*10 );
      int j1 = int(RTC_DateStruct.Month   / 10);
      int j2 = int(RTC_DateStruct.Month   - j1*10 );
      int d1 = int(RTC_DateStruct.Date    / 10 );
      int d2 = int(RTC_DateStruct.Date    - d1*10 );
      int h1 = int(RTC_TimeStruct.Hours   / 10) ;
      int h2 = int(RTC_TimeStruct.Hours   - h1*10 );
      int i1 = int(RTC_TimeStruct.Minutes / 10 );
      int i2 = int(RTC_TimeStruct.Minutes - i1*10 );
      int s1 = int(RTC_TimeStruct.Seconds / 10 );
      int s2 = int(RTC_TimeStruct.Seconds - s1*10 );
       
      M5.Lcd.pushImage(  0, 0,18,34, (uint16_t *)n[y1]); 
      M5.Lcd.pushImage( 19, 0,18,34, (uint16_t *)n[y2]);
      M5.Lcd.pushImage( 38, 0,18,34, (uint16_t *)n[y3]);
      M5.Lcd.pushImage( 57, 0,18,34, (uint16_t *)n[y4]);
      M5.Lcd.drawPixel( 77,13, ORANGE); M5.Lcd.drawPixel( 77,23,ORANGE);
      M5.Lcd.pushImage( 80, 0,18,34, (uint16_t *)n[j1]);
      M5.Lcd.pushImage( 99, 0,18,34, (uint16_t *)n[j2]);
      M5.Lcd.drawPixel(118,13, ORANGE); M5.Lcd.drawPixel(119,23,ORANGE);
      M5.Lcd.pushImage(120, 0,18,34, (uint16_t *)n[d1]);
      M5.Lcd.pushImage(140, 0,18,34, (uint16_t *)n[d2]);
                                                        
      M5.Lcd.pushImage( 00,40,18,34, (uint16_t *)n[h1]);
      M5.Lcd.pushImage( 20,40,18,34, (uint16_t *)n[h2]);
      M5.Lcd.drawPixel( 48,54, ORANGE); M5.Lcd.drawPixel( 48,64,ORANGE); 
      M5.Lcd.pushImage( 60,40,18,34, (uint16_t *)n[i1]);
      M5.Lcd.pushImage( 80,40,18,34, (uint16_t *)n[i2]);
      M5.Lcd.drawPixel(108,54, ORANGE); M5.Lcd.drawPixel(108,64,ORANGE);
      M5.Lcd.pushImage(120,40,18,34, (uint16_t *)n[s1]);
      M5.Lcd.pushImage(140,40,18,34, (uint16_t *)n[s2]);
     
      if ( i1 == 0 && i2 == 0 ){ fade();}
    }
     
    void vfd_1_line(){
      M5.Rtc.GetTime(&RTC_TimeStruct);
      M5.Rtc.GetData(&RTC_DateStruct);
      int i1 = int(RTC_TimeStruct.Minutes / 10 );
      int i2 = int(RTC_TimeStruct.Minutes - i1*10 );
      int s1 = int(RTC_TimeStruct.Seconds / 10 );
      int s2 = int(RTC_TimeStruct.Seconds - s1*10 );
      
      M5.Lcd.pushImage(  2,6,35,67, (uint16_t *)m[i1]);
      M5.Lcd.pushImage( 41,6,35,67, (uint16_t *)m[i2]);
      M5.Lcd.drawPixel( 79,28, ORANGE); M5.Lcd.drawPixel( 79,54,ORANGE); 
      M5.Lcd.drawPixel( 79,27, YELLOW); M5.Lcd.drawPixel( 79,53,YELLOW); 
      M5.Lcd.pushImage( 83,6,35,67, (uint16_t *)m[s1]);
      M5.Lcd.pushImage(121,6,35,67, (uint16_t *)m[s2]);
     
      if ( s1 == 0 && s2 == 0 ){ fade();}
    }
    
    void fade(){
      for (int i=7;i<16;i++){M5.Axp.ScreenBreath(i);delay(25);}
      for (int i=15;i>7;i--){M5.Axp.ScreenBreath(i);delay(25);}
      M5.Axp.ScreenBreath(12);
    }
    

    I'm using Arduino 1.8.9 to compile fresh from github.

    Have you tried updating your M5Stack vfd Libraries?

    it looks like you libs are 1.0.2 where as I am using 1.22



  • Thank you @ajb2k3 ,

    The program is now compiled and transferred.Thank you for the Link
    Afterwards the time appears for one second when resetting the M5Stick-C, then the screen is black.

    @ajb2k3 yes the lib is 1.22 which I use too!

    Mh something I still do wrong.
    greeting skink



  • @skink is the battery in the M5Stick fully charged?

    Plug the stick into a wall charger and leave it for a few hours.



  • @ajb2k3

    the battery is full, even if I leave the M5Stick-C connected to the laptop, the Nixi clock disappears after a second and the screen stays black, but you can still see the backlight.
    What I haven't understood about the manual so far is the following part:

    Update Nixie Tube images

    Execute the lcd-image-converter.exe include in this repository.

    " Png or Jpg is read from File->Open Menu. The image will be displayed when loaded.
    Select: Option->Conversions Menu. The top Preset: selects "Color R5G6B5".
    Select: Image tap and select “8 bit” for Block size :. Press "OK".
    The example "vfd_35x67_8.c" is output by "Convert ..." in File-Convert Menu. Know in advance the destination path. Tick: Import All Images You can also output all the images with “Convert ... all”.
    Edit .c converted file. You will get an error as it is, so fix it with your editor.

    " Change: "Static const uint8_t image_data_vfd_35x67 [4690] = {" at the top of the file deleting "image_data_" as result of "static const uint8_t vfd_35x67_8 [4690] = {".
    At the bottom of delete de entire line: "const tImage vfd_35x67 = {image_data_vfd_35x67, 35, 67, 8};
    Save the example "vfd_35x67_8".c***

    When I load the file M5StickC-Nixie-tube_clock.ino into Arduino, both files vfd_1834.c and vfd_3567.c are loaded automatically.
    Where or what should I change !
    Don't understand this !
    Greetings Reiner



  • @skink I'm not sure as i just down loaded and compiled/flash strait to the stick c.

    one thing to try is to download m5burner, wipe and install uiflow. the try re compiling and uploading in arduino.

    is it only the nixi tube demo doing this?



  • @ajb2k3 Yes it is only with the Nixi Tube demo, all other examples from the Arduino application run without problems.
    Just started UI-Flow Desktop application and install UIFlow-v1.3.4 beta with M5Burner now.
    And then I will install the Nixi Clock again by Arduino software.
    Unfortunately we don't see any success with UIFlow-v1.3.5 beta.
    Yes, the problem only occurs during the Nixi tube demo.
    If something is missing at Arduino or like already ajb2k3 writes maybe it is due to the libs 1.0.2 how do I install the 1.22 ???
    Maybe it works then.
    Too bad you always see it for a second and the Nixi clock looks really awesome.

    Greetings Reiner



  • @skink All you are doing is using UIFlow to clear the program storage space on the M5Stack. I'm confused because my stick C is working as it should and not showing a blank screen after a few seconds.



  • @ajb2k3
    Well, I'm afraid I don't know any more advice either. Try to attach a video, if possible.
    This is what it looks like in any case, I only deleted the memory with M5 Stack Burner and then played the Nixi Clock with Arduino, the same result unfortunately!

    Greetings Reiner

    P.S. Unfortunately I don't have the possibility to upload a video here. Too bad



  • @ to all
    I noticed something else interesting, but I don't know if it has anything to do with it, I plug the M5Stick-C into the USB port and the M5Stick-C is displayed with "USB Serial Port (COM11)" under the COM&LPT ports.

    If I connect one of my M5Stack modules to the USB port, the M5 stack are displayed with "Silicon Labs CP210x USB to UART Bridge (COM6)" under the COM&LPT ports.

    Should the M5Stick-C not display the same Silicon Labs CP210x ....?

    Do I have to assume otherwise that it is defective!
    Otherwise I would order one more !!

    Greetings Skink

    P.S. The display of the port doesn't change if I switch the M5Stick-c to USB mode or to Wifi-Cloud mode via UIFlow!



  • m5stick-c

    0_1565193358618_DSC_1084.JPG



  • m5stack
    0_1565193416965_DSC_1085.JPG



  • No, the StickC appears differently to other devices



  • Hi,
    I have the following question: The nixie clock works fine, but when I switch the m5sitcc off - the RTC does not continue to count. After switching on it shows the time shown exactly before switching off. Is that a software or hardware problem?



  • @ all,
    I have now performed the same steps again (installation Arduino and installation M5StickC_Nixi_tube-Clock) on my desktop PC. And see there also with me now the Nixi Clock runs on the M5StickC.
    What it is between laptop and desktop PC is that the clock on the laptop after the installation on the display briefly appears and disappears again and on the desktop PC appears and remains, I can not explain myself.
    Maybe it's again due to driver problems or the Windows version that I have chosen the USB 3.0 port for both!
    Laptop Windows 1903 Version, Desktop PC Windows 1803 or the UIFlow-Desktop Version and Visual Studio Code are installed on the laptop and the drivers don't get along.

    Thanks for your helpful support Greetings skink