[SOLVED] ATOM LITE + OLED Unit 1.3" 128 × 64 Display


  • M5Stack

    just use the M5GFX library.

    https://github.com/m5stack/M5GFX



  • the library examples doesn't work for me

    I tryed with core gray, core2, atom lite without any result...

    may be I'm missing something......



  • some tips???



  • why is it not working? Any error code? it is difficult to help you if you give no information.



  • I can upload the exemples sketches but nothing is on the display....



    • arduino envirement
    • atom lite
    • oled unit
    • up to date M5GFX

    this is a test sketch:

    #include <M5GFX.h>
    
    M5GFX display;
    M5Canvas canvas(&display);
    
    static constexpr char text0[] = "hello world";
    static constexpr char text1[] = "this";
    static constexpr char text2[] = "is";
    static constexpr char text3[] = "text";
    static constexpr char text4[] = "log";
    static constexpr char text5[] = "vertical";
    static constexpr char text6[] = "scroll";
    static constexpr char text7[] = "sample";
    static constexpr const char* text[] = { text0, text1, text2, text3, text4, text5, text6, text7 };
    
    void setup(void)
    {
      display.begin();
    
      if (display.isEPD())
      {
        display.setEpdMode(epd_mode_t::epd_fastest);
        display.invertDisplay(true);
        display.clear(TFT_BLACK);
      }
      if (display.width() < display.height())
      {
        display.setRotation(display.getRotation() ^ 1);
      }
    
      canvas.setColorDepth(1); // mono color
      canvas.createSprite(display.width(), display.height());
      canvas.setTextSize((float)canvas.width() / 160);
      canvas.setTextScroll(true);
    }
    
    void loop(void)
    {
      static int count = 0;
    
      canvas.printf("%04d:%s\r\n", count, text[count & 7]);
      canvas.pushSprite(0, 0);
      ++count;
    }
    

    this is the arduino ide output:

    Lo sketch usa 301153 byte (22%) dello spazio disponibile per i programmi. Il massimo è 1310720 byte.
    Le variabili globali usano 17052 byte (5%) di memoria dinamica, lasciando altri 310628 byte liberi per le variabili locali. Il massimo è 327680 byte.
    esptool.py v3.0-dev
    Serial port COM8
    Connecting.....
    Chip is ESP32-PICO-D4 (revision 1)
    Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
    Crystal is 40MHz
    MAC: d8:a0:1d:5c:95:0c
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 1500000
    Changed.
    Configuring flash size...
    Auto-detected Flash size: 4MB
    Compressed 8192 bytes to 47...
    Writing at 0x0000e000... (100 %)
    Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4096.1 kbit/s)...
    Hash of data verified.
    Compressed 15856 bytes to 10276...
    Writing at 0x00001000... (100 %)
    Wrote 15856 bytes (10276 compressed) at 0x00001000 in 0.1 seconds (effective 991.0 kbit/s)...
    Hash of data verified.
    Compressed 301264 bytes to 153424...
    Writing at 0x00010000... (10 %)
    Writing at 0x00014000... (20 %)
    Writing at 0x00018000... (30 %)
    Writing at 0x0001c000... (40 %)
    Writing at 0x00020000... (50 %)
    Writing at 0x00024000... (60 %)
    Writing at 0x00028000... (70 %)
    Writing at 0x0002c000... (80 %)
    Writing at 0x00030000... (90 %)
    Writing at 0x00034000... (100 %)
    Wrote 301264 bytes (153424 compressed) at 0x00010000 in 2.8 seconds (effective 870.7 kbit/s)...
    Hash of data verified.
    Compressed 3072 bytes to 128...
    Writing at 0x00008000... (100 %)
    Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.0 seconds (effective 1365.3 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Hard resetting via RTS pin...
    Trovata libreria non valida in C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher-master: Nessun header file (.h) trovato in C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher-master
    Trovata libreria non valida in C:\Users\Documents\Arduino\libraries\URM-master: Nessun header file (.h) trovato in C:\Users\Documents\Arduino\libraries\URM-master
    
    

    this is the serial monitor booting the atom lite

    ets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 188777542, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0018,len:4
    load:0x3fff001c,len:1044
    load:0x40078000,len:8896
    load:0x40080400,len:5816
    entry 0x400806ac
    


  • I think I have to change the i2c pin in the library..... but where??


  • M5Stack

    you need to #include <M5UnitOLED.h>

    #include <M5UnitOLED.h>
    
    M5UnitOLED display;
    
    M5Canvas canvas(&display);
    
    static constexpr char text[] = "Hello world ! こんにちは世界! this is long long string sample. 寿限無、寿限無、五劫の擦り切れ、海砂利水魚の、水行末・雲来末・風来末、喰う寝る処に住む処、藪ら柑子の藪柑子、パイポ・パイポ・パイポのシューリンガン、シューリンガンのグーリンダイ、グーリンダイのポンポコピーのポンポコナの、長久命の長助";
    static constexpr size_t textlen = sizeof(text) / sizeof(text[0]);
    int textpos = 0;
    int scrollstep = 2;
    
    void setup(void) 
    {
      display.init();
      display.setRotation(2);
      canvas.setColorDepth(1); // mono color
      canvas.setFont(&fonts::lgfxJapanMinchoP_32);
      canvas.setTextWrap(false);
      canvas.setTextSize(2);
      canvas.createSprite(display.width() + 64, 72);
    }
    
    void loop(void)
    {
      int32_t cursor_x = canvas.getCursorX() - scrollstep;
      if (cursor_x <= 0)
      {
        textpos = 0;
        cursor_x = display.width();
      }
    
      canvas.setCursor(cursor_x, 0);
      canvas.scroll(-scrollstep, 0);
      while (textpos < textlen && cursor_x <= display.width())
      {
        canvas.print(text[textpos++]);
        cursor_x = canvas.getCursorX();
      }
      display.waitDisplay();
      canvas.pushSprite(&display, 0, (display.height() - canvas.height()) >> 1);
    }
    
    


  • @m5stack said in ATOM LITE + OLED Unit 1.3" 128 × 64 Display:

    you need to #include <M5UnitOLED.h>

    #include <M5UnitOLED.h>
    
    M5UnitOLED display;
    
    M5Canvas canvas(&display);
    
    static constexpr char text[] = "Hello world ! こんにちは世界! this is long long string sample. 寿限無、寿限無、五劫の擦り切れ、海砂利水魚の、水行末・雲来末・風来末、喰う寝る処に住む処、藪ら柑子の藪柑子、パイポ・パイポ・パイポのシューリンガン、シューリンガンのグーリンダイ、グーリンダイのポンポコピーのポンポコナの、長久命の長助";
    static constexpr size_t textlen = sizeof(text) / sizeof(text[0]);
    int textpos = 0;
    int scrollstep = 2;
    
    void setup(void) 
    {
      display.init();
      display.setRotation(2);
      canvas.setColorDepth(1); // mono color
      canvas.setFont(&fonts::lgfxJapanMinchoP_32);
      canvas.setTextWrap(false);
      canvas.setTextSize(2);
      canvas.createSprite(display.width() + 64, 72);
    }
    
    void loop(void)
    {
      int32_t cursor_x = canvas.getCursorX() - scrollstep;
      if (cursor_x <= 0)
      {
        textpos = 0;
        cursor_x = display.width();
      }
    
      canvas.setCursor(cursor_x, 0);
      canvas.scroll(-scrollstep, 0);
      while (textpos < textlen && cursor_x <= display.width())
      {
        canvas.print(text[textpos++]);
        cursor_x = canvas.getCursorX();
      }
      display.waitDisplay();
      canvas.pushSprite(&display, 0, (display.height() - canvas.height()) >> 1);
    }
    
    

    this sketch compile but doesn't display nothing

    no error message

    this is the atom lite boot on serial monitor after uploaded sketch

    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 188777542, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0018,len:4
    load:0x3fff001c,len:1044
    load:0x40078000,len:8896
    load:0x40080400,len:5816
    entry 0x400806ac
    
    


  • @cepics said in ATOM LITE + OLED Unit 1.3" 128 × 64 Display:

    static constexpr const char* text[] = { text0, text1, text2, text3, text4, text5, text6, text7 };

    I don´t like it ... please remove it and give a try in the loop with a static string ...

    And also, put any serial.println() debug code to see what code are you running



  • @otosan-maker said in ATOM LITE + OLED Unit 1.3" 128 × 64 Display:

    ...and give a try in the loop with a static string ...

    sorry but I don't understand ...

    I deleted :
    static constexpr const char* text[] = { text0, text1, text2, text3, text4, text5, text6, text7 };

    this is the compiling error message

        Arduino:1.8.13 (Windows 10), Scheda:"M5Stick-C, Default, 1500000, None
    
        C:\Users\Documents\Arduino\OLEDDAJE\OLEDDAJE.ino: In function 'void loop()':
        
        
        OLEDDAJE:41:39: error: 'text' was not declared in this scope
        
        
           canvas.printf("%04d:%s\r\n", count, text[count & 7]);
        
        
                                               ^
        
        
        Più di una libreria trovata per "SPI.h"
        
        
        Usata: C:\Users\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\1.0.7\libraries\SPI
        
        
        Non usata: C:\Users\Documents\Arduino\libraries\SPI
        
        
        exit status 1
        
        
        'text' was not declared in this scope
    
        Questo report potrebbe essere più ricco di informazioni abilitando l'opzione
        
        "Mostra un output dettagliato durante la compilazione"
        
        in "File -> Impostazioni

  • M5Stack

    @otosan-maker said in ATOM LITE + OLED Unit 1.3" 128 × 64 Display:

    I don´t like it ... please remove it and give a try in the loop with a static string ...
    And also, put any serial.println() debug code to see what code are you running

    #include <M5UnitOLED.h>
    
    //M5UnitOLED display; // default setting
    
    M5UnitOLED display ( 21, 22, 400000 ); // SDA, SCL, FREQ
    
    


  • tnks a lot !!!!
    this sketch is working for me

    #include <M5UnitOLED.h>
    M5UnitOLED display ( 26, 32, 400000 ); // SDA, SCL, FREQ
    M5Canvas canvas(&display);
    
    static constexpr char text[] = "Hello world ! こんにちは世界! this is long long string sample. 寿限無、寿限無、五劫の擦り切れ、海砂利水魚の、水行末・雲来末・風来末、喰う寝る処に住む処、藪ら柑子の藪柑子、パイポ・パイポ・パイポのシューリンガン、シューリンガンのグーリンダイ、グーリンダイのポンポコピーのポンポコナの、長久命の長助";
    static constexpr size_t textlen = sizeof(text) / sizeof(text[0]);
    int textpos = 0;
    int scrollstep = 2;
    
    void setup(void) 
    {
      display.begin();
    
      if (display.width() < display.height())
      {
        display.setRotation(display.getRotation() ^ 1);
      }
    
    
      canvas.setColorDepth(1); // mono color
      canvas.setFont(&fonts::lgfxJapanMinchoP_32);
      canvas.setTextWrap(false);
      canvas.setTextSize(2);
      canvas.createSprite(display.width() + 64, 72);
    }
    
    void loop(void)
    {
      int32_t cursor_x = canvas.getCursorX() - scrollstep;
      if (cursor_x <= 0)
      {
        textpos = 0;
        cursor_x = display.width();
      }
    
      canvas.setCursor(cursor_x, 0);
      canvas.scroll(-scrollstep, 0);
      while (textpos < textlen && cursor_x <= display.width())
      {
        canvas.print(text[textpos++]);
        cursor_x = canvas.getCursorX();
      }
      display.waitDisplay();
      canvas.pushSprite(&display, 0, (display.height() - canvas.height()) >> 1);
    }