Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] [Witty Pi 4] Inconsistent Start Up

4 Posts
2 Users
0 Likes
425 Views
 tom
(@thomas-blaine)
Posts: 0
New Member Customer
Topic starter
 

Hello.

First, a big thank you for creating this nifty gadget. Very cool idea.

I am hoping you can help me with an issue I’ve encountered.

Witty Pi details:

Witty Pi 4

Version 4.13

Firmware ID: 0x26

Firmware Revison: 0x03

 

RPi details:

Raspberry Pi Zero W Rev 1.1

OS: "Raspbian GNU/Linux" and VERSION_ID="11"

 

I’ve included at the bottom:

  1. The schedule (a key detail: each on period is tied to WAIT so we’re depending on user for shutdown)
  2. afterStartup.sh (a key detail: we are using an & so the daemon shouldn’t be blocked)
  3. kickoff.sh (a key detail: we use shutdown to shutdown the raspberry pi)
  4. a sample of the log showing one full cycle of observed behaviour

Observed behaviour:

  • The white light is flashing but the RPi has not turned on during an expected on time
  • WittyPi button is pressed
  • RPi turns
  • The script runs as expected
  • The RPi turns off as expected
  • The white light flashes
  • At the NEXT expected on time, the Witty PI turns on the RPi as expected
  • The script runs as expected
  • The RPi turns off as expected
  • The white light flashes
  • At the NEXT expected on time, the RPi does NOT turn on and the cycle repeats

schedule.wpi:

BEGIN 2023-08-29 06:00:00
END 2025-08-30 23:45:00
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M40 WAIT
OFF M20
ON M30 WAIT
OFF H8 M30

afterStartup.sh:

#!/bin/bash
# file: afterStartup.sh
#
# This script will run after Raspberry Pi boot up and finish running the schedule script.
# If you want to run your commands after boot, you can place them here.
#
# Remarks: please use absolute path of the command, or it can not be found (by root user).
# Remarks: you may append '&' at the end of command to avoid blocking the main daemon.sh.
#
/usr/bin/sh /home/pizero/code/rpi-timelapse/kickoff.sh &

kickoff.sh:

/usr/bin/echo kicking off python
/usr/bin/date
/usr/bin/python3 /home/pizero/code/rpi-timelapse/wrapper.py
/usr/bin/echo sleeping
/usr/bin/date
/usr/bin/sleep 25m
/usr/bin/echo shutting down
/usr/bin/date
/usr/sbin/shutdown

wittyPi.log:

>>>>>>>>>> Manual kickoff after missing on period

