Added PowerSaving for all ESP32-based repeaters#1687
Added PowerSaving for all ESP32-based repeaters#1687IoTThinks wants to merge 9 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. |
|
@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? |
this is mine...to avoid confusion. no batt percent. I dont think its capable of it, which is suprising considering it comes with dedicated batt pads. I just measure manually. |
I didnt measure for 30 mins, but that makes sense. |
|
@basiccode12: My periodically adverts still work fine on Heltec v3 with this PR. The repeaters will wake up every 30 minutes to check it is time to send periodically adverts. |
|
This build was working great for me with the TX LED off version Ive been testing with. Unfortunately after finally moving my repeater to the roof I my noise floor shot up and I started getting the dreaded -120db noise floor bug. With it on the roof and a great view of the city and surrounding mountains and my noise floor shot up to -60 to -70 and now is locking up at -120 and Im getting much fewer successfully traceroutes. Setting agc.reset.interval to 8 got me better performance but the noise floor lockup at -120 seems to destroy RX performance until I manually reboot. Even after disabling agc.reset.interval by setting it back to 0 and rebooting I still managed to get the noise floor lockup at -120. Hopefully this powersaving mod and this fixagcreset mod can join forces soon! Sounds like it may be in the works and already being tested by @towerviewcams. Hope its successful and looking forward to the results! |
|
@beachmiles I will do a merge with AGC reset PR today. You prefer dev or main branch? |
|
@IoTThinks I dont know enough between dev and main to make an informed choice. I am looking for the most stable version with the highest chance of success. But it looks like a build was made merging 1569, 1600 and 1687 already. Gonna test it out now. |
So far its fantastic on 3, V4 in my lab and now 1 on a high noise tower site. tomorrow morning I'll know for sure as this takes 24hrs to really test |
|
After some more testing I can confirm that with this PR the repeater becomes much more sluggish in all aspects. I can't reliably login into the administrative interface, the UI throws timeouts with things like neighbor tabl, requesting LoRa settings and the like more often than not, and the CLI is slower, too. The ACKs to my outgoing messages get delayed to 10 seconds or so. |
|
@terminalvelocity23 I suggest you can try this PR alone to test the behavior instead of mixing many PRs. Btw, how many hops you use to remote manage your repeater? |
|
I'm just building the latest release for my own hardware and will throw it on the roof |
I don't have a V3 on hand anymore, but I have a V4. Zero hops, it's a direct route from client to repeater, they're like 5 meters apart from each other (the tx power on a client is set to 3 dBm to avoid overloading the receiver on the repeater). agc.reset.interval is 8, int.thresh 15, af 5, txdelay 0.5, rxdelay 0.5, direct.txdelay 0. I'll flash your firmware to my V4 and give it a try. |
|
@towerviewcams May be the mixed of 3 PRs has some side effects. In the meantime, you may test with PS 13 on Heltec v4 first. If there is anything we can improve to make 3 PRs live together, we will improve it. :) |
|
So far it works fine on the bench, the only hiccup is the occasional CLI freeze (2 out of 10 or so). I've put it in place of my main repeater, let's see how it will handle the load. It's connected to a 5 element Yagi through a cavity BPF, height above ground is about 50 meters, so it hears quite a lot of packets. |
|
After 40 minutes of testing it went deaf, stuck at -120 dBm. The responsivity is alright though, no complaints here. Looks like this PR alone isn't the one to blame for the sluggishness. |
|
@towerviewcams Let me explore AGC PR and see how to make AGC and PowerSaving work together tomorrow. |
|
@IoTThinks Your branch works well on my Heltec V4 but if I pick up the changes on top of the current dev branch (b67decf), there is something weird going on, looks like each command gets the reply from the previous one. See on the screenshot below, the first Also login only works on the second try. 100% repeatable, and I'm sitting next to the repeater.
That's maybe the same symptom described by @terminalvelocity23 |
|
@etienn01 Really. I guess there is some weird change in dev. |
|
I have built this PR with AGC reset PR It works fine for Heltec v4 repeater. |
|
@IoTThinks it looks like it's caused by #1795
With So every queued packet is treated as "in the future" and skipped. (thanks to Claude Code for the analysis) |
|
@etienn01 Nice catch. Old one happens to be correct for 0xFFFFFFFF Current one fixed wrap around but seems to have bug for now=0xFFFFFFFF Proposed fix? |
|
Or just use count() and ignore the bug =) class PacketQueue { public: |
|
Testing this now, seems to work 👍 There are a few places where |
|
I wonder if your powersaving code will work for room servers. Right now powersaving mechanism from main doesn't appear to work for them, mine's pulling 68 mA in standby. |




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.