Turning one of my old Android phones into a webcam is something I've been thinking about doing for a long time now. A couple of years ago, I backed a 3D printer project on Kickstarter (RigidBot, if you're interested). It took a long time to finally get the thing, and it's frequently glitchy and buggy. I'd like to be able to keep an eye on it when I'm out of the room or at work. Besides just wanting to monitor progress as it prints, I've read a couple of horror stories about 3D printers glitching out and causing house fires. With how many times this thing has freaked out and frozen in place with the heat still on, that's got me pretty worried--especially when I'm at work.
At first I looked into the Nest wifi smoke detector and drop cam, but that's a pretty pricey option. I decided to go this route as it will allow me to keep an eye on things without straining my wallet too much, with is stretched pretty thin these days.
It's pretty straightforward and simple process, and well worth it. I've even shared the password with some friends so if they're interested in this sort of thing they can check up on my progress . . . and if they're really lucky they just might catch me swearing and trying to fix the latest problem that's cropped up with my RigidBot.
Step 1: Gather Materials
It's a pretty simple list this time, all that's actually required is an old (but still functional) Android phone, cable, charger and wifi. I'm using a Droid Razr Maxx that works just fine, except the charging port has broken loose. More on that later.
In addition, depending on your phone and application, you might want to get your hands on some sort of mount. I'm using mine as a monitor for my printer so I simply found a couple of models on thingiverse already designed for my phone and printer, printed them out, cobbled them together and was ready to install.
Depending on your phone, for tools you may need a soldering iron, bench top power supply, hot glue gun, and a set of teeny tiny screw drivers. I was recently provided this soldering station from thediyoutlet.com, and this project was it's maiden voyage. Worked like a charm, more about it in the next step.
Step 2: Prep Your Phone
An android phone may fall out of use for a variety of reasons. Maybe you just upgraded to the latest and greatest model, and held on to your old one. Maybe it stopped working properly in some way, but wasn't totally ruined so you felt bad throwing it out. Maybe like me, you're a pack rat and horde all sorts of shiny, semi-working technology . . . you know, just in case.
I'm a buy it used and avoid long term contracts kind of guy--I'm on pageplus and get my 4G from a router from Ting, which is a kludge of a way to do your phone service, but it keeps me out of expensive contracts that I have to stick with for years and years. One of the downsides, however, is a total lack of warranty. So, when my fancy Razr Maxx stopped charging about a year ago (hey, so I'm three generations behind the times, sue me), I simply had to set it aside and buy a new phone (S3, hurray!). The Razr still worked fine, I just had to drill a hole in it and extend a battery wire out so I could attach some alligator clips to those and attach that to a USB charger. Not an elegant solution, but it worked out okay until I replaced it!
So if you're lucky and your phone is just old but still working, all you'll need to do here is plug it in near the location you want the webcam. For me, I had to open the case and modify some things.
Here's where that soldering station from thediyoutlet came in. I have no reservations whatsover recommending this tool, some of you may have seen my old soldering station instructable, but this is waaaaaay better than that mess. It served me well for many years, but this is a definite upgrade. This one has a soldering iron, hot air gun, and a variable power supply, all of which I ended up using for this project.
My first thought was to try and repair the actual USB charging port. The heat gun that comes as part of the station worked great to loosen the solder on the port, allowing me to remove it. I then tried to wire the end of a USB cable directly to the circuit board. The soldering iron worked great and had a really pointy nib for use on SMD circuit boards, but my hands just aren't steady enough for that delicate of work, I guess. I made a mess of things and had to start over.
I realized there's no real need for a USB connection! I decided to make the direct battery connection permanent (and less messy). I took that same USB cable, stripped the positive and negative wires (usually red and black, but in this case gray and black--green and white are data, so you don't need those here). I decided to remove the battery completely since the phone would be permanently powered, and lighter without it. Before I attached the USB wires to the power inputs, I attached the phone to the benchtop power supply and made sure it was working fine without the battery. No problems! I screwed the wires in place, and added a dollop of solder to each for good measure.
Finally, using a dremel I carved the hole at the bottom of the phone's casing a bit deeper, to fit the fatter USB wire. Sticking it in place with hot glue, I then tested everything on a USB wall charger before using epoxy to keep the USB cable in place at the bottom of the phone, reassembled it, and was ready to go!
Step 3: Get the App
There are several webcam apps available in the google play store, but I went with IP Webcam. They've got a free version which I used to set everything up and make sure it works. I ended up kicking in the $4 for the full version to get rid of the ads and the watermark on the video feed. Totally worth it to support the work of the designer!
When you first load the app, you'll see the settings screen. There are lots of ways to customize this app for your purposes, but the important ones are these:
Login/password: If, like me, you're going to stream this over the internet, you'll probably want to make a login and password.
Stream on device boot: Just in case your phone decides it's time to reboot, this will turn the webcam back on afterwards.
Start server: Click the last entry on the list, and the video will start streaming!
Just a side note-- I didn't need any of these options for my own setup, but you can set up this app to act as a security camera. It can record video loops, be motion, light, or sound activated, take a picture at certain intervals, etc.
Look at the bottom of the screen, and you'll see an IP address. In my case, it's 10.0.0.21:8080 . If all you want is to be able to keep an eye on something from another room in the house, you're done! Mission accomplished!
However, if you want to be able to check on things while you're away, there's more to do--it's a little techy, but even an amateur shouldn't have too much trouble. Write down that IP address and head over to your desktop PC.
Step 4: Give Your Phone a Permanent IP Address
Logging into a wifi router and messing with its setting can be a daunting task for someone who's never done it before, but it's not that difficult--most likely you'll be able to find a manual either in your stuff or available online.
The first step is finding it's local IP address. My phone's webcam address was "10.0.0.21:8080", which means that it's port 8080 at that IP address. In MOST cases, you'll find that your wifi router is located at X.X.X.1, or in my case "10.0.0.1". Simply type that into your browser's address bar, and you'll very likely find yourself at the login page for your router! If not, you'll probably find it printed on the bottom of the router or somewhere in the manual.
If you've never logged in, the router's password and login are probably still set to their default values (find this again on the bottom of your router or in the manual). I like to write that info down on a piece of masking tape and stick that to the bottom of my router, just so there's no confusion, since I don't have to log in more than once in a great while.
****Update 12/18/14:AtlantaTerry points out that leaving your router set to the default login/password is a big security hole. If you find it is, now it a great time to change the login and password, then write that down on a piece of masking tape and stick it to the bottom of your router.
Once you're logged in, you need to find your phone and give it a static (unchanging) IP address. Standard router procedure is to issue temporary IP addresses that change every week or so, but you want your webcam to keep the same IP address at all times. You may have to poke around a bit in the management screen or in your manual to find out how to do this, but in mine I found it simply under "Connected devices", where I was able to hit edit, change it from DHCP to Reserved IP, enter my IP address, and hit save.
Step 5: Make Your Webcam Available Online
Now that the local IP address is locked down, you need to make that available over the internet. Basically, your router acts as a gateway between your local network and the outside world, and the IP addresses on each side of that gate are different. So, you need to tell your router to forward an outside address to the IP address and port of your webcam. Sounds complex, but it's not all that bad.
On my router, I found it under "Advanced" and "Port Forwarding". Most routers will have it similarly filed away. You'll want to add a port to forward, in my case it's 10.0.0.21, port 8080. You'll probably also have to turn on port forwarding, as it's usually set to off by default. Now point your browser to google, type "What's my ip address" into the search bar, and see what it says. You'll get a string of numbers back. To access your webcam, simply type that string of numbers into a browser with :8080 at the end (xxx.xxx.xxx.xxx:8080). You may need to check from a different network or over a working phone's data connection as there is a bug in some routers' firmware that doesn't always allow you to connect back to the same IP address over the internet. If all has gone well, you've got a working webcam!
Here's an example of my webcam watching my 3D printer print. I'm not sure why the video is such low quality, as the stream is waaaaay better than this. There's probably a setting I missed somewhere, had it turned to low quality or something.
Step 6: Monitoring a 3D Printer
This won't apply to everyone, but I thought I'd include this step about my personal use of the webcam. As I mentioned, I wanted to be able to keep an eye on things while it's running but I'm away from the house. So, I printed a swing arm, mounting bracket, and a phone case for the phone. Everything is assembled and attached to the frame of the printer.
The last thing I did was install a smoke detector on the ceiling above the printer. This way I can have my stream up and running in the background at work, and if the smoke alarm goes off I'll be able to hear it!
Step 7: Final Thoughts
This was a fun project and the result was great, but I kept having setbacks! My stupid printer broke down twice while I was making parts for this, something went wrong with the phone and it refused to turn on for a while, etc. It was frustrating, but the result is awesome and totally worth it.
If you set up your own webcam using my instructable, post a picture in the comments and I'll send you a digital patch and 3 month pro membership!
Please take a minute to favorite, comment, and follow me! This project gave me an idea for an even bigger and better project along the same lines, so hopefully I'll be able to finish that soon and post it here. If you have any comments or need a little help figuring things out let me know and I'll do my best to set you straight!
***Update 12/28/14 - Instructables user Menneset posted this link to his own thingiverse design, using the instructions here to monitor his Da Vinci 3D printer with his Droid Bionic!