I am running a PI Zero 2W from a solar panel, using a Witty Pi 4 L3V7 to schedule when the device is run. The system is out in a prairie and hooked to a solar panel to keep batteries charged. If there are too many cloudy days, the battery will discharge enough that it can't help provide the surge of power needed when the PI and it's periphials are powering on. Once that happens, the system will never turn on again, because the schedule script is never run. I didn't see any options in the firmware to have a default interval for turning on the PI, so I was going to add one. I just want the firmware to always schedule the next turn on time for 5 minutes later, and then I can change that to a different time with the normal schedule script once the system has booted. I am generally familiar with the arduino setup() and loop() stuff, but it didn't look like that's where the turn on code was at, and I figured it was worth asking where I should add code before I spent a bunch of time trying to figure it out.
I just want the firmware to always schedule the next turn on time for 5 minutes later
Before trying to modify the firmware, maybe you can try the "guaranteed wake mode" introduced since firmware Rev7. The "guaranteed wake mode" has been detailly discussed here: https://www.uugear.com/forums/technial-support-discussion/high-reliability-mode/
If you turn on this mode with:
i2cset -y 0x01 0x08 49 0x01
Then it will wake up your Pi in about 1 hour. This configuration will persist even if the board is not powered.
@admin Does that only try to turn on once though? If there are multiple cloudy days, the panels keep the battery charged enough that the witty pi itself works, but not the PI. It may be 2 full days of not being able to power on before there is enough sunshine for the battery to charge high enough to power the PI as well. So, I wouldn't need it to just try a single time one hour for now, I would need it to try every hour until the PI actually powers on.
@psyon I think the scenario you mentioned has been considered in the firmware.
You can take a look at this part in the source code: https://github.com/uugear/Witty-Pi-4/blob/main/Firmware/WittyPi4_L3V7/WittyPi4_L3V7.ino#L360-L381
The counter will be reset to 0 when battery voltage is too low, so it will retry later (in your case, after 1 hour).
The counter will be reset to 0 when battery voltage is too low, so it will retry later (in your case, after 1 hour).
The issue is that the voltage is reported as high enough to start up, because the solar panel will show a higher voltage, but can't put out the amperage needed by the boot process. The charging module only allows one amp to be drawn from the solar panel even when at peak, and the battery provides the extra power needed at boot. When when the battery is low, the voltage will show higher due to the solar panel, but the battery is so low that the pi will not boot.
@psyon this issue will exist even if you modify the firmware as per your initial plan. Trying to boot up for every 5 minutes will even lower the chance to boot Pi up.
A simple workaround is to turn on the "guaranteed wake mode" with bigger wake up interval, which gives better chance to success as your battery gets charged for longer time.
However, when charging the battery, the power source you connected to USB-C connector (solar panel with 5V output) will also take the responsibility to power your Raspberry Pi. So it was not that your battery can not boot up Raspberry Pi, instead it was your solar panel can not deliver enough current for that. Actually if your solar panel is always connected, your device will not use battery (even if it is full) unless the solar panel's output voltage on USB-C is lower than the battery voltage.
The designed scenario is to charge the battery with 5V wall plug, which is suppose to be a stable power source. An unstable 5V supply (like your solar panel) always connected to USB-C is really not expected. You may need to add extra circuit to disconnect your solar panel from Witty Pi 4 L3V7 when its output is weak.
You may need to add extra circuit to disconnect your solar panel from Witty Pi 4 L3V7 when its output is weak.
I do have extra circuitry. The solar panel is not plugged in directly to the Witty Pi. I have a separate solar charging module with a battery conencted to it, with the output of that going into the battery connector on the Witty PI to use the built in boost converter. The solar charging module has "path to power", which allows the battery so suppliment the power from the panel when it's not providing enough. Even at peak performance, the panel can not put out enough power for the initial boot up sequence, so the battery has to provide extra power.
@psyon if I understand it correctly, your solar panel + battery + extra circuit work as a "battery" to Witty Pi 4 L3V7. There is no power source connected to the USB-C connector on Witty Pi 4 L3V7.
On Witty Pi side, it can only see the voltage of the "battery". If that voltage could also come from the solar panel, the firmware will get confused. If the solar panel with your battery still can not boot up a Pi, there is not much you can do. You may try to define a better timing for retry though.
@admin You are correct, and that is why I am looking to add a default scheduled time to turn on. I could also make it only do the retries in the morning to give it a chance to recharge the battery the day prior. In the warm months, I can just drive out and change batteries when ever it's dead, but in the winter, access is limited so having it turn back on when ever it can is ideal.
