34
You may ask, how comes the shutdown alarm could act like a startup alarm? This situation exists
since Witty Pi 2. Witty Pi 2 and 3 use the same RTC chip (DS3231), which is way better than the one
used in on Witty Pi (DS1337). The downside however, is the new RTC chip merges two alarm pins
into one. Hence without turning on your Raspberry Pi and check the RTC registers, Witty Pi doesn’t
know if the current alarm is a shutdown alarm or not.
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 10 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 the given 10 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 the GPIO-4 listener
to shutdown your Raspberry Pi.
If it is the case, you can try to delay the starting of GPIO-4 listener, and in the major 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 10 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, or you can use another pin to replace GPIO-4.