Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. bexybot
    3. Posts
    B
    • Continue chat with bexybot
    • Start new chat with bexybot
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by bexybot

    • RE: Power Input

      So with a bit of research, I develop this simple code that makes exactly what I was asking here:

      #include <M5Core2.h>
      #define DEVICE_TIMEOUT 120000
      float Time_bat = 0;
      
      void setup{
        M5.begin();
        M5.Axp.SetBusPowerMode(1);
      }
      
      void loop{
        M5.Lcd.drawString(("Battery: " + String(M5.Axp.GetBatteryLevel())), 0, 120, 2);
        if(!M5.Axp.isVBUS() && !M5.Axp.isCharging()){
          M5.Lcd.drawString(String((millis() - Time_bat)/1000,0) + "         ", 1, 154, 1);
        }else{M5.Lcd.drawString("Feeded             ", 1, 154, 1);}
      
        if(!M5.Axp.isVBUS() && !M5.Axp.isCharging()){
            if(Time_bat == 0){Time_bat = millis();}
            if((millis() - Time_bat) > DEVICE_TIMEOUT){M5.shutdown();}
        }else{
          Time_bat = 0;
        } 
      }
      

      Hope it helps someone!

      posted in Core 2
      B
      bexybot
    • RE: MicroPython unstable ADC readings +/- 5% between reads

      There are lots of ways to filter this type of data. The mean is one but you can also use median or an FIR filter. Take a look 🤗

      Fábio Dias

      posted in Micropython
      B
      bexybot
    • Power Input

      Hello everyone,

      I have some questions about powering the Core2 module:

      1. Currently, if the device is turned off and is connected by USB-C, it turns on. I would like to know if I put the 5V bus in input mode and feed it 5V the same thing happens.
      2. I was wondering what is the best way to detect the 5V input turning off to turn off the Core2 since there is a battery and it could stay on. Any ideas?

      Thanks very much for your help!
      Fábio Dias

      posted in Core 2
      B
      bexybot
    • RE: Wrong ADC readings when using Serial Communication at PortA

      It worked! Fixed problem eheh!

      posted in Core 2
      B
      bexybot
    • RE: Wrong ADC readings when using Serial Communication at PortA

      @felmue thanks for your reply again Felix,

      You might just be right. Tomorrow I'll try it. Thanks a lot!

      posted in Core 2
      B
      bexybot
    • RE: Wrong ADC readings when using Serial Communication at PortA

      Thanks for your response @felmue,

      It's very strange, that's why I'm asking on this forum. I could not find anything online. I'll take a picture of the setup, and send the relevant code.

      It works well without the PmodRS232.

      0_1661253355675_WhatsApp Image 2022-08-23 at 12.14.46.jpeg

      Code:

      void setup(){
      M5.begin();
      M5.Rtc.begin();

      // Serial Config
      Serial2.begin(115200 , SERIAL_8N1, 32 , 33 );
      Serial2.setTimeout(300);

      // ADC Config
      analogReadResolution(12);
      analogSetAttenuation(ADC_11db);
      pinMode(36, INPUT); // I already tried with and without this, same results
      }

      void loop{
      M5.Lcd.drawString(("Read voltage: " + String(analogRead(36)/4095*3.9), 0, 0, 4);
      }

      posted in Core 2
      B
      bexybot
    • Wrong ADC readings when using Serial Communication at PortA

      Hi everyone,

      I'm using M5Core2 to make a datalogger. For that, I'm communicating with a telemetry box by Serial using a PmodRS232, with needs alimentation. So I use PortA for Serial and feeding of PmodRS232 and the communications run smoothly.

      The problem is that I'm also using PIN 36 as an ADC and if I plug the PmodRS232 at PortA the readings of the ADC increase by ~60%. If I unplug the cable of PIN 36 I get 4095 if PmodRS232 is plugged in (which is wrong), and 0, if PmodRS232 isn't plugged in (which is correct).

      I already know PortA as pull-up resistors, but I don't understand why that affects PIN 36 (or 35, I already tried it) readings.

      Thanks a lot for your help, I'm looking forward to solving this problem.

      posted in Core 2
      B
      bexybot