[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.13) is started.
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi Zero W Rev 1.1
[xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system
[xxxx-xx-xx xx:xx:xx] Writing RTC time to system...
[2023-08-30 14:17:31] Done 🙂
[2023-08-30 14:17:31] Firmware ID: 0x26
[2023-08-30 14:17:32] Firmware Revison: 0x03
[2023-08-30 14:17:33] Current Vout=5.34V, Iout=0.1A
[2023-08-30 14:17:34] System starts up because the button is clicked.
[2023-08-30 14:17:43] Send out the SYS_UP signal via GPIO-17 pin.
kicking off python
Wed 30 Aug 14:17:43 EDT 2023
[2023-08-30 14:17:47] Pending for incoming shutdown command...
[2023-08-30 14:18:23] Skip scheduling next shutdown, which should be done externally.
[2023-08-30 14:18:24] Schedule next startup at: 2023-08-30 15:00:00

>>>>>>>>>> Various log messages from python

sleeping
Wed 30 Aug 14:20:35 EDT 2023
shutting down
Wed 30 Aug 14:45:35 EDT 2023
Shutdown scheduled for Wed 2023-08-30 14:46:35 EDT, use 'shutdown -c' to cancel.

>>>>>>>>>> Successful self start up

[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.13) is started.
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi Zero W Rev 1.1
[xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system
[xxxx-xx-xx xx:xx:xx] Writing RTC time to system...
[2023-08-30 15:00:53] Done 🙂
[2023-08-30 15:00:53] Firmware ID: 0x26
[2023-08-30 15:00:54] Firmware Revison: 0x03
[2023-08-30 15:00:55] Current Vout=5.28V, Iout=0.1A
[2023-08-30 15:00:56] System starts up because scheduled startup is due.
kicking off python
[2023-08-30 15:01:05] Send out the SYS_UP signal via GPIO-17 pin.
Wed 30 Aug 15:01:05 EDT 2023
[2023-08-30 15:01:09] Pending for incoming shutdown command...
[2023-08-30 15:01:44] Skip scheduling next shutdown, which should be done externally.
[2023-08-30 15:01:45] Schedule next startup at: 2023-08-30 16:00:00

>>>>>>>>>> Various log messages from python

sleeping
Wed 30 Aug 15:03:10 EDT 2023
shutting down
Wed 30 Aug 15:28:10 EDT 2023
Shutdown scheduled for Wed 2023-08-30 15:29:10 EDT, use 'shutdown -c' to cancel.

>>>>>>>>>> Missed self start up leading to manual start up

[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.13) is started.
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi Zero W Rev 1.1
[xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system
[xxxx-xx-xx xx:xx:xx] Writing RTC time to system...
[2023-08-30 16:06:47] Done 🙂
[2023-08-30 16:06:47] Firmware ID: 0x26
[2023-08-30 16:06:47] Firmware Revison: 0x03
[2023-08-30 16:06:49] Current Vout=5.34V, Iout=0.06A
[2023-08-30 16:06:50] System starts up because the button is clicked.
[2023-08-30 16:06:58] Send out the SYS_UP signal via GPIO-17 pin.
kicking off python
Wed 30 Aug 16:06:59 EDT 2023
[2023-08-30 16:07:03] Pending for incoming shutdown command...
[2023-08-30 16:07:38] Skip scheduling next shutdown, which should be done externally.
[2023-08-30 16:07:39] Schedule next startup at: 2023-08-30 17:00:00

 
Posted : 30/08/2023 10:35 pm
(@admin)
Posts: 371
Member Admin
 

It is the second time we receive a report for similiar problem (scheduled startup gets ignored) on Raspberry Pi Zero W, and we could not reproduce it in our lab.

Is it possible for you to test it with a Raspberry Pi 3B or 4B? Or maybe you can test it with a different piece of Raspberry Pi Zero W? We guess it might be related to the internal pull-up/down on GPIO-4 pin.

 

 
Posted : 31/08/2023 10:39 am
 tom
(@thomas-blaine)
Posts: 0
New Member Customer
Topic starter
 

Thank you for the quick reply! Unfortunately I don't have an extra RPi sitting around. I'll try reinstalling the OS etc and see if that happens to resolve the situation.

Two questions in the meantime:

1. Is shutdown the appropriate shutdown command to use? (or is it imperitive that I use GPIO 4 to turn it off?)

2. Is my understanding that once WAIT is used, the ratio between on and off doesn't matter so long as they total to the desired amount? It's not like the RPi must turn off during the ON time (or during the OFF time)?

 
Posted : 31/08/2023 3:59 pm
(@admin)
Posts: 371
Member Admin
 

Shutdown is an acceptable way to turn the device off. The drawback is that Witty Pi's software (daemon.sh) doesn't know about the system shutdown and this shutdown has no record in log. Also the commands in beforeShutdown.sh (if there is any) will not be executed.

Pulling down GPIO-4 is the best way, the software will write a record in the log file and the commands in beforeShutdown.sh will be executed.

Posted by: @thomas-blaine

once WAIT is used, the ratio between on and off doesn't matter so long as they total to the desired amount

Yes, your understanding is correct.

 

 
Posted : 01/09/2023 6:45 pm
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.