Ask Your Question

using a raspberry pi and opencv to control a servo motor

asked 2016-01-20 07:02:20 -0500

sirj gravatar image

Hi everyone, I would like to use openCV with a raspberry pi to start a servo motor. The camera on the raspberry pi takes a picture of the person, the openCV scans it, verifies with pictures stored somewhere in a folder if the taken picture is same with any of the pictures in the folder. If the image of the person is one among the pictures in the folder, the raspberry pi sends a signal which starts the servo motor, else it sends say an sms to a phone number. I will so much appreciate a correct response from you. Thank you.

edit retag flag offensive close merge delete


ok let me put the question this way....does anyone have a full code for the face recognition using the open CV, with all the procedures well defined. thanks

sirj gravatar imagesirj ( 2016-06-06 15:48:07 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-01-20 07:53:41 -0500

What OpenCV can do

  • Load images from a webcam attached to a raspberri pi
  • Perform some sort of person detection algorithm on top of it
  • Match the person to a database

What OpenCV cannot do

  • Communicate with servo motors, because that is not computer vision
  • Send sms'es, because that is also not computer vision

So you will need more building blocks than OpenCV alone...

edit flag offensive delete link more



...which are probably the WiringPi (C++) or RPi.GPIO (Python) library.

kbarni gravatar imagekbarni ( 2016-01-20 08:56:15 -0500 )edit

yes sir...I know open cv cannot communicate to a servo motor, but needed help on how to edit the code such that, after the face has been recognized, the pi should send a signal to the servo motor

sirj gravatar imagesirj ( 2016-06-04 23:05:39 -0500 )edit

You are missing a few components. Find a motor controller that is wi fi or bluetooth capable, then send a signal to that. These guys have all kinds of interface controllers. Numatic Engineering

jmbapps gravatar imagejmbapps ( 2016-06-06 09:11:49 -0500 )edit

thanks jmbapps...whats the motor controller supposed to do...can't a simple DC motor do the job?

sirj gravatar imagesirj ( 2016-06-06 15:45:20 -0500 )edit

It is the relay that turns the motor on, you activate it with your low voltage/wireless input, then it connects the motor voltage and handles the extra amperage for start up and running. Im assuming your computer already emits a signal (wifi, bluetooth) so the trick is to find a controller that can already pick up a wireless signal. DC, AC makes no is an AMP thing. ;o) It might be easier to buy a small I/O device that has wireless capabilities, then just wire the motor to an Output, and your motor voltage supply to an Input. The small I/O device would also allow you to run the motor backwards so you can pan a camera, which is what I assume you want to do.

jmbapps gravatar imagejmbapps ( 2016-06-07 07:18:56 -0500 )edit

thanks jmbapps...I'm using a raspberry pi microcomputer. I will connect the DC motor to the GPIO output pin, then program that port to send a low signal to the DC motor to activate it. But then, I want the openCV to perform a face scan. If the face is recognized, that is the only time the low signal is sent to the DC motor, else if the face is not recognized, something else should happen; send a mail and then a signal to activate the buzzer.

sirj gravatar imagesirj ( 2016-06-07 15:50:18 -0500 )edit

Ok., I just looked up raspberry pi, cool interface. I would take a meter and see if the voltage is at the output you connected too when the motor is activated.

jmbapps gravatar imagejmbapps ( 2016-06-08 08:23:04 -0500 )edit

ok...just in case you are able to figure out how to solve my problem, you please let me know.

sirj gravatar imagesirj ( 2016-06-08 16:22:22 -0500 )edit

I just told you how to start trouble shooting. All the coding and interfacing are up to you. No one is going you have your exact it is kind of up to you. Good luck.

jmbapps gravatar imagejmbapps ( 2016-06-08 18:49:11 -0500 )edit

any implement has done to sirj question?? even i am stuck with there.....

naveencool gravatar imagenaveencool ( 2017-06-20 09:27:21 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-01-20 07:02:20 -0500

Seen: 1,850 times

Last updated: Jun 06 '16