Simple boot/restart monitor for the Raspberry Pi Zero W implemented through Attiny85 or Attiny88 Arduino device
Requirements:
- Arduino device (tested with an ATTINY88 Arduino device)
- SH1106 OLED display (not strictly required: comment out
#define USE_SH1106 1
if the display is not used. - Raspberry Pi Zero W
Notice that other Raspberry devices might have a different LED ACT behaviour.
This sketch should also work with ATTINY85, Digispark, or any other Arduino device.
Also supporting the PINN rescue mode.
Installation:
- solder a wire to the LED ACT pin of the Raspberry Pi (ref. A in the image) and connect it to the LED_ACT_PIN of the Attiny device.
- connect the RESET_PIN of the Attiny device to the pin "RUN" of the Raspberry Pi (ref. B in the image)
- connect a SH1106 OLED device to the SDA and SCL pins of the Attiny device; notice that this display device is safe to be also connected to the Raspberry Pi
- load the sketch to the Attiny device
- power on the Attiny, the Raspberry Pi and the SH1106 display.
The ACT led of the Raspberry Pi should blink in normal operation and this sketch exploits it as a sort of watchdog.
If the ACT led remains constantly switched off (shutdown) or on (crash) for more than two minutes, the Attiny device will reboot the Raspberry Pi.
If connecting the SH1106 OLED display to the Raspberry, after the boot the Raspberry can clear the screen (or use the display for other things).
Notice that when the Raspberry device is in PINN rescue mode, where the ACT led does not look to blink, luckily the device does not reboot (it appears that the rescue shell embedded in the PINN software keeps the ACT led very quickly blinking). Anyway, after echo 1 >/sys/class/leds/led0/brightness
(or echo 0 >/sys/class/leds/led0/brightness
) the Raspberry device reboots in two minutes.
The internal led of the Arduino device is used to monitor the watchdog feature; comment out #define USE_INTERNAL_LED 1
if the usage of the internal led is not wanted.
- https://github.com/notisrac/SH1106Lib (No buffer SH1106 OLED display driver)
- https://playground.arduino.cc/Main/SoftwareI2CLibrary/ (required library of SH1106Lib - I2C Master)
- https://github.com/notisrac/TinyPrint (required library of SH1106Lib)