Battery Powered WLED Project with Wake on IR interrupt

Hi there, i want to use WLED for my low standby current outdoor awning lightning. I plan to use an ESP32 which is powered by 3 18650 batteries with a solar panel.
In order to save battery live i want to switch off the light by using the esp32 deepsleep mode when it’s not required. Which means if WLED is in power off state (e.g. relay to power the led’s is switched off) i want to start a counter and then e.g. 5min after no change occurred send the ESP to deepsleep. In order to wake the ESP up i want to use a interrupt pin e.g. GPIO 33 of the ESP32 which is connected to the IR sensor also, and the WLED is awaiting commands by IR or WLAN input.

I verified the wake up with a small Arduino script and the IR sensor, which is capable to wake the ESP32 from deepsleep if any signal is sent by IR remote (looks a bit unstable (reacting on more then IR remote), but this is not too critical).

In order to make it a bit more stable i also thought about adding a timer which is able to send the ESP32 to deepsleep and wake it up at a certain time, but i was not able to find this function up to now. This could be added additionally …

Any help to get started in doing so is appreciated

  Serial.println("Set Wake on GPIO 33");
  esp_sleep_enable_ext0_wakeup(GPIO_NUM_33,0); //1 = High, 0 = Low

  //Go to sleep now
  Serial.println("Going to sleep now");
  esp_deep_sleep_start();

FYI: Even sun will occasionally trigger IR sensor (with random code) and will wake your device.

Thank you for your response …
Yes, i saw that already. I thought about filtering the IR interrupt with a capacitor, as pushing the IR remote is sending while pushing. In order to make the IR Remote working again add a 2nd IR receiver for WLED purpose. Do you think this could solve / improve this topic?

I do not know if WLED implementation uses interrupts. If it doesn’t it will not work.

Do you think it’s possible to filter those occasionally triggers of the IR sensor with a hardware filter cicuit or similar? I am not that well experienced with those kind of circuits …

Regarding the interrupts i guess there is nothing implemented in WLED and this would be exactly the point to add with this kind of user_mod.

I don’t know how to identify if WLED is in a poweroff state or how to get the signal in the void loop() function of the usermod_v2_example.h.

Most likely not.

WLED has no state corresponding to sleep mode. Even if it may turn WiFi off.
You may need to create a usermod.

I tried to start writing a usermod and used the standard usermod_v2_example.h added everything like discribed in usermods_list.cpp and also do see the GUI topics.

However if you uncomment all lines with Serial.println the content is not shown in Serial. refer to attachments below.

    void loop() {
      if (millis() - lastTime > 1000) {
        Serial.println("I'm alive!");
        lastTime = millis();
      }
    }

Did i miss something to make the serial messages work.

ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DOUT, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
�Ada
IR recv: 0xDEB0C861
IR recv: 0xFFFFFFFF
IR recv: 0xFFFFFFFF

Did you include usermod in usermod_list.cpp?

I uncommented the following 2 lines there:

#include "wled.h"
/*
 * Register your v2 usermods here!
 *   (for v1 usermods using just usermod.cpp, you can ignore this file)
 */

/*
 * Add/uncomment your usermod filename here (and once more below)
 * || || ||
 * \/ \/ \/
 */
#include "../usermods/EXAMPLE_v2/usermod_v2_example.h"
...

and

void registerUsermods()
{
/*
   * Add your usermod class name here
   * || || ||
   * \/ \/ \/
   */
  usermods.add(new MyExampleUsermod());

Also i can see the input parameters of the usermod in the Web GUI.

Do i need to change something also in platformio.ini or somewhere else? Or is it required to enable Serial output? (But IR messages are there over Serial already?).

You don’t need to do anything for serial.

Sorry, for the stupid questions but the comments in the code and information were misleading me.

I copied the usermod_v2_example.h into the wled00 directory modified it there and then uncommented the lines like explained about.
Therefore it was using the example where Serial is commented out and all changes i did in my file were not used, since the paths were wrong. Now that i changed the names and paths everything should work as expected.

Next step to start the real mod …

Based on you comments i will try to send the ESP to sleep by MQTT for a certain time and send all the commands by my iobroker as a server, lets see how i will end with this …