nRF52 Solar Nodes: Inconsistent wake-up behavior and brownout risks
Category
Other
Hardware
DIY
Is this bug report about any UI component firmware like InkHUD or Meshtatic UI (MUI)?
- [ ] Meshtastic UI aka MUI colorTFT
- [ ] InkHUD ePaper
- [ ] OLED slide UI on any display
Firmware Version
2.7.20
Description
Currently, nRF52-based targets (especially XIAO nRF52840 and RAK4631) suffer from a "Deep Sleep Coma" when powered by solar panels. The nodes deplete the battery down to ~3.1V, where the LDO often fails to maintain a stable 3.3V rail, leading to brownouts or unrecoverable SYSTEM_OFF states.
Technical Analysis
- OCV Curve: The default OCV_ARRAY is too aggressive for unattended solar nodes, leaving zero safety margin for the regulator before shutdown.
- LPCOMP: Hardware wake-up via LPCOMP is either missing (XIAO) or not correctly aligned with the discharge curve, preventing the node from resetting when solar power returns.
Proposed Solution
I have validated a fix in my fork that:Redefines the 0% battery threshold to 3.4V to ensure a clean shutdown and leave "start-up" energy for the next day. Enables/Aligns LPCOMP (NnRF52 hardware comparator) to trigger a wake-up only when $V_{bat} > 3.7V$.
I have already compiled and tested these changes for RAK4631 and XIAO nRF52840 with successful autonomous recovery. I am willing to submit a PR if the team is interested in this power management optimization.
Relevant log output
@JBAU92, Welcome to Meshtastic! :wave:
Thanks for opening your first issue. If it's helpful, an easy way to get logs is the "Open Serial Monitor" button on the Web Flasher.
If you have ideas for features, note that we often debate big ideas in the discussions tab first. This tracker tends to be for ideas that have community consensus and a clear implementation.
We're very active on discord, especially the #firmware and #alphanauts-testing channels. If you'll be around for a while, we'd love to see you there!
Welcome to the community! :heart:
This issue reports a potential device/firmware bug but does not include any device logs. Please provide logs to help diagnose the wake-up behavior and brownout risks. You can get Web Flasher logs by connecting the device via USB at https://flasher.meshtastic.org or using the Meshtastic CLI with the command: meshtastic --port
@HarukiToreda ,power god, how do you feel about diff OCV curves for solar variants?
Different OCV curves for solar variants are necessary, but they are only half the solution.
Here is the technical reality of why these nodes are falling into a "Deep Sleep Coma":
-
The Brownout Trap (OCV Curve) The default OCV curve pushes the hardware down to ~3.10V. For unattended solar nodes, this is fatal. At this level, the LDO struggles to maintain a stable 3.3V rail. A LoRa TX spike causes an immediate voltage drop, leading to brownouts and bootloops before the PowerFSM can trigger a clean SYSTEM_OFF. I've set my solar OCV 0% at 3.4V, which guarantees a safe software shutdown and leaves a minimal buffer for the morning sun.
-
The Missing LPCOMP Definitions (The real bug) Even with a correct OCV, nodes like the XIAO or ProMicro will never wake up. If you look at the official variant.h files for seeed_xiao_nrf52840_kit and promicro, they define the ADC variables (BATTERY_PIN, ADC_MULTIPLIER) but completely omit BATTERY_LPCOMP_INPUT and BATTERY_LPCOMP_THRESHOLD.
The Fix: In my fork, I've injected the missing macros into the variant files (e.g., mapping the XIAO's battery pin to NRF_LPCOMP_INPUT_7 with a NRF_LPCOMP_REF_SUPPLY_3_8 threshold, which yields a ~3.71V wake-up). Combined with the 3.4V OCV curve, autonomous recovery is now 100% reliable in the field.
I strongly support specific solar variants (or a solar device role) that applies a safer OCV curve and ensures LPCOMP is strictly enforced across all nRF52 boards, not just the RAK. Happy to submit a PR with these definitions if we agree on this approach.
Hey, I was noticing similar behavior on the RAK Boards as you mentioned. Especially with weaker solar panels and long winter days without sun. I lost a node in Dec, which I need to visit soon . - Also a even smaller panel node kept in the garden had the same fate. - I was able to resolve the issue in the smaller node by putting in protected cells. If the battery gets drained to that low voltage the cell cuts of, the restart on the next day with some light would work more reliable. I hope for a fw fix.
Great work! I've been chasing down this same problem on my rak4631 based remote solar nodes! (two of which are dead after a two day storm / low light. again.) I can reliably reproduce the brownout / lockup problem on my bench, and was just starting the process of tinkering with OCV_ARRAY and LPCOMP values to see if that helped. So this gives me hope!
I'm running LiFePO4 chemistry through (with an external charger board and a buck-boost converter for the 3v3 rail), so my values will likely be different from yours. Also, I noticed that somewhere in the chain recently meshtastic has removed the other battery chemistry curve definitions from power.h, so I have to define my own in variant.h anyway.
Ideal would be software settings for "battery chemistry" and "wake-up threshold" or something so that people can adapt the various boards for their hardware setup without rebuilding the firmware.
I haven't dug through the power / deepsleep code enough to figure it out: Does the final value in OCV_ARRAY determine the 0% / deep sleep point?
I've tried the JBAU92 Fix in their github fork and i can say definitely works like a charm. The Node sleeps and wake up perfectly, leaving margin to a New solar day aproaches.
I've suggest that can be officially merged with maybe a New category of firmware made for infraestructure nodes.
Thanks for your work
I think this is worth submitting a PR for, I have a bunch of nrf52 solar nodes (Seeed and GAT562) too that we have overbuilt significantly but we could recover some batteries out of them or use smaller panels for the GAT562 if they wake themselves up reliably.
+1 for a PR.
I wish those RAK baseboards had a proper voltage supervisor and/or hardware watchdog, but even if you have that, hardening the firmware is a win.
I found this in a related bug: SAFE_VDD_VOLTAGE_THRESHOLD
This could also be set for specific boards, and does not seem to be set at anything higher than 2.9V for any platform afaict?
I still like to just shut down much earlier, but still.
Combined with the 3.4V OCV curve, autonomous recovery is now 100% reliable in the field.
...as long as there's enough sun, soon enough for the battery to not discharge much further. So "100% reliable" is overly optimistic. Software alone cannot ensure that.
To make sure the node can wake up even if the battery has been too low to provide a stable sleep voltage, you need a voltage supervisor which is additional hardware that the RAK baseboards don't come with, unfortunately.
I've been profiling the deep sleep behavior using a PPK2 to understand why solar nodes (specifically nRF52840 + SX1262) fail to wake up after reaching the low-voltage cutoff, even when the solar panel eventually pushes the battery back up to a healthy level (4.2V). I documented the debugging process, the hardware behavior, and the firmware fix in this video: https://youtu.be/snT3plcP0e8 Summary of findings and proposed fixes:
- Sleep/Wake Thresholds (Deep Sleep Lock-up) Root Issue: The default firmware sends the node to sleep at 3.0V. At this voltage, a standard 3.3V LDO is already in dropout.
Fix: Modified the variant.h to increase the sleep threshold to 3.4V and set a wake threshold of 3.7V. This provides enough headroom for the LDO to maintain stable logic levels and a wide enough hysteresis to ensure the battery has actually recovered before enabling the radio.
Video reference: [06:06] - [10:00]
- RX Duty Cycle Optimization (40% power reduction) Root Issue: The SX1262 stays awake too long waiting for preamble symbols. RadioLib currently sets a minimum of 8 symbols (multiplied by 2 for the worst-case scenario), which leaves the radio essentially at a 100% duty cycle in RX, consuming ~7.5mA continuously. Fix: Lowered the minimum symbols in the firmware from 8 to 5. This allows the SX1262 to properly cycle sleep/wake states to detect the preamble, dropping average RX consumption to ~4.5mA. I haven't noticed packet loss in my local tests.
Video reference: [11:52] - [16:30]
I'd like to get the team's thoughts on making the sleep/wake thresholds configurable via the App/CLI rather than hardcoded, or at least adopting a safer default for LDO-based variant boards. Regarding the preamble symbols, it might be worth exposing this as an advanced setting for users deploying strictly low-power static nodes.
The RX duty optimization probably belongs in its own issue?
I am, and have been, testing the OCV_ARRAY and BATTERY_LPCOMP_INPUT changes and they seem to work well for me. Testing in a more real-world scenario now with solar panels instead of lab PSUs, and with pretty bad solar resources atm.
Since version 2.7.20 I’ve been experiencing recurring issues with several RAK WisBlock nodes I run on LiFePO4 across multiple setups.
Many of these nodes are deployed in towers and remote locations, so physical access is limited. What I’m consistently seeing is that whenever a node fully loses power (battery depletion), it often does not recover cleanly when power is restored. Instead, it ends up unresponsive or in a bad state, requiring manual intervention (the magic reset/reboot 😅)
This behavior matches exactly what is being described in this issue regarding power loss / brownout / recovery handling.
Given the LiFePO4 discharge curve, hitting low voltage conditions is quite common in real-world deployments (especially solar-powered ones). I’m in a region with more than 300 days of sun per year, and even so this still happens from time to time.
That said, it doesn’t happen very frequently, but during this past winter there were several more cases further north. With the weather being more overcast for extended periods, some nodes ended up hitting low voltage and the issue became more noticeable.
Initial troubleshooting on my side was mostly trial and error, until it became clear that the problem wasn’t limited to my own nodes and matched what is being described here.
It would be a huge relief if this could be handled more gracefully, either:
- At firmware level (robust brownout detection, clean shutdown, safe boot recovery);
or/and (whatever suits best)
- At application level (detecting bad states and simplifying recovery)
Right now, this is a significant pain point for unattended WisBlock + LiFePO4 deployments.
Also, every time I have to drive ~80km to reset a node, my wife gives me that look… so solving this would definitely improve both network reliability and domestic harmony 😅
Happy to help test or provide additional data if needed 👍
@JBAU92 yes please to a PR, this would be a very appreciated fix for a significant pain point in winter. Thanks for your work!
Hi all, just wanted to say the community of people in here working the issue is really appreciated. Please keep hacking and testing, will be here to review code once you get something that seems like a happy path :)