<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TimerCam Power&#x2F;Wake button docs – G38 instead of G37]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">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 <a href="https://docs.m5stack.com/en/unit/timercam" target="_blank" rel="noopener noreferrer nofollow ugc">M5Stack docs</a> have a table like this:</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>BUTTON</th>
<th>TimerCamera</th>
</tr>
</thead>
<tbody>
<tr>
<td>BUTTON</td>
<td><code>G37</code></td>
</tr>
</tbody>
</table>
<p dir="auto">Button presses are definitely <strong>not</strong> registered on this pin.</p>
<p dir="auto">By trial and error I attempted to read various pins and eventually found that the button pin is number <code>38</code>, and not <code>37</code>.</p>
<p dir="auto">I used the <code>gpio_*</code> functions from <code>framework-arduinoespressif32</code> to read the pin; here's some sample code that should work:</p>
<pre><code class="language-c">#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!");
    }
}
</code></pre>
<p dir="auto">I believe the Arduino pin functions would work too, e.g.</p>
<pre><code class="language-c">#define BUTTON_PIN GPIO_NUM_38

void setup() {
    pinMode(BUTTON_PIN, INPUT);
}

void loop() {
    int button_state = digitalRead(BUTTON_PIN); // HIGH when pressed
}
</code></pre>
<p dir="auto">If someone from M5Stack reads this, could they <strong>please update the docs</strong> 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.</p>
<p dir="auto">Here are the other threads I found about it, none with an answer unfortunately:</p>
<ul>
<li><a href="/topic/3878/timercam-using-pwr-button">TimerCam using PWR Button</a> by <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/15454">@orrba</a></li>
<li><a href="https://community.m5stack.com/topic/3161/timer-camera-x-getting-power-button-state">Timer camera X getting power button state</a> by <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/8152">@frucot</a></li>
</ul>
]]></description><link>https://community.m5stack.com/topic/4530/timercam-power-wake-button-docs-g38-instead-of-g37</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Mar 2026 23:57:39 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4530.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Aug 2022 02:38:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TimerCam Power&#x2F;Wake button docs – G38 instead of G37 on Tue, 17 Sep 2024 08:46:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/24155">@fried_chips</a> I finally got to this thread. Thank you, I've been looking for the solution of this problem. and I'm glad to have found it.<br />
I installed a pull-up resistor this route.<br />
<img src="/assets/uploads/files/1726562722678-img_20240917_103853.jpg" alt="IMG_20240917_103853.jpg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/26447</link><guid isPermaLink="true">https://community.m5stack.com/post/26447</guid><dc:creator><![CDATA[mmotos382495]]></dc:creator><pubDate>Tue, 17 Sep 2024 08:46:14 GMT</pubDate></item><item><title><![CDATA[Reply to TimerCam Power&#x2F;Wake button docs – G38 instead of G37 on Thu, 25 Aug 2022 07:01:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4037">@felmue</a> 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.</p>
<p dir="auto">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 <code>GPIO38</code> 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.</p>
<p dir="auto">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.</p>
]]></description><link>https://community.m5stack.com/post/18452</link><guid isPermaLink="true">https://community.m5stack.com/post/18452</guid><dc:creator><![CDATA[fried_chips]]></dc:creator><pubDate>Thu, 25 Aug 2022 07:01:56 GMT</pubDate></item><item><title><![CDATA[Reply to TimerCam Power&#x2F;Wake button docs – G38 instead of G37 on Wed, 24 Aug 2022 19:34:49 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/24155">@fried_chips</a></p>
<p dir="auto">it's a job I've done under the microscope. I found the respective points (GPIO 37 and 3.3 V) looking at the schematic and using a muti-meter.</p>
<p dir="auto"><img src="/assets/uploads/files/1661369226681-timercampullupgpio37_20220824.png" alt="0_1661369224672_TimerCamPullUpGPIO37_20220824.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I used a 15 k pull-up resistor (marked 1502) simply because I had that in SMD format.</p>
<p dir="auto">Note: Please be careful if you attempt to replicate this. I cannot take any responsibility if something goes wrong. You are doing this on your own risk.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/18449</link><guid isPermaLink="true">https://community.m5stack.com/post/18449</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 24 Aug 2022 19:34:49 GMT</pubDate></item><item><title><![CDATA[Reply to TimerCam Power&#x2F;Wake button docs – G38 instead of G37 on Wed, 24 Aug 2022 17:56:26 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4037">@felmue</a>, thanks for the reply and sorry for the delay in responding in turn.</p>
<p dir="auto">I thought at first that this might have something to do with pull-up resistors, before discovering that I could read the value from <code>GPIO38</code> at which point I figured it might be a documentation issue instead. I did notice that the unpressed value was <code>LOW</code> and the pressed value was <code>HIGH</code>, and did find this unexpected.</p>
<p dir="auto">I <em>think</em> I understand what you are saying about adding an <strong>external</strong> pull-up resistor, but I can't figure out <em>how</em> 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 <code>GPIO37</code> and <code>VCC_3V3</code>… is that right? Could you maybe share a bit more information about this process?</p>
<p dir="auto">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.</p>
<p dir="auto">Thanks again!</p>
]]></description><link>https://community.m5stack.com/post/18448</link><guid isPermaLink="true">https://community.m5stack.com/post/18448</guid><dc:creator><![CDATA[fried_chips]]></dc:creator><pubDate>Wed, 24 Aug 2022 17:56:26 GMT</pubDate></item><item><title><![CDATA[Reply to TimerCam Power&#x2F;Wake button docs – G38 instead of G37 on Tue, 16 Aug 2022 18:13:59 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/24155">@fried_chips</a></p>
<p dir="auto">thank you for reporting - you made me curious so I checked the traces (with a multi-meter) on my Timer Camera board and the Power/Wake button (through a diode) is connected to GPIO37 as mentioned in the documentation and as it is on the schematic.</p>
<p dir="auto">However you are correct in that it doesn't work. The reason is GPIO34-39 are input only GPIOs and they lack <strong>internal</strong> pull-up or pull-down capabilities. And since there is no <strong>external</strong> pull-up resistor on the board, reading the Power/Wake button doesn't work. In my case it always reports LOW.</p>
<p dir="auto">That said, after adding an external pull-up resistor, I can now read the Power/Wake button state correctly through GPIO37. Unpressed it reports HIGH (external pull-up) and pressed (connected to GND) it reports LOW.</p>
<p dir="auto">BTW: I did try to read GPIO38, as you suggest, and interestingly it works, however the states are the other way round. Pressed reports HIGH and unpressed reports LOW. Looking at the schematics I think it 'works'  because no battery is attached to my board. And GPIO38 is used to read the battery voltage.</p>
<p dir="auto">So my conclusion is that the documentation is correct, but unfortunately on the Timer Camera board the required external pull-up resistor has been forgotten.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/18355</link><guid isPermaLink="true">https://community.m5stack.com/post/18355</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 16 Aug 2022 18:13:59 GMT</pubDate></item></channel></rss>