0

A few week ago, I completed my first project: I have installed a raspberry pi zero W as a doorbell chime and it works relatively well. I’m not an expert on this kind of things, but I have just enough knowledge to make it works. Almost. The Raspberry Pi turn itself off automatically every 5 days or so. I don’t really understand why.

It’s probably some kind of power, heat or memory issue, but I’m not quite sure how to know for sure (or how to fix it). Is there any log on the rpi that might help see why it turned off?

If you have any ideas that might help me, it would be greatly appreciated.

///

Here are some details on my setup :

I currently use a Pi Zero WH (presoldered header) as a “dev” device (but I plan to solder some wires directly to a “normal” Pi W later).

The Pi run “headless” with the latest Raspbian Stretch “lite” on a 4 GB class 10 micro SD card.

I use a few jumper cables connecting the doorbell button to the pins 36/GPIO16 and Ground (6) (through a breadbox). A Python script detect button presses and play an audio files (WAIT_FOR_EDGE).

I also installed a small pushbutton on the breadboard connecting the pin 5/GPIO03 and Ground (6) to turn on the RPi when it is off. A python script also detect when it is pressed while the RPi is on to halt it, How to add a power button to your Raspberry Pi.

I plugged a USB speaker from Adafruit on the RPi. The volume is never over 50%, Mini External USB Stereo Speaker.

I use a sparkfun 5.1 V DC 2.5A wall adaptor power supply recommended by my local seller, Wall Adapter Power Supply - 5.1V DC 2.5A (USB Micro-B)

I also run homebridge with two homebridge plugins for my chime to be available on my iOS devices via HomeKit.

///

If I don’t find a better solution, i will probably program a reboot every night to mitigate the issue, but that does not seem like a “clean” solution. I’d like to fix the issue if possible.

2

You will probably need to instrument your code to find the root problem. By that I mean you will have to regularly log details to the SD card.

I would start by logging the following every 5 minutes.

  1. CPU temperature
  2. memory usage

I would also log every time the button is pressed to switch the Pi on/off.

I would guess that you are getting a false button press which is what is switching the Pi off.

  • Good call. I’ll add these logs over the weekend. I don’t think it’s a false positive on the power off button since it seem to be pretty regular (every 5 days) - false button presses would be more random (i think). But i log it anyway, it is still a possibility. Thanks ! – Maxime Priv Jul 6 '18 at 13:17
1

Can you remove the pushbutton which triggers the power off and see if that solves the problem.

The logs that might help find the source of the problem can be found in /var/log/syslog. I would suggest you to start looking in and if you know the exact time of one of the shutdowns, you can try to look for that time in the syslog to see if there is any suspicious entry there.

See this for information on rebooting the pi periodically.

  • I’ll take a look at those files but I don’t know exactly when it turn off, i just know the day. I’ll add logs every few minutes (as suggested by Joan) so I’ll know more precisely when It stopped. Thanks for your suggestion. – Maxime Priv Jul 6 '18 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.