Servo-Controlled Webcam

Hello all, I'd first like to apologize if this is in the wrong forum. Secondly, I'm new to this forum and I'm fairly new to the Arduino. I'm an electronic engineering student who's looking for a way to use the Arduino to control a webcam mounted on a servo that I can control.

Basically, I plan on ordering a wireless webcam to place on my front porch near the top of my door. I would place the receiver on the other side of a wall, directly opposite of the webcam, and plug it in to my TV. I had thought up this project a while ago (mainly because I couldn't find the right parts), and when I saw my local Radioshack was carrying servos, I bought one.

What I want to know is what would I need to do (code, other parts, etc?) to get this project up and running.

Thanks, Jon

TechnicalJon: Hello all, I'd first like to apologize if this is in the wrong forum. Secondly, I'm new to this forum and I'm fairly new to the Arduino. I'm an electronic engineering student who's looking for a way to use the Arduino to control a webcam mounted on a servo that I can control.

Basically, I plan on ordering a wireless webcam to place on my front porch near the top of my door. I would place the receiver on the other side of a wall, directly opposite of the webcam, and plug it in to my TV. I had thought up this project a while ago (mainly because I couldn't find the right parts), and when I saw my local Radioshack was carrying servos, I bought one.

What I want to know is what would I need to do (code, other parts, etc?) to get this project up and running.

Thanks, Jon

Technically, that's not a web cam - but, whatever...

You want to build a servo-based pan-tilt setup for the camera, if I am understanding you right. Basically, you'll need two servos (so you'll want to buy another servo; note, btw, that a parallax servo sold at radio shack is not likely to be the cheapest option), and a couple of brackets (one mounts on a servo, and controls the tilt of the camera, the other mounts to the other servo, and controls the "pan" of the first servo. You'll also want something to mount the "base" servo to, and you might want to think about how you'll "weatherise" the servos while they are outside, to protect them from the weather (mainly rain and moisture - simply being under an overhang won't cut it in the long run).

The brackets you can either purchase or build (you can find servo brackets for pan-tilt use on ebay; I think SparkFun also sells them, also check Servo City - many places have them). If you are somewhat handy, you can build a pair; a made a couple for an old project (the quality of the video stinks - my apologies):

http://www.phoenixgarage.org/show_article/76

I made them out of some thin sheet aluminum that I shaped with some tin snips and a file, then drilled and bended them to fit (also a bit of JB Weld helped). Total cost was much less than custom brackets (and at the time, IIRC, custom brackets weren't something you could easily buy, either). I mounted the panning servo on a peanut-butter jar lid and put my controls (R/C) inside the jar.

The whole setup is basically the same as what you are doing, minus the Arduino; I was able to drive the R/C car around my house in a complete circuit by watching on a small TV; you probably won't have to situate the receiver near the camera inside the house.

That link google link on the Parallax servo you supplied detailed what you would need to write to control the servos using the Arduino; there is plenty of other servo control information out there as well. Of course, you haven't said whether you intend the Arduino to be wireless, nor how you intend to command the Arduino to tell it to pan/tilt the servos?

For instance, if you wanted wireless control of the Arduino (ie, the Arduino is outside with the camera), then you would need to think about how you are going to power both the camera and the Arduino together, as well as how you are going to get the commands to the Arduino; there are a few of options (xbee is the most expensive, the least expensive (in terms of time and money) is likely RF serial modules). If you are going with a wired solution, then just keeping the USB connection is the easiest route (another route would be an ethernet shield - more expensive and more effort to code for, though).

Then you'll need to come up with a communications protocol to be able to send commands to the Arduino and have it respond (there are also libraries available to help with this as well); finally you'll need something to send those commands to the Arduino (a PC or another Arduino, or something else).

Just take things one at a time; I would first get a grip on how to program the Arduino and how to control the servo, both by using an external device (like a pushbutton or potentiometer connected to the Arduino), as well as via commands sent by the PC thru the USB serial port. Once you have the basics going, then you can expand on those skills to improve the project.

Thank you for the reply. I meant to say camera, I was looking at the webcam link I posted, haha.

And yes, a pan-tilt setup is what I intend. I might just put it inside near the front door to eliminate the weather factor. Power is another thing I have to think about. I may buy a 9V adapter, but I don't think I want to run an extension chord where someone can just unplug it. If I do this I may be able to put everything (excluding the camera) in a project box or something similar.

I had tried to think most of this through, though I think it's obvious that I didn't think it all the way through, including all the factors. I knew this wasn't going to be an easy thing to do, and I'm sure I'm in way over my head at the moment, but hey, gotta start somewhere right?

In case I don't have the skill to do this yet (and just give up), would there be a way to use a sensor (like the ones used in the lights that plug into the outlet?) connected to the Arduino that when it senses something it rotates the camera? It doesn't even have to be in that direction. Kind of like those Halloween statues that jump out at you when it senses something?

Thank you for your time and info, Jon

A simple servo pan/tilt cam.

http://web.comporium.net/~shb/wc2000-PT-script.htm

@Zoomkat That’s interesting.

I apologize for the late reply. I’ve ran into a problem that I searched for but didn’t see. I was looking through and used the “Knob” code from the Arduino program, uploaded it, and connected a pot to A0 with the servo to +5V, ground, and pin 9.

My problem: I connected the power, ground and signal for the servo first, then anytime I try to put a wire into A0, the servo starts moving all over the place, but in limited degrees (kind of like a locked steering wheel, I’d imagine). I continued hooking up the potentiometer to A0 and ground, and the second I let go of the wires the servo stops. If I touch the wire it moves again, and same thing if I turn the pot. (I have my laptop hooked up to the arduino for a power supply, by the way) and when I rest my hands on the areas between my touch pad below the keyboard, the servo starts moving. I really wasn’t expecting that, haha. I had to unplug the arduino completely so I could type this.

Any insight would be appreciated. I looked into other posts but none where having this problem that I saw.

Thanks,
Jon