A few months ago I made the Raspberry Pi simple webcam that send to FTP server images (taken with the camera module), adding lettering and logos overlay.
Unlike the webcam that I put in my weather station , this does not require special software.
The configuration software is really simple: a 'standard installation Raspbian SD, with a script that takes over all the work (ie: take the picture, add the information above, send to FTP and write logs)
The script (found at the bottom) can be saved in your home directory and executed periodically using cron , for example every 5 minutes with a setting like this:
1
| * / 5 * * * * / home / pi / TakeAndUpload .sh |
That memory must be inserted by typing " crontab -e "in the terminal.
The only requirements for its operation of the script are as follows:
The only requirements for its operation of the script are as follows:
mkdir / home / pi / images
sudo apt-get install ftp imagemagick
sudo apt-get install ftp imagemagick
The configuration is present on top of the script (in the CONFIGURATION) and it's pretty self-explanatory.
For the use in question, the Raspberry has been inserted into a waterproof box aluminum (as those used for video surveillance) which is also heated by a heating element placed internally opposite to the glass.
This expedient in addition to solving the problem of snow and ice, also prevents fogging of the glass itself.
This expedient in addition to solving the problem of snow and ice, also prevents fogging of the glass itself.
The webcam is mounted in a very limit in terms of environmental, near the refuge " The Shack "Mount Falcon nell'Appenino Tosco-Romagnolo, at 1488 m ! And is working without problems for almost a year at this address: http://www.webcamcampigna.it/
#IMAGE SETTINGS
ARGS=
"-vf -hf -w 1024 -h 720 -q 50 -n -ex auto"
TEXT_TOPLEFT=
" Raspbery Pi Camera Script"
TEXT_TOPRIGHT=
"Date: ${dateTaken} "
TEXT_BOTTOMLEFT=
"http://grechi.it"
TEXT_BOTTOMRIGHT=
"(c) Alessandro Grechi "
LOGO_TOPRIGHT=
"/home/pi/images/logo.png"
#FTP SETTINGS
HOST=
"ftp.website.it"
USER=
"user"
PASS=
"password"
DIR=
"webcam"
#DATE AND LOG
dateTaken=$(
date
"+%d/%m/%Y - %H:%M"
)
now=$(
date
"+%H%M"
)
today=$(
date
"+%d%m%Y"
)
logfile=
"/home/pi/images/webcam_$today.log"
###############################################
############## END CONFIGURATION #################
###############################################
cd
/home/pi/images
echo
"###################################"
>> $logfile
echo
"starting script $dateTaken"
>> $logfile
echo
"Taking a Pictue"
>> $logfile
/opt/vc/bin/raspistill
$ARGS -o
/home/pi/images/image
.jpg >> $logfile
echo
"Convert and add overlays"
>> $logfile
/usr/bin/convert
/home/pi/images/image
.jpg \
-gravity NorthWest -background Blue -splice 0x18 -pointsize 15 -fill yellow -annotate 0
'${TEXT_TOPLEFT}'
\
-gravity NorthEast -fill yellow -annotate +0+0
'${TEXT_TOPRIGHT}'
\
-gravity SouthWest -background Blue -splice 0x18 -pointsize 12 -fill yellow -annotate 0
'${TEXT_BOTTOMLEFT}'
\
-gravity SouthEast -fill yellow -annotate +0+0
'${TEXT_BOTTOMRIGHT}'
\
-gravity NorthEast $LOGO_TOPRIGHT -geometry +5+19 -composite \
/home/pi/images/image_
$now.jpg >> $logfile 2>&1
cputemp=$(
/opt/vc/bin/vcgencmd
measure_temp)
myip=$(curl --connect-timeout 30 http:
//ifconfig
.me
/ip
)
uptime=$(uptime)
echo
"LastUpdate: $dateTaken | CPU $cputemp | IP: $myip | uptime: $uptime"
>
/home/pi/images/status
.txt
echo
"Upload image_$now.jpg to FTP"
>> $logfile
# Start the FTP client
ftp
-inv $HOST << EOF >> $logfile
user $USER $PASS
cd
$DIR
put image_$now.jpg
put status.txt
bye
EOF
echo
"Remove image_$now.jpg"
>> $logfile
rm
-f
/home/pi/images/image_
$now.jpg
echo
"Ok"
Post a Comment