How to set up a dogcam with Tailscale, a 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.
Before you begin this guide, you’ll need two things:
- A Raspberry Pi with Wi-Fi/Ethernet capabilities (e.g. Raspberry Pi 3 B+)
- A USB webcam (e.g. 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 can make a free solo account using a @gmail.com address.
Step 1: Install Tailscale on your Raspberry Pi
You can find instructions at the link below.
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
nano or your favourite editor:
sudo nano /etc/default/motion
We’ll change the start_motion_daemon setting to “yes”:
Save and close the file.
Next, we’ll configure motion to expose a web page, and modify a few video capture settings too.
/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
<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.
You may also want experiment with other settings such as
framerate. If you make other changes, be sure to restart motion
sudo service motion restart afterwards.