To be able to control the start and shutdown of the future device, I decided to use an ATtiny85.
The microcontroller is connected to the battery via the PWR button. When the PWR button is pressed, the ATtiny85 is powered and it starts.
The code of the ATtiny is very simple. Once started, it waits for about 2 seconds and then turns the PWR_CTRL pin HIGH which activates the voltage converter U2 and powers the ATtiny. The loop is closed, the PWR button can be released, the ATtiny remains on.
Then, the code sets the PWR_SYS pin HIGH, which will turn on the whole system and thus the Raspberry.
Once the boot sequence is over, the code scans the use of the same PWR button, using the BTN_OFF pin, and the state of the POWEROFF pin. When BTN_OFF goes LOW for about 1.5 sec, the SHUTDOWN pin is switched to HIGH which orders the Raspberry to poweroff (overlay shutdown).
Once the Rasbpberry shutdown sequence is completed, the Raspberry switches the POWEROFF pin to the high state and the ATtiny shuts down the whole system by cutting the PWR_SYS and PWR_CTRL pins (the latter has the effect of shutting down the ATtiny itself).
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.