I used the Arduino Nano's USB-Serial interface to communicate between the PC program and the Arduino. The Arduino is simply given an angle to rotate each servo to.
On the PC side, a C++ program makes use of OpenCV to process the webcam's image. It locates the largest blue object on screen, and calculates how to move the servos using a pair of linear scaling equations. It then uses a serial communication class to send the angle information to the Arduino.
There are a few important limitations of this setup. The C++ program does not use feedback to determine how accurate the laser is, so it has no idea whether it's hitting the target or not. The servos and webcam used were very inexpensive and basic. A better webcam with higher framerate would improve tracking of moving objects. A more precise servo setup would allow finer movement of the laser.
Hello, I want to do this project at home. Can you help me?