4. GPIO-4 pin doesn’t reach a stable status in given time
After the system is on, GPIO-4 pin should be in input mode and gets internally pulled up. However,
during the startup the GPIO-4 pin could be unstable. In the daemon.sh script, the GPIO-4 listener
will be started once the pin state hasn’t changed for 5 seconds. Once the GPIO-4 listener is started,
any action that pulls down GPIO-4 will be regarded as a shutdown command. So if GPIO-4 pin
doesn’t really get stable after that given 5 seconds, Witty Pi will take it as a shutdown command,
lights up the white LED and then shutdown the system.
There are many factors that might cause the GPIO pin unstable, and the most common one is the
power supply. If your power supply is not strong enough, during the booting its voltage may drop
from time to time, which may also make the GPIO pin voltage drop, and trigger Witty Pi's software to
shut down your Raspberry Pi.
If it is the case, you can try to delay the starting of GPIO-4 listener, and in the majority of cases it will
help. You can modify the “daemon.sh” script, in line 94:
while [ $counter –lt 5 ]; do
Try to change the number 5 to 25. The bigger number you use, the later the GPIO-4 listener will be
started.
This modification may workaround the problem. If it doesn’t, it means your GPIO-4 is really pulled
down (by software or hardware), and you can confirm that by measuring the voltage on GPIO-4 with
a multimeter. By default, the GPIO-4 should be internally pulled up. If it gets pulled down, try to find
out who does this and don’t let it do this again.
15.6 Why Raspberry Pi Immediately Turns On after Shutdown?
When ALARM1 (startup) occurs, Witty Pi’s firmware will check Raspberry Pi’s status. If Raspberry Pi
is off, Witty Pi will turn it on; If Raspberry Pi is still powered, Witty Pi’s firmware will cache this startup
request and will turn on Raspberry Pi just after it gets power off.
This scenario may happen when your Raspberry Pi’s TXD pin does not go LOW after system has
been shut down. The reason could be some other hardware strongly pulls up TXD pin, or the system
crashed during shutdown. When ALARM1 (startup) occurs, your Raspberry Pi is still powered
because the turning off process is still not finished.
When this happens, you can find this message in the wittyPi.log file:
System starts up because of the scheduled startup got delayed. Maybe the scheduled startup was
due when Pi was running, or Pi had been shut down but TXD stayed HIGH to prevent the power cut.
This will not be a problem as long as the TXD pin can eventually go LOW after shutdown and the
device can continue the ON/OFF sequence.