Introduction: Remote Pan/tilt Webcam
This was a fun and simple project I made to remotely view the webcam in my living room and be able to move it around. I decided to make it, unfortunately, because I had roommates that I didn't trust.
Necessity is the mother of invention, I guess. At any rate it was fun to put together and troubleshoot. I hope you enjoy!
Step 1: Supplies!
This is a pretty complete list of everything I bought in order to make this.
YAWCAM - Great, free, webcam software that is set up to stream your webcam. It has a lot of excellent features. Even if you don't plan on making this project I suggest you check out this software anyway.
Arduino IDE - So you can program your Arduino. I made mine with an Uno R3. I'm not sure about compatibility with other boards.
Pan and Tilt Servo Mount and servos - This is a great buy because it comes with the mount and servos!
Breadboard, breadboard power supply, jumper wires - You need a separate power supply for the servos because the arduino does not have enough power for everything.
2x DC 9V 1A Power Supply Adapter - So get 2 of these, one for the arduino and one for the breadboard power supply to run the servos.
Arduino Uno R3 - I used an Uno R3 but I'm sure other arduino boards would work too.
Arduino Ethernet Shield - for communicating over the interwebs!
Step 2: Bringing It All Together!
I'll just go over this as a high level overview and not get into too much detail because the set up can be however you want it to be and also if you follow the code it has the pins that I used for everything marked out but you may want to change things.
One of the important things that I didn't figure out at first and it frustrated me for a while was grounding to the arduino. I thought the power strictly came from the external power only but then once I started looking at the schematic it made sense that we are sending to the servo (the signal), so we need to get something back for it to work.
The second important thing is to power the servos separately. The arduino does have 5v out but it's not enough to run 2 servos and the arduino at the same time. Things get funky when you do this. Use the breadboard power supply to power the servos independently. But don't forget to ground to the arduino too,
The arduino code is based on my network settings. From within my network I access my router by going to 192.168.1.1 Yours may be different and you will need to change the code to reflect that.
Also you will need to port forward, everything. The YAWCAM software should be able to handle this on it's own but if it doesn't there is plenty of documentation on how to port forward it. You will also need to port forward the Arduino. This may be the biggest challenge of setting this up but once you figure it out you'll want to port forward everything, I have! I have read that sometimes certain ISP's will block port forwarding so you will need to check that out. Just dig around on google and you'll find the info you need.
What you'll want to do is tweak the arduino code to suit your preferences for webpage design. Basically the arduino is serving you a webpage and that webpage will be inserted into the YAWCAM streaming page via inline frame. The arduino code is also attached to a css file I made to format the page. It's located on my google drive and the link is in the code. You can use it if you would like, I don't mind.
To put the controls into the YAWCAM streaming page you needs to insert an iframe into the YAWCAM pages located in C:\Program Files (x86)\Yawcam\stream and they are named: template_js.html, template_mjpg.html, template_wm.html
Insert an inline frame that points to your visible internet ip, find it here, along with whatever port you set for the arduino (example http://68.104.XXX.XXX/8084)
Then to access the cam stream with the controls you will go to the address specified by YAWCAM. There will be two address, one for viewing from inside your network and one for viewing outside your network. You may want to have someone available at a different location to test the outside the network view for you.
Due to formatting issues I'm not able to put the arduino code directly in here because it contains html elements.
Step 3: Conclusion
One of the best assets I had when putting this together was my brother. I would send him the link whenever I wanted to test the setup from outside my network and he would send me screenshots and let me know if there were issues.
It's a fun project and gives you the ability to check out your home when you're not there.
It could be a fun way to make sure your pets are behaving while your gone.