Simple Webcam CCTV

Hello everyone!

I'd like your opinion on the following proyect:

I want a USB webcam (connencted to the PC) to capture video, and a motor to constantly turn 180º for 2 min each time a sensor is activated. But I have no Idea of how to interface the Arduino to the webcam or PC. How should I start? and what approach should I take?

What do you want to "trigger" movement of the camera? If you are considering the camera's motion sensor it might be easier to use a separate PIR motion detector and an Arduino completely separate from the camera and the PC. For example, the PIR can detect movement and the Arduino can detect that signal and power on a motor (I think a hobby servo motor would work well because you have the Arduino send the angle degree to the motor and it will respond.) You could also use a stepper motor and position the camera with that as well. If this is what you have in mind it is not very difficult at all with an Arduino. I would even consider using an ATtiny85 for something this simple.

brucemac:
What do you want to "trigger" movement of the camera? If you are considering the camera's motion sensor it might be easier to use a separate PIR motion detector and an Arduino completely separate from the camera and the PC. For example, the PIR can detect movement and the Arduino can detect that signal and power on a motor (I think a hobby servo motor would work well because you have the Arduino send the angle degree to the motor and it will respond.) You could also use a stepper motor and position the camera with that as well. If this is what you have in mind it is not very difficult at all with an Arduino. I would even consider using an ATtiny85 for something this simple.

Thanks, but how can I start the camara with the PIR sensor? the motor is not much of a problem, but the camara to start recording.

I want to start the webcam with the sensor.

SirRichard94:
Thanks, but how can I start the camara with the PIR sensor? the motor is not much of a problem, but the camara to start recording.

I want to start the webcam with the sensor.

Your Arduino could interface to the PIR sensor and send a command via the USB serial connection to the PC when motion is detected. You need some software on the PC to do something in response to that command. There are lots of possible implementations for that, depending what operating system you're using on the PC, exactly what you want the PC to do, and what programming skills you have to implement it.

If one of the actions you want is to move a servo through a sequence of positions, the Arduino can control the servo either directly (in response to the PIR motion detection) or in response to a command from the application on the PC.

Depending what your overall objective is, you may well find there is an existing commercial product you could use. For example, remotely steerable IP cameras are widely available, as is video-based motion detection software.

The problem is that, it's a school proyect so I dont have much budget, so Im working mostly with savaged and cheap parts.

the program I think would be simple
I think the pseudo-code would be something like

/**********************************

Arduino Imaginary Webcam control

***********************************/

void setup()
{
  // Start everything :P
  
}

void loop()
{

  // Wait for sensor
  
  if (sensor) { 
    Start webcam
    for 2 min {
     //Motor loop here
    }
    // Stop motor
    // Turn off camaara
  }

}

But I dont know how to Interface it with a webcam on PC :c
Maybe I could cheat a little and start the webcam with some webcam motion detection program like Yawcam and leave them separated. That way when the motor moves the camera would detect motion.

But we all know that is waaay less cool.

If the PC is running Windows, you could run Gobetwino on the PC and use that to launch an application that captures video for two minutes and then terminates. I expect you'd be able to find some freeware that does timed video capture; if not, it would be quite simple to write your own using OpenCV/ffmpeg. If you aren't running Windows then you would need to write your own equivalent, that reads commands from the serial port and launches application processes on command - that's a relatively simple thing to do too.