Electronic – Driving servo motor using open cv

detectionroboticsservo

I'm working on a object detection robot project.I'm using open cv software to detect objects.
My question is how can i take open cv outputs(x-y coordinates) to servo motor.and how can i interface computer ports using open cv.

Best Answer

This question is a little vague, but maybe I can provide some info that will allow you to improve the quality of your post.

I'm assuming that you have the OpenCV portion working, and you indeed get X/Y position values. If you have OpenCV working, then I assume you can also link to its binaries from your compiler. For example, you can add references to the .NET build of OpenCV (emgucv) in Visual Studio. Your own app will then be able to get the X/Y values.

At this point, you now need to control your servo motor. You could interface with it in several ways. One way is to get a dedicated servo motor driver / controller that communicates with your PC over a variety of physical formats -- RS232, CAN, USB, Ethernet, Ethercat, are some examples. If you have one of these, there is most likely a library that you can also link your application to to control the motor.

Another option is to use an Arduino, a proper motor shield, and then connect your Arduino to your PC via the USB connection. This becomes a virtual COM port and you'll then need to implement your own RS-232 communication protocol to send commands to the Arduino. The code running on the Arduino would then parse these incoming commands, and then control the motors via the motor shield.

If you can make your question more specific, you will likely get even more help from people here.

Related Topic