Navigation

    M5Stack Community

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

    Posts made by fried_chips

    • RE: TimerCam Power/Wake button docs – G38 instead of G37

      @felmue oh wow! Thanks for sharing the photo and taking the time to annotate it. Indeed this is way outside of my capabilities, and I wouldn't expect more owners of this board to have the gear, SMD components, or SMD reworking experience to attempt this mod.

      I'm definitely not going to try, and your post can probably serve as a warning to anyone tempted to do something similar themselves. I'm fine with using GPIO38 as a weird inverted button for now while I write code for this board and have it nearby plugged into USB power, and if I ever run it off of a battery it'll likely be in a setting where I communicate with it over WiFi rather than with a physical interaction.

      I hope that M5Stack can address this issue with a built-in pull-up resistor some time in the future, as it stands this button is only partially usable and there's evidence on this forum that other users have encountered this issue in the past.

      posted in SOFTWARE
      F
      fried_chips
    • RE: TimerCam Power/Wake button docs – G38 instead of G37

      Hi @felmue, thanks for the reply and sorry for the delay in responding in turn.

      I thought at first that this might have something to do with pull-up resistors, before discovering that I could read the value from GPIO38 at which point I figured it might be a documentation issue instead. I did notice that the unpressed value was LOW and the pressed value was HIGH, and did find this unexpected.

      I think I understand what you are saying about adding an external pull-up resistor, but I can't figure out how you did this. There's very little space on the board, no exposed row of pins, and very few silkscreened markings identifying various pins or even components, so how did you do this? The way I understand your post is that you're saying you soldered (or somehow connected) a pull-up resistor between GPIO37 and VCC_3V3… is that right? Could you maybe share a bit more information about this process?

      Alternatively I was wondering if there was any way that you could think of to still detect button presses, and if so if you could please share a code sample for it.

      Thanks again!

      posted in SOFTWARE
      F
      fried_chips
    • TimerCam Power/Wake button docs – G38 instead of G37

      Hello,

      I recently bought a Timer Camera board and have been using it with Arduino/PlatformIO. I had some issues trying to detect presses of the Power/Wake button in my code, and found several threads in this forum from people who apparently had the same issue. The problem is that the M5Stack docs have a table like this:

      BUTTON TimerCamera
      BUTTON G37

      Button presses are definitely not registered on this pin.

      By trial and error I attempted to read various pins and eventually found that the button pin is number 38, and not 37.

      I used the gpio_* functions from framework-arduinoespressif32 to read the pin; here's some sample code that should work:

      #define BUTTON_PIN GPIO_NUM_38
      
      void setup() {
          Serial.begin(9600);
          while (!Serial);
      
          gpio_reset_pin(BUTTON_PIN);
          gpio_set_direction(BUTTON_PIN, GPIO_MODE_INPUT);
          gpio_set_pull_mode(BUTTON_PIN, GPIO_PULLUP_ONLY);
      }
      
      void loop() {
          int button_state = gpio_get_level(BUTTON_PIN);
          if (button_state == HIGH) {
              Serial.println("Button pressed!");
          }
      }
      

      I believe the Arduino pin functions would work too, e.g.

      #define BUTTON_PIN GPIO_NUM_38
      
      void setup() {
          pinMode(BUTTON_PIN, INPUT);
      }
      
      void loop() {
          int button_state = digitalRead(BUTTON_PIN); // HIGH when pressed
      }
      

      If someone from M5Stack reads this, could they please update the docs so that others can avoid spending time figuring this out? Or if someone knows how I could report this to them, I'd be happy to send them an email about it.

      Here are the other threads I found about it, none with an answer unfortunately:

      • TimerCam using PWR Button by @orrba
      • Timer camera X getting power button state by @frucot
      posted in SOFTWARE
      F
      fried_chips