Added PowerSaving for all ESP32-based repeaters#1687
Added PowerSaving for all ESP32-based repeaters#1687IoTThinks wants to merge 10 commits intomeshcore-dev:devfrom
Conversation
|
Still need to fix for those TBeam boards. |
|
@towerviewcams Here you go. This PR should be for ESP32-based repeaters only.
Testing steps for ESP32-based repeaters
Please help to test. |
|
For Heltec v4, when doing "start ota", the current may jump to ...750mA then down to 124mA. It should be ok for battery. |
|
+1 testing atm |
|
V4 testing on two boards results: *fresh flash 1.13 firmware, powersaving delay is 22 seconds, then drops to 11.6mA sleep. I have also verified that the receiver sensitivity remains normal with my lab test companion set to -9 power and the V4 has rssi of my test signals at -117 setup in a RF cage (normal RX level for V4 in my test cage). Also checked to make sure GC1109 has power on VCC pin full time-yes. So the LNA is always on. Now running live on the mesh here in Oregon USA. repeating packets normally working good. Next for Rak! **Update |
|
There is a chance that rtc_gpio_hold_dis will release this pin P_LORA_PA_EN to its default state which is off. May want to put the rtc_gpio_hold_dis function after setting the pin. There could be an extremely short blip on waking up after deep sleep that may not really show too much during testing but is not ideal. pinMode(P_LORA_PA_EN, OUTPUT); The esp32 docs are not super clear on this rtc_gpio_hold_dis function and may be missing some detail that the gpio_hold_dis function had Discussion about it here. |
|
@beachmiles This is required in deepsleep as I understand. rtc_gpio_hold_dis This PowerSaving uses light sleep. |
|
Initial testing on this firmware is very good with VERY low power usage during sleep (6.7mA at 5.095V / 34.2 mW) and its extremely quick in going back to sleep after handling traffic. The bright white LED is still flashing during communication which it ideally wouldn't be doing while in powersave. Otherwise you'd have to put the check in each of the onBeforeTransmit functions in all of the variants cpp files. Save a little bit of juice and reducing this small current spike during TX could help keep the PA voltage a bit more steady giving slightly better TX performance? |
|
@beachmiles can you remove the led on code and measure the power difference? If it's small then chasing this down might not be worth it; if it's significant then this is important |
I remove the current limit resister on all my boards. Might be a small amount but why have a light show in a sealed box that no one can see. Buy areas like Oregon is now the benefit is a bit more then slow areas. |
Will try to see if I can compile it with it off and do some testing. I am not only concerned about saving a tiny bit of power but also ensuring there is no VCC / 3.3V voltage drop with the bright LED on why transmitting as that same rail is used by the PA chip which could degrade its TX signal strength. |
|
@towerviewcams @beachmiles Likely very minimum power saved if turn off led after TX.
It makes sense.
Let me see if the code can access powersaving_flag. |
|
Excuse my continued editing of this post. My original findings were bad as I was disabling the PA as well as the LED so was seeing way better power savings with the PA off. I couldn't easily access the powersaving_flag inside RadioLibWrappers.cpp so I just commented out the LED turning on in HeltecV4Board.cpp and built and flashed to my v4. With the LED on during TX I am seeing ~3.5W spikes that drops the voltage from my 5V usb power supply from 5.09V all the way down to 4.78V. Edit 3. @mikecarper Having the LED turned off lowers this TX peak to 3.35W and the 5.09V voltage dropping to 4.83V. Im guessing the onboard 3.3V regulator is handling this voltage drop without its 3.3V output dropping too far, but Im fairly sure its 3.3V output is not going to be steady during these short blasts of the LED which could slightly decrease the PA signal strength. Maybe this powersaving flag could be a uint8 instead of a bool so you could set different levels of powersaving for folks that want LEDs flashing and still have decent powersaving. I def love LEDs when I am debugging/troubleshooting but not when its sealed inside a box powered by a battery. This is the build I finally got working with only 1 line commented out that turns on the LED on the heltec v4 variant. |
|
The savings here are significant. Great find @beachmiles. With powersaving on, led off makes a lot of sense; I don't think we need to make a setting here. If you want blinking lights just turn powersaving off. |
|
I am willing to off the led in powersaving on. BTW, if this is bad not because of power consumption but because of the voltage drop during TX. |
|
@Theo-Marshall Thanks a lot for your testing. |
|
@mikecarper @beachmiles Confirmed having lower voltage drop via USB cable when LED is on. Measured by realtime usb monitor. So I suggest we or any friends here propose a way to turn off LED for all boards in all modes instead of just in powersaving mode. Many boards have this features. RAK4631 does not have it. |
|
@IoTThinks Hi, my apologies on a little confused. Some places say seeed esp32s3 + WIO works, some say it works with a pin hack. Some say its not working. Any chance I can get an update or eta (no hack). |
|
@basiccode12 This new PR requires no pin hack / change for Xiao Wio S3 combo. You may try the bin here. https://github.com/IoTThinks/EasySkyMesh/releases/tag/PowerSaving13 Please note Xiao S3 (non Wio) + Wio Sx1262 is different. |
Thanks!, 66mA for 2 mins then to 9mA on a 30 pin connector type. Went straight back to sleep after repeat. |
|
@basiccode12 All esp32 repeaters will wakeup every 30 minutes to check if to send adverts. Last version, periodically adverts were sent correctly. This version sleep after a few cycles after wakeup. Let me monitor the adverts. |
|
@basiccode12 So your board is Xiao Wio S3. Does it show battery percentage? |
30e37c5 to
c88813a
Compare
|
@towerviewcams Thanks for your testing and confirmation. @fizzyfuzzle I have commited the changes to this PR and did a rebased so more friends can do testing with it. I will closely monitor the feedback of power consumption for Heltec v4.3. |
|
I achieve 5.7 if both are off as mentioned above |
|
@IoTThinks Is this now merged to PS 14.1? |
|
Great work everyone! Can we get a new release soon with these changes in? https://github.com/IoTThinks/EasySkyMesh/releases |
|
@IoTThinks Thanks again for your work (and all other people involved offcourse ;) Just out of interest, why isnt the interrupt pin check code like this: |
|
@towerviewcams Yes, I pushed to PS14.1 just now. https://github.com/IoTThinks/MeshCore/tree/PowerSaving-v14.1 @mikecarper Let's slow down a bit today for more people to do testing. For now you can use this bin file: https://github.com/IoTThinks/EasySkyMesh/tree/main/firmware/Testing/2026-04-03-PowerSaving14.1-TEST |
@fizzyfuzzle The root reason is:
If we use the above code, wakeupPin's state can be changed by another ISR. E.g: a packet comes and ISR set the wakeupPin to HIGH righ after the check. So for the above code:
So we use this as extra protection, we may not want any ISR to sneak in and change the state of wakeupPin before we decide to sleep the board or not. Hope it does not confuse you more. 👯 |
|
@IoTThinks Thanks for the explanation 👌 I already assumed it was coded like that for a reason ;) makes perfectly sense now 🤓 |
|
For more curiosity. For the second attempt (the CPU panics), I guess FreeRTOS does not like forceful noInterrupts/Interrupts for esp_light_sleep_start(); |
|
@IoTThinks thanks for the info again 👌 BTW I think I found why my power consumption was slightly increased after switching between Dev branch and your main branch builds (and back), I think it turned on the radio.rxgain somewhere between my switches because of this PR which is applied on Dev branch #2124 So if that setting is indeed taking like 0.5mA on a total of 5.7mA that might indeed be what I have noticed ;) So that mystery is also solved 😅 |
|
I have 2 repeaters at tower sites that have this firm. No resets. Longest running is 11 hrs. @IoTThinks Also, seems to respond to admin login faster on first try. might have something to do with sleep and the clock stuff? not sure but I know Kevin said something about that this might decode packets better at first decode waking up? Well, I can say its faster and on first try so far each time. |
|
@towerviewcams Great. Yes, it should sleep and wakeup less abruptly. |
|
Up to 53 hours over here, looking good. I haven't looked at amps as it's in
a tree but I suspect everybody else has looked at that.
73,
Nathan Campbell, AI7NC
…On Wed, Apr 8, 2026 at 9:07 PM IoTThinks ***@***.***> wrote:
*IoTThinks* left a comment (meshcore-dev/MeshCore#1687)
<#1687 (comment)>
@towerviewcams <https://github.com/towerviewcams> Great.
Yes, it should sleep and wakeup less abruptly.
—
Reply to this email directly, view it on GitHub
<#1687 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASMB24MYMJYODNCPKBTUPET4U4OZXAVCNFSM6AAAAACVBSMOL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DEMJRGM4DOMJTGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Hi friends, The Power Saving code for ESP32 repeaters is the same as in this PR. |
|
I'm at 21 hours at a very busy, high noise repeater site and everything is running great! This location would not run 8-10 hours before. Well done Kevin! |
|
Edit - seems to be working on a WROOM based chip! Board is a Circuitmess Chatter2. Initial files here. Testing repeater build. This is really cool thank you |
|
I'm building it with my patches and deploying across the board. |
|
1 day 22 hours on a 4.3 and running strong. Remote admin login is fast and first try through multiple repeaters now. very fast response. This is great. thank you Kevin @IoTThinks |
|
FYI it's still crashing when built with dev. Panic / exception reset. |
|
Hi, I did some tests with Xiao esp32c3 and Xiao esp32c6 boards. It improves power consumption a lot. I did a lot of measurements for these and other boards with nordic power profiler. Power consumption-wise it works perfectly, but when powersaving is enabled and kicks in (after two minutes), sx1262 becomes deaf. Normally, signal strength of nearby repeater 10 km away is around 10-11 dB both ways. With powersaving, received signal drops to -6 dB. Disabling powersaving fixes it again. Noise floor (at least the value reported in repeater status) does not change. Using agc workaround agc.reset.interval has no effect. Any idea what could be happening here? Note: I'm running up-to-date IoTThinks/MeshCore PowerSaving-v14.1 branch. I'm not 100 % sure if this is 1:1 with what is present in this PR. |
|
@towerviewcams We only merge with MeshCore main for stability. |
|
@mihlit I will take a look. Which boards are you using? |
absolutely. I did not question that sir |
Doesn't dev get merged into main when it's time for a new release? The git tree tells me so, for example, look at this commit. |
|
If the pulls are shown in the commits page then it merges into dev and the next day is available via Nightly firm. Then once a new main merge happens dev is pulled forward. |
|
@terminalvelocity23 Just curious, this PR has not been merged into Dev. @towerviewcams I will monitor it. Do you have the nightly firmware you are testing? Usually, we will release a new PS firmware 1 week after MC release. |
|
@IoTThinks There must be some confusion here. I haven't asked any questions regarding this PR. |
|
@terminalvelocity23 This PR is not merged into dev yet. We love to fix a potential issue before it is getting merged into main. |


Hi friends,
This is the cleanup PR for this old PR #1353
The changes are below:
I have tested with RAK4631, Heltec v3, Heltec v4 and Heltec V4 with ESPNOW.
I will set this as Draft to see if I miss anything and let all of my repeaters to run for a while.
Thanks a lot and have a nice day.