🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5StickC: turn off screen completely

    Scheduled Pinned Locked Moved M5 Stick/StickC
    25 Posts 11 Posters 108.1k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      dda
      last edited by

      I poked around the APX192 code, and around a datasheet found here. First, there's this code:

      void AXP192::begin(void) {
        Wire1.begin(21, 22);
        Wire1.beginTransmission(0x34);
        Wire1.write(0x10);
        Wire1.write(0xff);  //OLED_VPP Enable
        Wire1.endTransmission();
        Wire1.beginTransmission(0x34);
        Wire1.write(0x28);
        Wire1.write(0xff); //Enable LDO2&LDO3, LED&TFT 3.3V
        Wire1.endTransmission();
      

      A peek at the datasheet says that REG 28H is power management for LD02 and LD03. Sure thing. That's what the comment in the code above says – along with a hint that LD03 is for the TFT.

      0_1564381511757_c4e39c69-4e7f-43ac-87d0-bb076edd9e54-image.png

      Meanwhile, REG 10H is two ON/OFF switches, for EXTEN and DC-DC2 – commented in the code as VPP_Enable. Bueno.

      0_1564381715507_82d5c76f-207d-421e-8db8-ac7556120001-image.png

      I am not sure which of EXTEN or DC-DC2 is connected to the OLED (both?), but turning either or both off will cut off the current to the OLED.

      Moreover there's this code later:

        Wire1.beginTransmission(0x34);
        Wire1.write(0x12);
        Wire1.write(0x4d); //Enable DC-DC1, OLED_VDD, 5B V_EXT
        Wire1.endTransmission();
      

      And REG 12H seems to do more of the same as 10H:

      0_1564381853456_5263d5e3-3e9f-48a3-9da5-f8b5f34a41b8-image.png

      Bit 3 turns ON/OFF LD03, which, as we saw above, is supposed to be the OLED. Good odds that setting bit 3 of REG 12H to zero would work too.

      I don't have time to test it now, but I'll try later tonight.

      1 Reply Last reply Reply Quote 1
      • D Offline
        dda
        last edited by

        After a little bit of poking around I managed to turn off the screen:

        Wire1.beginTransmission(0x34);
        Wire1.write(0x12);
        Wire1.write(0b01001011);  // LDO2, aka OLED_VDD, off
        Wire1.endTransmission();
        

        This turns off LDO2, and thus the backlight. To turn it back on:

        Wire1.beginTransmission(0x34);
        Wire1.write(0x12);
        Wire1.write(0x4d); // Enable LDO2, aka OLED_VDD
        Wire1.endTransmission();
        
        W 1 Reply Last reply Reply Quote 2
        • W Offline
          ws1088 @dda
          last edited by

          @dda Thanks! @ricardocosta can probably check to see how much current is used when backlight is off.

          1 Reply Last reply Reply Quote 0
          • D Offline
            dda
            last edited by

            While I'm at it, an explanation about M5.Axp.ScreenBreath(x);. The code is:

            void AXP192::ScreenBreath(uint8_t brightness) {
              Wire1.beginTransmission(0x34);
              Wire1.write(0x28);
              Wire1.write(((brightness & 0x0f) << 4)); //Enable LDO2&LDO3, LED&TFT 3.3V
              Wire1.endTransmission();
            }
            

            What it does is it takes the value you passed, cuts it to 4 bits (0-15) and moves those 4 bits to bits 4-7. Register 28H is voltage control for LDO2 (bits 4-7) and LDO3 (bits 0-3). So the OLED is connected to LDO2.

            What that 0-15 value represents is a voltage of 1.8 to 3.3V, in 100mV/steps. So M5.Axp.ScreenBreath(0); sets voltage to 1.8V, and M5.Axp.ScreenBreath(15); to 3.3V. Not what we really want – as the goal was to set voltage to zero... :-)

            0_1564416322717_e7e8bf46-cea3-41c2-bed7-1869e4cb9146-image.png

            Whereas register 12H controls the state (ON/OFF) of a bunch of wires, including LDO2 (bit 2). Hence the code above.

            0_1564416423649_0222b6b2-3ed3-473a-9669-0020509cb215-image.png

            1 Reply Last reply Reply Quote 1
            • W Offline
              ws1088
              last edited by ws1088

              Does your code cut the voltage to the backlight only? or to the screen as well?

              1 Reply Last reply Reply Quote 0
              • D Offline
                dda
                last edited by

                To be tested but I think this turns off OLED_VDD, ie the current to the OLED. Register 10H is said to be for OLED_VPP so setting it to zero could help too.

                1 Reply Last reply Reply Quote 0
                • D Offline
                  dda
                  last edited by

                  I did a simple test: with only REG 28H the screen stays slightly warm. With both 28H and 10H, the screen cools off after a while. Hardly a scientific test, I know, but seems to point to the need to set both registers.

                  W K 2 Replies Last reply Reply Quote 0
                  • W Offline
                    ws1088 @dda
                    last edited by

                    @dda what a wonderful work you have done! I hope this will enable @Multihelix to use M5StickC as a watch (turn off OLED after a timeout and turn on OLED on button press or accelerometer)

                    D 1 Reply Last reply Reply Quote 1
                    • M Offline
                      maxstack @Multihelix
                      last edited by

                      @multihelix

                      How are you getting 5 hours of life? it seems you would need <16 ma total drain

                      Are you sleeping the ESP32?

                      M 1 Reply Last reply Reply Quote 0
                      • D Offline
                        dda @ws1088
                        last edited by

                        @ws1088 Funny enough I bought my M5StickC with the watch strap and all, but not because I wanted a watch – I don't wear them – but because it enables me to tie it up to my backpack when I do LoRa range tests :-)

                        W 1 Reply Last reply Reply Quote 0
                        • W Offline
                          ws1088 @dda
                          last edited by

                          @dda said in M5StickC: turn off screen completely:

                          @ws1088 Funny enough I bought my M5StickC with the watch strap and all, but not because I wanted a watch – I don't wear them – but because it enables me to tie it up to my backpack when I do LoRa range tests :-)

                          why would you use m5stickc to do LoRa range tests? You can get LoRa chip with OLED screen. Do you connect m5stickc to a LoRa chip via I2C? or WiFi AP?

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            dda
                            last edited by

                            I have a lot of different LoRa chips and setups. I have one board, at 230 MHz, that I can connect through the hat connector (I need 3 pins + Vcc/GND). I have transceivers, both at 230 and 433 MHz, I connect to via RS485 (I bought a hat for that, and also some RS485 for my M5Stack cores). etc etc. The smaller the better :-)

                            1 Reply Last reply Reply Quote 0
                            • M Offline
                              Multihelix @maxstack
                              last edited by

                              @maxstack - Yes, I used ESP DeepSleep set to wake on Button A being pressed, but I would say that the 5 hour time was not under ideal conditions, as I occasionally woke up the device to confirm it was still working and to check the time - a resonable activity for a watch.

                              S 1 Reply Last reply Reply Quote 0
                              • S Offline
                                spiffmonious @Multihelix
                                last edited by

                                @multihelix Can you post a link to your watch code?

                                1 Reply Last reply Reply Quote 0
                                • K Offline
                                  klimbot @dda
                                  last edited by klimbot

                                  @dda said in M5StickC: turn off screen completely:

                                  I did a simple test: with only REG 28H the screen stays slightly warm. With both 28H and 10H, the screen cools off after a while. Hardly a scientific test, I know, but seems to point to the need to set both registers.

                                  I'm looking at this thread to hopefully implement a complete screen turn off, but am not sure what register mask to use (based on quoted post)

                                  Here is what I have, the screen is off but hard to know if the screen has actually been disabled.

                                  void turnOffScreen() {
                                  Wire1.beginTransmission(0x34);
                                  Wire1.write(0x10);
                                  Wire1.write(0b00000000); // 7-3=? | 2=EXTEN | 1=? | 0=DC-DC2
                                  Wire1.endTransmission();

                                  Wire1.begin(21, 22);
                                  Wire1.beginTransmission(0x34);
                                  Wire1.write(0x12);
                                  Wire1.write(0b01001011); // 7=? | 6=EXTEN | 5=? | 4=DC-DC2 | 3=LDO3 | 2=LDO2 | 1=DC-DC3 | 0=DC-DC1
                                  Wire1.endTransmission();

                                  Wire1.beginTransmission(0x34);
                                  Wire1.write(0x28);
                                  Wire1.write(0b00001111); // 7-4=LDO2 | 3-0=LDO3
                                  Wire1.endTransmission();
                                  }

                                  1 Reply Last reply Reply Quote 0
                                  • F Offline
                                    ForestRupicolous
                                    last edited by ForestRupicolous

                                    @klimbot: I think you have to turn LDO3 and LDO2 off, in your code only LDO2 is off. Take a look at this picture: https://docs.m5stack.com/assets/img/product_pics/core/minicore/m5stickc/m5stickc_05.webp

                                    1 Reply Last reply Reply Quote 0
                                    • V Offline
                                      viandou
                                      last edited by

                                      This is how I init my M5StickC in a full black screen way.

                                      M5.begin(0,1,1);
                                      M5.Axp.SetLDO2(false);
                                      M5.Axp.SetLDO3(false);
                                      
                                      1 Reply Last reply Reply Quote 0

                                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                      With your input, this post could be even better 💗

                                      Register Login
                                      • First post
                                        Last post