I use my Raspbery PI model B for capturing images for a timelapse. I capture an image every 30 seconds (roughly) using the build in raspistill
command within a simple bash script seen below:
#!/bin/bash
imagePath="/home/pi/weatherPi-images/"
echo "Press [CTRL+C] to stop.."
echo "AutoImage process started @ "`date +"%FT%H_%M_%S"`
while :
do
timestamp=`date +"%FT%H_%M_%S"`
imageName=$imagePath$timestamp".jpg"
echo "Taking picture $imageName"
raspistill -o $imageName -e jpg
sleep 30
done
Regardless of what I do after sometimes a few hours or this time after four days of straight image capturing (7600+ images) the Pi freezes / the camera LED stays red and the pi is not responding anymore. There is no recurring time interval between these crashes.
The only way to fix this is by cutting the power input from the Pi and restarting it.
After some research most people told that the cause for such a behaviour is a low power- / quality PSU. But in my case the PSU is no problem. It is a 5V/5A/25W power supply which is directly connected to the mains power (which is stable over the year / no blackouts) and has a big power overhead for such a use case. The output voltage is set to ~ 5.1V (±0.05V) so even if the Raspberry Pi draws a lot of power, the voltage is never dropping below 5V.
Right before the Raspberry Pi crashed this time I got this in the :
kern.log
(click to see more)
It seems that the raspistill script which is written in Python is hanging / filling up all memory.
What can I do to avoid such crashes? If my Pi stays as unreliable for image capturing as it is right now I cannot use it for a long term timelapse (1+ years).
One more thing to mention is that if the outside temperature is higher, the more likely the Pi crashes. The Pi is mounted outside and the temperatures here were lower than 0°C / 32°F for the last Week, today the temperatures were above freezing point again.
The Pi's case temperature has been at around 10°C (50°F)for the past week and because of the higher outside temperatures was going up to 15-18°C (59-64.4°F)today
My Raspberry Pi is overclocked with raspi-config
to 1 GHz, this was never an issue as the CPU has a heatsink on it and is always below 40°C (104°F). The Pi had an uptime of 35 days before the crash.
System information:
lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie
uname -a
Linux horizon 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux
lsusb
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. LAN9500 Ethernet 10/100 Adapter / SMSC9512/9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
EDIT:
raspistill
is written in C. This makes the crash even more strange to me.
EDIT2:
Some more research brought me to this article. Testing the suggested fixes now, for a long timespan (7+ days).
ps -A | grep py
.