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

[Solved / Archived] Issue with starting a daily wake up with wittypi 4

5 Posts
2 Users
0 Likes
479 Views
(@basileploteau)
Posts: 3
Active Member
Topic starter
 

Hello,

I'm encountering an issue for a project using Witty Pi 4 board. I mounted it on a raspberry pi zero, that I'm using for picture acquisition. The plan is to wake up the system once a day in order to send a photo. Therefore I created the following schedule script.

BEGIN 2021-01-01 11:00:00
END 2030-01-01 11:00:00
ON M5
OFF H23 M55

Actually the witty pi 4 is only waking up the rpi0. Then a bash script is taking a picture and at its end, I shutdown the rpi (without waiting the 5 minutes of the wittyPi)

It is working nicely but I have two issues.

1. If I run the function "6. Choose Schedule Script" in wittyPi.sh on 13/03/2024 at 10:00:00 the next start will be planned on 14/03/2024 11:00:00. I wanted it to be planned on 13/03/2024 at 11:00:00.

And it is worse if I run the function after 11:00:00, the next start will be on 15/03/2024 at 11:00:00

I don't know how I need to change the schedule script so that my system can start the next time it is 11:00:00 and not the next day. Could you help me ?

2. My system is working on a battery connected to the XH2.54 connector. When I replace the battery or when I press the button it starts normally. But I think that it is kind of resetting the start for the next day, and not the current one. For exemple if I replace the battery on 13/03/2024 at 10:00:00 the next start will be on 14/03/2024 but I want it to be on 13/03/2024

Before when I was using witty Pi 3 it was more simple to do this kind of daily wake up using only this kind of parameter

?? 23:30
 
Posted : 13/03/2024 10:57 am
Topic Tags
(@admin)
Posts: 511
Member Admin
 

Please read page 18-19 of the user manual to understand how the schedule script works. What you dislike is the “shifting ON state” behavior, which is a trade-off the convience/intuition for supporting complex scenarios while make sure the consistency of schedule.

In your case, you are running the schedule script at a time that your Pi is surpose to be OFF, the schedule script engine doesn't know/can't be sure you will turn off your Pi before 11:00. It would not take the risk that you leave your Pi running and then after 11:00 the scheduled startup will simply be ignored. So it shifts the current state to the next ON state and do the schedule after that -  it makes sure there will be a scheduled shutdown before a scheduled startup.

A quick fix for your situation, is after choosing the schedule script, you manually set the next startup at 11:00 and then shutdown your Pi. At 11:00 it will wake up your Pi and next shutdown and startup will be properly scheduled.

If your own program will be shutting down the Pi, it is better to use the "WAIT" syntax in your schedule script, as suggested on page 21 in the user manual.

It is also possible to modify the firmware and let it support syntax like ?? 23:30, but you will aslo have to remove some functionalities because the MCU (ATtiny841) has only 8k programing space and the current firmware almost uses all of it.

 

 
Posted : 13/03/2024 11:30 am
(@basileploteau)
Posts: 3
Active Member
Topic starter
 

Hello,

Thank you very much for your answer, it works perfectly. However I have a use case where it doesn't work.

I choosed my schedule script and the I manually choose my next startup at 11:00 in the current day. Then I tested two scenarios :

1. I let the witty Pi wake up the raspberry. It works perfectly at 11:00:00 the current day.

2. I press the button of the witty Pi in order to take one picture for testing purpose. In this case the next startup won't be at 11:00:00 during the current day but the next coming day. Is there a way to solve this issue ?

Thank you very much in advance

 
Posted : 22/03/2024 12:10 pm
(@admin)
Posts: 511
Member Admin
 

@basileploteau After the schedule script is selected, everytime your Pi boots up, it will schedule the next shutdown/startup time. If you choose a different startup time (11:00 in the same day) after selecting the schedule script, you either do not wake up your Pi manually before 11:00, or you have to manually set next startup time to 11:00 again -- because the next startup time has been overwritten during this boot.

 
Posted : 03/04/2024 5:12 pm
(@basileploteau)
Posts: 3
Active Member
Topic starter
 

Thank you for your answers. It is much clearer now. I think I will have to install the legacy firmware in order to do what I want.

 
Posted : 03/04/2024 5:14 pm
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.