M5CoreInk wake up by EXT0 (PIR Hat)
-
I want to wake up an M5CoreInk by EXT0 (PIR Hat).
If I connect USB counting works. If I disconnect the USB cable the display loses its contrast and the software crashes.
I have no idea what's wrong. A program with wakeup by timer works.
The source is saved at https://github.com/ckuehnel/Arduino2020/tree/master/M5Stack/CoreInk_PIR.
Any hint is welcome.
best regards, Claus -
Hello @ckuehnel
try adding these two lines before going into deep sleep:
gpio_hold_en(GPIO_NUM_12); // POWER_HOLD_PIN gpio_deep_sleep_hold_en();
This should keep the ESP32 powered even when going into deep sleep.
Thanks
Felix -
@ckuehnel said in M5CoreInk wake up by EXT0 (PIR Hat):
I want to wake up an M5CoreInk by EXT0 (PIR Hat).
If I connect USB counting works. If I disconnect the USB cable the display loses its contrast
Any hint is welcome.
best regards, ClausThe Display loosing contrast is because you need to set the screen HV to true before writing the frame buffer to the screen. In UIFlow there is a block for this but I have no idea about Arduino.
It sounds like the battery has not charged and so by removing the power you are killing the program.As you are using the Arduino, you may want to look into using the ULP to handle the PIR instead of leaving it to the main cores.
-
@felmue said in M5CoreInk wake up by EXT0 (PIR Hat):
gpio_hold_en(GPIO_NUM_12); // POWER_HOLD_PIN
gpio_deep_sleep_hold_en();Hi Felix
This are the last commands in my setup() now - but w/o success:
esp_sleep_enable_ext0_wakeup(GPIO_NUM_36,1); //1 = High, 0 = Low //Go to sleep now if (DEBUG) { Serial.println("Going to sleep now"); Serial.flush(); } delay(2000); gpio_hold_en(GPIO_NUM_12); // POWER_HOLD_PIN gpio_deep_sleep_hold_en(); esp_deep_sleep_start();
-
Hello @ckuehnel
hmm, that is strange. I've just tried your code with the two additional lines and my M5CoreInk stays in deep sleep just fine. No fading display and counting up when GPIO36 goes high.
My guess is that maybe the battery charge in your M5CoreInk is (too) low. Have you fully charged the battery before testing?
I don't have the PIR hat so I am only testing with a wire between GPIO36 and GND or 3.3 V. Maybe the PIR hat is using too much power?
Thanks
Felix -
Hi @felmue
It was a good idea to replace the PIR by a wire. I have tried that w/o success.
I have prepared a Vbat measuring to see if battery is ok when USB is disconnected.
The CoreInk had now 3588 loops w/o USB connected. The battery goes from 4.1 V to 3.721 V after all these cycles (one second each). The battery is ok.
Thanks again.
Claus -
You need also to set the POWER_HOLD_PIN to '1' once. So in your setup:
digitalWrite(POWER_HOLD_PIN,1); //needed to put the state to 1
gpio_hold_en(GPIO_NUM_12); //needed apparantly to keep the output also in light sleep WTF? -
@twostick
FYI; light sleep current pulled out of the battery depend on the battery voltage:
<2.7V device wont wake up anymore
2.7V 4.4mA
3.0V 3.9mA
3.7V 3.1mA
4.2V 2.7mAThis dependacy is caused by the DC-DC conversion that converts the Lipo voltage first to 5Vdc. (SY7088 chip).
The 5Vdc gets also down converted to 3v3 (SY8089 chip) .According to the datasheet, the ESP itself should only use 0.8mA in light sleep. So 2mA gets waisted.
What a pitty.dd.07-04-22:
The above is not completely true. I'm using the M5GFX lib and when I execute the function display.sleep(); before going to deep sleep (esp_deep_sleep_start();) the sleep current drops to a 1.25mA. Still considerable...