Set up a dogcam with Tailscale, Raspberry Pi, and Motion
Tailscale makes it easy to setup a dogcam that you can securely access from anywhere.
Unlike an off-the-shelf dogcam, with Tailscale you don't need to trust a third-party service, or risk exposing a camera inside your home to the public internet. Every connection on Tailscale is encrypted and entirely private to your network.
Prerequisites
Before you begin this guide, you'll need two things:
- A Raspberry Pi with Wi-Fi/Ethernet capabilities (for example, Raspberry Pi 3 B+)
- A USB webcam (for example, Logitech C615)
This guide assumes your Raspberry Pi is already set up with an internet connection, whether Wi-Fi or Ethernet.
You'll also need a Tailscale account. You don't need to pay for Tailscale—this is possible on the Personal plan!
Step 1: Install Tailscale on your Raspberry Pi
SSH into the Raspberry Pi, and install Tailscale with a single command:
curl -fsSL https://tailscale.com/install.sh | sh
Alternatively, we provide manual installation instructions for Raspberry Pi.
Once it is installed, and you've run tailscale up
on your Raspberry Pi, continue to the next step.
Step 2: Install motion
Next, install motion using apt with this command
sudo apt install motion
Step 3: Configure motion
First, we'll enable motion to run as a background service. Edit /etc/default/motion
using nano
or your favorite editor:
sudo nano /etc/default/motion
We'll change the start_motion_daemon setting to "yes":
start_motion_daemon=yes
Save and close the file.
Next, we'll configure motion to expose a web page, and modify a few video capture settings too.
Open up /etc/motion/motion.conf
with your editor
sudo nano /etc/motion/motion.conf
Search for the following settings, updating their values to ones listed below.
Enable viewing video streams over the web. You can also change the port from the default value (8081) if you'd like.
stream_port 8081
stream_localhost off
Disable saving images or video to the SD card. Since this is a dogcam, we only care about looking at live footage.
output_pictures off
ffmpeg_output_movies off
Save and close the file.
Step 4: Restart motion
Once all your configuration settings have been updated, restart motion
sudo service motion restart
Step 5: View your dogcam
From any device in your Tailscale network, you can now view the live webcam stream from <raspberry pi tailscale ip>:8081
. Find your Raspberry Pi's IP and type it into your browser.
You should see a feed from your webcam, that will look something like this.
Success! You now have a functioning dogcam, secured with Tailscale. This can only be accessed by devices on your personal Tailscale network, and no one else.
Your browser may show an "insecure" warning, since your connection isn't over HTTPS. Tailscale secures your connection at a lower level, so rest easy knowing you are securely connected to any website at 100.x.y.z IP address.
Next steps
Install Tailscale onto your Android or iOS device to check in on your dogs (or other pets) wherever you may be.
You may also want to experiment with other settings such as width
, height
, or framerate
. If you make other changes, be sure to restart motion with sudo service motion restart
afterwards.