My boat is laying at a mooring, and I live 45min away. I do not go out to check it on a daily basis. I want to get an e-mail from the boat on a fixed time, morning and evening, to see that everythoin is OK.
A Raspberry Pi, with a web cam attached, connected to the internet with a mobile 4G modem, programmed to take a picture and sending the picture as an e-mail.
- A Raspberry Pi 3 Model B+, with Rasbian installed.
- A supercheap web cam from eBay.
- A mobile 4G modem with a SIM card.
- A powersource, I made a powersupply from scratch, connected to a 12v car battery.
The script for sending the e-mail
You'll find the script in this link
The script for taking the picture
To take the picture, you'll need the program fswebcam. Use:
sudo apt-get install fswebcam
to install it. Then write a bash script to use fswebcam to take a picture, like this:
#/bin/bash fswebcam -r 640x480 image1.jpg
Save it as takepiture.sh
Then make a script that use both the scripts:
#/bin/bash echo "Take picture" ./takepicture.sh echo "Send e-mail" python sendemail.py
Save it as takepicturesendemail.sh
You must change the attributes on the two *.sh-scripts, to make them executable. I use the command:
chmod +777 *sh
Now this needs to be automated. For that I'm using crontab. To open crontab for editing:
Then insert the intervals you want take the picture and send the e-mail. This is my crontab-file:
#m h dom mon dow command */5 * * * * /home/pi/./takepicsendmail.sh