Controll servo by webcam


I am just a starter with processing and the Arduino and I wonder if anyone can help me with my challenge.

For a design project at the University of Technology I, a third year student Industrial Design, am trying to control a servo motor with a web-cam.

To be more specific; I want use the web-cam to get the position of the person moving in front of it (in a value from 0-total left till 255-total right?). I want to use this value to rotate the servo motor which will control the direction of a lamp.

I really don't know where to start, so could you please help me?


Start off by connecting your web cam to processing, there are libraries that will do this. Then work out how to detect movement from the web cam. You might want to look at frame subtraction, that is subtracting successive frames, no movement shows up as zero (or close to it). Then calculate the position. Only then do you need to send that position down the serial port to the arduino which just takes numbers from the serial port and drives the servo to that position.

I hope I get a good mark. ;)

well you came to the correct place this shows you how to interface a servo to arduino coming to the software part i think you need to post here

I hope I get a good mark.


A site that might be of interest.

I am not sure of how to give a mark. But i thank you all for these first pointers. I just found out my web-cam broke down, so after buying a new one I'll try again. And i will surely post again with new question. Thnx a lot!!

Just a quick question…

Can i use the program provided on the arduino site to do all this? Or do i have to download the processing program on

arduino is the smaller side of the project the main task is to process the image on whatsoever software then its just a matter of sending in a value to the servo over the serial connection

Or do i have to download the processing program on

So your answer is yes.

So your answer is yes

:-[ :-[ perhaps i was going in too much ;)

yes i can do it with the program provides by the website...or yes, i need to download the processing program on

i'm sorry, i know i'm a noob :-[