My DIY Webcam

Last weekend I decided to add a webcam to my vacation house. I went to Best Buy thinking this would be an easy and inexpensive project, and found myself looking in the security camera section at prices that ranged from $170 (single Arlo camera) to $499 (four node Lorex system). While these seemed like great products, they were overkill for remotely viewing the cool water views, and so I set myself a personal goal: setup a remote webcam system for less than $50.

Step 1: Buy the Camera

I started my camera search where all budget-driven shopping journeys begin: on Amazon.com. I had a few basic requirements: (1) wireless, (2) 1080p, (3) controlled via an iPhone app, (4) cheap, and (5) night vision. After reviewing numerous products and reviews, I settled on the $39.99 Wansview 1080p. I Amazon Primed the camera (yes it’s a verb) and it arrived two days later. The overall camera seemed of reasonable construction, provided good picture quality, and had an acceptable app and web interface. I probably shouldn’t oversell this camera though since it clearly was manufactured to a price point. One look at the manual will tell you the target consumer was me: a DIYer on a budget.

Step 2: Setup a DMZ

I would recommend setting up a separate isolated network for any webcams, but let’s just say my $40 Chinese manufactured camera did not exactly exude security. My house is wireless enabled via a three node Google Wifi system, which provides full mesh wireless across the house and yard. If you have not looked at Google Wifi, you should. It is hands down the best Google product I have purchased, with an Apple-like attention to detail on everything from the router to the mobile application. One of the delights of Google Wifi is its mobile app, which lets you monitor and manage your network from your phone anywhere in the world. With a few touches of my phone I had a guest wireless network setup for my camera.

Step 3: Setup the Camera

I decided on the location of the first camera, plugged it into a power outlet, installed the Wansview iPhone app, took a picture of the QR code on the camera to pair it with the app, and then added the credentials for the wireless network to the camera. With the exception of being surprised the wireless credentials were passed from the phone to the camera via audible sounds like an old school modem, the setup went smoothly. Within minutes I was looking through my iPhone app at a 1080p picture of my house.

Step 4: Enable Remote Access

It’s great that I can view my camera from my phone, but I also wanted to remote into the camera to make periodic configurations (note: the smartphone app allows limited configuration changes), and to provide a URL anyone else in my family for viewing the live video feed. Since my connection to the internet was through a cable provider, I knew I couldn’t rely on its dynamic IP address to access my camera remotely. My planned solution was a play I’d run many times in the past: purchase a domain, use DynDNS’s free dynamic DNS service to keep my domain pointed at the right IP, and then poke a hole in my firewall to provide remote access to the remote device. After spending $5 on the least expensive domain I could purchase, I was ready for my dynamic DNS. Unfortunately my budget was immediately stressed by two hard realities: (1) DynDNS had discontinued its free dynamic DNS service, and (2) I didn’t have a dedicated computer at the house that could run a script to update the IP address anyway. Uh oh. To make matters worse I was already at $45 of a $50 budget.

The first part of the solution was the easiest: I hosted my domain in the cloud on AWS Route 53. I setup up a Hosted Zone, pointed my domain at it, and then manually added the current IP address of my internet connection. To make this work consistently though, I needed a device that could automatically update the A record with my latest IP address continuously - and I needed to do this for less than $5. ;)

A little rummaging around the house provided the answer: an old Raspberry Pi 2 device sitting on the shelf with a micro SD card and a wireless USB stick. I flashed a new version of Raspian on the device, downloaded the AWS CLI, connected it to the guest wireless, and then wrote a small script that would fetch the current public IP address for my home internet and update it to my Route 53 Hosted Zone. I setup a standalone AWS IAM user with least privilege permissions in order to ensure my AWS account was safe from Raspberry Pi hackers, and then added the script to cron to have it run continuously. Voilà: I had myself an almost free solution to dynamic DNS.

Step 5: Test It Remotely

At this point it was time to test my webcam remotely. With a few touches on the Google Wifi app, I opened a port to allow the outside world to reach my webcam, and tested to ensure both Wansview iPhone app and my web browser could access my camera remotely. Success. I was immediately shown a clear and crisp picture of the cove near the house.

Last Words

Wansview packed their little budget camera with all sorts of bells and whistles, most of which seemed to work if you are willing to spend a little time tinkering with them. For example, I configured my camera to send an email every time there is activity in the view of the camera. Within a few minutes of waving my hand in front of the camera, an email arrived in my inbox with a picture of me in front of the camera.

I’ll need a couple months to know for sure how much my Route 53 charges will be, but based on early projections this, DIY project is coming in at $45 for the initial one camera setup, $40 for every camera thereafter, and about $1 in recurring charges for DNS hosting. Not bad for a weekend e-DIY project.