Hello,
I'm using a Raspberry Pi Zero 2W with a Witty Pi 3 Mini.
I would like to use both voltage threshold in order to turn it on/off safely.
Right now, it starts OK when I reach the recovery threshold, but I have two problems with the low voltage threshold.
1) If I launch the following command on terminal, it powers off OK.
raspi-gpio set 4 op dl
also If I click the Witty button, it shutdowns OK. But when the VIN pin gets below the low voltage threshold, it doesn't turn off. The white LED stands on, but it never turns off.
2) It takes sooo long to turn the rpi off, around a minute. How can I check what's dealing with this process? I have some services running, but I would like to know what's the reason.
WittyPi.log. It doesn't turn off with the low voltage threshold, so I had to push the WittyPi button.
[2024-08-26 18:23:57] Witty Pi daemon (v3.53) is started. [2024-08-26 18:23:57] Running on Raspberry Pi Zero 2 W Rev 1.0 [2024-08-26 18:23:59] Firmware ID: 0x22 [2024-08-26 18:23:59] Current Vout=4.78, Iout=0.23 [2024-08-26 18:23:59] Send out the SYS_UP signal via GPIO-17 pin. [2024-08-26 18:24:00] Synchronizing time between system and Witty Pi... [2024-08-26 18:24:00] Writing RTC time to system... [2024-08-26 18:24:52] Done :-) [2024-08-26 18:24:59] Pending for incoming shutdown command... [2024-08-26 18:24:59] File "schedule.wpi" not found, skip running schedule script. [2024-08-26 18:25:02] Internet detected, apply network time to system and Witty Pi... [2024-08-26 18:25:02] Applying network time to system... [2024-08-26 18:25:02] Done :-) [2024-08-26 18:25:02] Writing system time to RTC... [2024-08-26 18:25:03] Done :-) [2024-08-26 18:26:15] Low voltage threshold set to 4.9V! << Here I set VIN to 4.88V, white led stands ON and nothing else happened >> << after waiting more than a minute, I pushed the WittyPi button >> [2024-08-26 18:29:07] Shutting down system because the input voltage is too low: [2024-08-26 18:29:08] Vin=5, Vout=4.85, Iout=0.1 [2024-08-26 18:29:08] Low voltage threshold is 4.9V, recovery voltage threshold is disabled [2024-08-26 18:29:08] Halting all processes and then shutdown Raspberry Pi... [2024-08-26 18:30:44] Witty Pi daemon (v3.53) is started. [2024-08-26 18:30:44] Running on Raspberry Pi Zero 2 W Rev 1.0 [2024-08-26 18:30:46] System was previously shut down because of low-voltage. [2024-08-26 18:30:46] Firmware ID: 0x22 [2024-08-26 18:30:46] Current Vin=4.87, Vout=4.72, Iout=0.23 [2024-08-26 18:30:46] Send out the SYS_UP signal via GPIO-17 pin. [2024-08-26 18:30:47] Synchronizing time between system and Witty Pi... [2024-08-26 18:30:47] Writing RTC time to system... [2024-08-26 18:31:17] Done :-) [2024-08-26 18:31:24] Pending for incoming shutdown command... [2024-08-26 18:31:24] File "schedule.wpi" not found, skip running schedule script. [2024-08-26 18:31:27] Internet detected, apply network time to system and Witty Pi... [2024-08-26 18:31:27] Applying network time to system... [2024-08-26 18:31:29] Done :-) [2024-08-26 18:31:29] Writing system time to RTC... [2024-08-26 18:31:29] Done :-)
Forget the 2nd point, it was a service of mine that was not working as expected.
@javinair Do you have other hardware that physically connected to GPIO-4 on your Pi?
According to your description, the white LED turns on means the firmware already detected the in voltage is too low and it tried to shutdown the system (emulating a button click by pulling down GPIO-4). It seems the software didn't capture such an emulated clicking.
Does your device work well if you schedule shutdown or startup?
Hello again,
I've done the following tests, as you requested on your previous post.
I've used this script in order to turn it on/off every 2 minutes via schedule file:
BEGIN 2016-08-05 00:00:00 END 2025-07-31 23:59:59 ON S0 OFF M2
When it gets the time to shutdown, white led stands on but never turns off. I had to press the WittyPi button.
When it gets the time to start, it works as expected.
Check the log file:
[2024-08-28 16:05:17] Copying "test.wpi" to "schedule.wpi"... [2024-08-28 16:05:17] Running the script... [2024-08-28 16:05:17] Schedule next shutdown at: 2024-08-28 16:06:00 [2024-08-28 16:05:18] Schedule next startup at: 2024-08-28 16:08:00 [2024-08-28 16:05:18] Done :-) << At 16:06:00 it should be turned off automatically but it didn't happen, so I had to press the button. I've waited around a minute, it usually takes a few seconds to turn off >> [2024-08-28 16:06:56] Shutting down system as scheduled [2024-08-28 16:06:56] Halting all processes and then shutdown Raspberry Pi... [2024-08-28 16:07:03] Witty Pi daemon (v3.53) is started. [2024-08-28 16:07:03] Running on Raspberry Pi Zero 2 W Rev 1.0 [2024-08-28 16:07:05] Firmware ID: 0x22 [2024-08-28 16:07:05] Current Vout=4.72, Iout=0.15 [2024-08-28 16:07:05] Send out the SYS_UP signal via GPIO-17 pin. [2024-08-28 16:07:06] System startup as scheduled. [2024-08-28 16:07:06] Synchronizing time between system and Witty Pi... [2024-08-28 16:07:06] Writing RTC time to system... [2024-08-28 16:08:19] Done :-) [2024-08-28 16:08:29] Internet detected, apply network time to system and Witty Pi... [2024-08-28 16:08:29] Applying network time to system... [2024-08-28 16:08:30] Done :-) [2024-08-28 16:08:30] Writing system time to RTC... [2024-08-28 16:08:30] Done :-) [2024-08-28 16:08:42] Pending for incoming shutdown command...
I also attach my current configuration. I pretend to make a solar powered weather station, with batteries. As you can check, I'm using a GPIO expansion board but GPIO4 pin is clear.
I appreciate your time and support.
Thanks.
Further information. These are the lines I have on my /boot/config.txt related to dtoverlay:
dtparam=i2c_arm=on dtparam=spi=on dtoverlay=imx708 dtoverlay=vc4-kms-v3d,nohdmi [all] dtparam=i2c1=on dtoverlay=pi3-miniuart-bt dtoverlay=miniuart-bt
I'm using some external sensor via I2C and SPI, an external camera, disabed BT and HDMI and enabled legacy video driver.
Maybe you have a clue what's happening over there...
As I said before, the problem is only trying to turn it off.
schedule file:
BEGIN 2016-08-05 00:00:00 END 2025-07-31 23:59:59 ON S0 OFF M2
This schedule script is not right. There is no point to set the duration of ON state to 0 second, which means you don't want your Raspberry Pi to turn on at all.
In reality such script will not work as expect, because at the moment when scheduled shutdown is due, your Raspberry is just start booting and there is no software running on your Pi to capture and handle this shutdown event. Later when this schedule script is loaded by the software, the ON state has been passed for a while and the emulated clicking by firmware has been missed.
Considering the time needed to actually boot up your Raspberry Pi, you should at least set the ON state to 2 minutes long, so you could have some time to log into your Pi before it shuts down again.
@admin I created that scheduler using your online tool: https://www.uugear.com/app/wittypi-scriptgen/
Anyway, that scheduler is not the problem itself (maybe I created it wrong, you are right).
---
I've also configured schedulers to turn it on and off via wittyPi.sh script (main menu, options for auto start and auto shutdown) and I have had the same results. Auto startup scheduler works OK, but auto shutdown doesn't work.
@javinair scheduled startup and scheduled shutdown works differntly. To startup the firmware just control the MOSFET to feed Raspberry Pi 5V, and the Pi boots by being powered. Scheduled shutdown however, needs the cooperation from software (daemon.sh). The firmware emulates a button clicking by pulling down GPIO-4 for a short moment, this event should be captured by daemon.sh, which will then execute a shutdown command.
According to the information you provided, it seems daemon.sh can not capture the emulated button clicking from firmware. It is also possible that the GPIO-4 on your Pi has rather strong pull-up and needs longer pull-down to take effect. If it is the case, maybe modifying the firmware and pulling down GPIO-4 for longer would help. However Witty Pi 3 has been discontinued for rather long time, and we will not work on its firmware anymore. If you are interested in trying this by yourself, you may want to read these:
https://github.com/uugear/Witty-Pi-3/wiki/How-to-compile-the-firmware
Hello again @admin,
I won't upgrade my Witty Pi 3 mini so I'll figure it out how to deal with it. As I don't have any problem with the power on method, I'll keep the Witty Pi 3 mini for that purpose. I'm using a MCP3008 to read some sensors, so I'm going to read battery level with it.
Thanks for your attention, your patience and time.