Introduction: Face Tracking Arduino Robot

hello guys...

our new project on robotics based on arduino ...

face tracking arduino robot using two servo motors with arduino...

, in this project we are going to implement face detection by blending in the power of Arduino and Android. In this project, the mobile camera will move along with your face with the help of servos. The advantage of using the Android Mobile Phone here is that you do not need to invest on a camera module and the whole image detection work can be done in the phone itself, you do not need your Arduino connected to your computer for this to work. Here we have used Bluetooth Module with Arduino to communicate with Mobile wirelessly.

The Android application used in this project was created using Processing Android, you can either directly install the application by downloading the APK file (read further for link) or put on your programming app.

By the step of this tutorial you will have a Mini Tilt and Span Robotic Arm that could track your face and move along with it...

now lets go...

Step 1: Components

Picture of Components

Step 2: Circuit Diagram

Picture of Circuit Diagram

at 1st..we have to do..

servo connection:-

(left and right )servo is connect to 3pin of arduino

(up and down) servo is connect to 5pin of arduino..

next...

bluetooth connection:-we have used bluetooth module hc-05

vcc is connect to +5v

and gnd is connect to gnd

rx pin of bluetooth is connect to 11pin of arduino

tx pin of bluetooth is connect to 12 pin of arduino.

thats easy connection......

Step 3: Setting Up Your Android Application

Picture of Setting Up Your Android Application

1:-download the zip file.

2:-take the apk file in your android phone and install it.

3:-Power on the circuit shown above.

4:-If you have named it something else other than “HC-05” change it back to HC-05 since only then the application will work.

5:-Pair with your Bluetooth module with the password “1234” or “0000”.

6:-Now, launch the Application in portrait mode. You should see your camera screen and also “Connected to: HC-05” on the top of your screen.

7:-Try moving your camera over a face and a green box should appear on top of it and its position will also be displayed on the top left corner of your screen as shown below.

Step 4: Uploading the Code

1st copy the code below.. then paste to arduino..

#include //header to drive servo motors

#include // import the serial library

SoftwareSerial cam_BT(12, 11); // RX, TX

int ledpin=13; // led on D13 will show blink on / off

int BluetoothData; // the data given from Computer

//lets declare the servo objects

Servo servo1;

Servo servo2;

long gmotor,gnum1,gnum2;

int pos;

int flag=0;

int pos1 = 40;

int pos2 = 90;

void setup()

{

servo1.attach(3);

servo2.attach(5);;

//**Initial position of all four servo motors**//

servo1.write(pos1);

servo2.write(pos2);

//**initialised**//

cam_BT.begin(9600); //start the Bluetooth communication at 9600 baudrate
cam_BT.println("Ready to take commands");

Serial.begin(57600);

Serial.println("Face tracking programming by CircuitDigest.com");

}

//***Function for each Servo actions**//

void call(int motor, int num1, int num2) // The values like Motor number , from angle and to angle are received

{

Serial.println("Passing values...");

flag =0;

switch (motor)

{

case 1: // For motor one

{
Serial.println("Executing motor one");

if(num1num2) // Anti-Clock wise rotation

{

for ( pos =num1; pos>=num2; pos-=1)

{

servo1.write(pos);

delay( 20);

}

}

break;

}

////////JUST DUPLICATE FOR OTHER SERVOS////

case 2: // For motor 2

{

Serial.println("Executing motor two");

if(num1num2)

{

for ( pos =num1; pos>=num2; pos-=1)

{

servo2.write(pos);

delay( 20);

}

}

break;

}

}

}

void loop()

{

if(Serial.available()>0) //Read whats coming in through Serial

{

gmotor= Serial.parseInt();

Serial.print(" selected Number-> ");

Serial.print(gmotor);

Serial.print(" , ");

gnum1= Serial.parseInt();

Serial.print(gnum1);

Serial.print(" degree , ");

gnum2= Serial.parseInt();

Serial.print(gnum2);

Serial.println(" degree ");

flag=1;

}

if (cam_BT.available()) //Read whats coming in through Bluetooth

{

BluetoothData=cam_BT.read();

Serial.print("Incoming from BT:");

Serial.println(BluetoothData);

}

if (flag ==1) call(gmotor,gnum1,gnum2); //call the respective motor for action

if (BluetoothData==49) //Turn Left

{

pos1+=2; servo1.write(pos1);

}

if (BluetoothData==50) //Turn Right

{

pos1-=2; servo1.write(pos1);

}

if (BluetoothData==51) //Turn Up

{

pos2-=2; servo2.write(pos2);

}

if (BluetoothData==52) //Turn Down

{

pos2+=2; servo2.write(pos2);

}

flag=0; BluetoothData=0; }

Step 5: Result

so guys..

follow this link on you tube for how to build this projects easily...

so..this is our projects of our channel s_r tronics on you tube...

subscribe our channel...and likes also,do comment in inbox..

Comments

About This Instructable

841views

32favorites

License:

Bio: GUYS FOLLOW US AT OUR FB PAGE ..DO LIKE ND SHARE ..OUR YOUTUBE CHANNEL IS S_R TRONICS...WATCH..TRY..INNOVATE..TASTE THE SUCCESS..THANK U..
More by Sukanta bera:Phone Calling Arduino Robot Using Dtmf DecoderGesture Controlled Robot Using MATLABMultifunction Biped Arduino Robot
Add instructable to: