A friend of mine recently had a break in at his cabin up north. He wanted to know if I had any recommendations on technology that could let him keep an eye on things from far away. The only challenge is his cabin is relatively remote, and cell service or internet isn’t available in the area. With that in mind, I wanted to design a solution that would keep an eye on things using a Raspberry Pi, a bit of edge computing, and a satellite connection.
For this project I’m using the Swarm satellite constellation; it’s a low cost solution for providing satellite connectivity for internet-of-things devices in remote locations. Where one solution would be to livestream images from a camera using a high-bandwidth connection for off-site processing, this project does on-site processing (edge computing) instead sending only the results, letting us keep this project running for a long time at the low cost of $5 a month. Here’s how to build a remote cabin monitoring and alerting system with a Raspberry Pi, a camera, and the Swarm Eval Kit.
What You’ll Need For This Project
- Raspberry Pi 4 or Raspberry Pi 3 with power adapter
- 8 GB (or larger) microSD card
- Raspberry Pi Camera
- Swarm Eval Kit & Data Plan
- An internet connection for the initial setup
How To Build A Remote Cabin Monitoring System with a Raspberry Pi
Before you get started, get your Raspberry Pi set up. If you haven’t done this before, see our article on how to set up a Raspberry Pi for the first time or how to do a headless Raspberry Pi install (without the keyboard and screen). For this project, we recommend a headless Raspberry Pi install.
1. Install git. We’ll need it to download the code from GitHub.
sudo apt-get update sudo apt-get -y install git
2. Clone the repository to your home directory. This will download all the necessary source code for person detection and communicating with the Swarm tile.
cd ~/ git clone https://github.com/rydercalmdown/remote_cabin_monitor.git
3. Run the “make install” command to install all project dependencies. This script will take care of installing lower level dependencies, as well as the Python libraries you need for the project to run. The machine learning library we’re using to detect people is packaged within one of the Python libraries, so it may take a few minutes to install.
cd ~/remote_cabin_monitor/ make install
4. Connect your Raspberry Pi Camera to the Raspberry Pi and mount it in the desired location.
5. Test your Raspberry Pi Camera by taking a snapshot with the following command.
raspistill -o test.jpeg
6. Assemble and register your Swarm Eval Kit using the instructions in the quickstart guide. This will get it connected to the network for transmitting data.
7. Turn on your Swarm Eval Kit system with the button on the side.
8. Set your Raspberry Pi Wi-Fi to the Swarm Evaluation Kit SSID. This will need to be done directly on the pi with an external monitor and keyboard. Any SSH connections to the pi will be dropped when the pi switches to the Swarm SSID.
The easiest way to do this is by using raspi-config (sudo raspi-config), navigating to System Options->WIreless LAN and then entering the Swarm Eval Kit’s SSID (you’ll have to find this on another device where it will be swarm-xxxx) and entering a default password of 12345678.
9. Run the application to test it. If the Raspberry Pi is connected to the Swarm Kit successfully, it will send a startup email over the network. Depending on your satellite availability it can take some time to arrive in your inbox; use this pass checker to determine when a satellite will be overhead.
cd ~/remote_cabin_monitor make run
10. Configure the application to run on boot by adding a line to the /etc/rc.local file.
sudo nano /etc/rc.local # Add the following line before the last line . /home/pi/remote_cabin_monitor/env/bin/activate && export EMAIL_FROMfirstname.lastname@example.org && export EMAIL_TOemail@example.com && /home/pi/remote_cabin_monitor/env/bin/python /home/pi/remote_cabin_monitor/src/app.py &
11. Place the Swarm Eval Kit in view of the sky, and mount the Raspberry Pi and camera in your desired location.
When running, the Raspberry Pi will continuously pull images from the camera and check them for the presence of a person. If a person is detected, the Pi will send a message to the Swarm Eval Kit, which will then communicate with a constellation of satellites via VHF. The satellites will relay the message to a downlink, and you’ll then receive an email indicating a person has been detected. The Pi will also send an email every 24 hours that no people have been detected in order to let you know it’s still working.
This type of system can also be modified to send more than just person-detection data. Leak detection, fire detection, and any kind of sensor that can communicate with a Raspberry Pi are all possible to send over the network.