Ok, there are several months since “productively” using the Surveillance WebCam with Raspberry PI; There are some improvements / changes I did that I’d like to share with you.
1. One very important aspect is that I moved the PI outdoors, next to the webCam. I therefore no longer need the Extension Cable USB over CAT5/6 mentioned in my initial post. And the CAT5/6 I already had in place (for the extension) is now used as … guess what … LAN Cable for the Outdoor PI
Btw, the PI is placed in a “keep fresh box” (some examples at Google Images)
2. After switching from the USB 1.1 extension cable to the direct USB 2.0 connection between WebCam and PI, the PI started to cough, probably due to too much information going over USB and LAN more or less simultaneously. This made the PI lose the NET at most every 48 hours. The solution for me was the one mentioned here, that is to set:
vm.min_free_kbytes = 16384
3. As the webCam to PI connection is now USB 2.0 I was able to set
in the configuration file “capt”. (see details on this file in my original post)
I thus replaced “palette MJPEG” I used to have there. YUYV seems to be “nicer” with computer’s ressources.
4. Just to make sure I catch all the NET freezes (which btw, no longer appears after performing step 2 and 3 above :)) I implemented a mechanism to restart the PI once the net is down.
License: Please notice the license governing the source code below in the “License & About” page.
It is made up of:
#!/bin/bash ( ! ping -c1 _my_router's_IP_ >/dev/null 2>&1 ) && /home/pi/dev/starter/autorestart.sh >/dev/null 2>&1
This runs as cron job every 5 minutes.
#!/bin/bash displayTime=$(date +"%Y%m%d_%H%M%S") echo $displayTime" Restart needed as network is down" > /home/pi/dev/starter/restart.msg sudo shutdown -r now
that runs after reboot (cron job)
#!/bin/bash if [ -e "/home/pi/dev/starter/restart.msg" ]; then tmpMail="/var/tmp/mailtxt2.txt" echo "To: firstname.lastname@example.org" > $tmpMail echo "From: email@example.com" >> $tmpMail echo "Subject: PI - Restart was needed" >> $tmpMail echo "" >> $tmpMail cat /home/pi/dev/starter/restart.msg >> $tmpMail /usr/sbin/ssmtp "firstname.lastname@example.org" < $tmpMail rm $tmpMail fi rm /home/pi/dev/starter/restart.msg
The nice colorful code above was again obtained using: CodeHTMLer. And for details on how to enable ssmtp on a PI via a gmail account, check my original post.
5. Stay tuned for a new atempt to find a solution: My PI freezes every about 20 days, but it does it for good. That is, no script runs anymore, nor I can ssh over to it. I’m working to find a solution to it, although testing it might be quite expensive (i.e. wait 20 days to see if it still works).