Introduction: Arduino Face Tracking Mechanism for Biometric Verification (TfCD Prototype Project)

When you want to implement a biometric facial recognition system for for example a biometric door lock, it may be necessary to use a linear face tracking mechanism. When a picture is taken for verification, any distortion caused by the angle the camera has in relation to the face can cause an inaccurate reading and make the facial detection fail. That is why many facial recognition systems have a mechanism to compensate for a person's length.

The system in this instructable is designed to follow a person's face. It uses two light sensors to sense if a person is standing in front of the device. Ideally one would fit a camera which can track a person's face. The image of the camera is then divided into three parts and the face recognition software would draw a rectangle around the face in the image. When the rectangle moves into one of the thirds of the image, the software sends a signal to the servo to move either up or down. The light sensors function in a very similar way. For example, when the lower sensor measures a decrease in incoming light, the mounting plate will move further down until both sensors are dark (the plate is in front of the face).

Alright, so let's see how to do this.

Step 1: Things You'll Need

To build this project, you'll need:

Materials:

  1. MDF board (cut into pieces as shown above)
  2. a model servo motor (we used a Futaba s3001)
  3. a pulley for the servo motor
  4. rope
  5. 4 wheels to guide the wire (can be bought at model building shops)
  6. a breadboard
  7. an Arduino Uno
  8. jumper wire pack
  9. 2 10 Ohm resistors
  10. 2 LDR's (light dependent resistor)
  11. a sliding bearing (6x9x11)
  12. 30 mm M6 bolt
  13. two M6 nuts
  14. a large M6 washer
  15. a piece of thin aluminum to attacht the lightsensors to (90x60mm
  16. small nails which the wheels can rotate about

Tools:

  1. small philips screwdriver
  2. a file
  3. sanding paper
  4. saw
  5. drill
  6. hammer

Step 2: Modifying the Servo Motor

The servo motor is often restricted to only 170 degrees of movement. To function properly, the notch on the main servo gear has to be filed off. We also removed the insert for the potentiometer, as we will not be using commands based on the relative position to the center of the potentiometer.

More details on the servo modification can be found at: Modify a Futaba S3001 servo for continuous rotation

After the servo is modified, the pulley can be attached to the splineshaft of the servo. The pulley has to be bought seperately from the servo. We used some washers and some double sided tape to build our own pulley, this worked fine too.

Step 3: Building the Mechanism

The next step is to build the mechanical part of the project. The wheels can be attached using the hammer and nails. This als enables you to experiment a little to see if the rope comes of the wheels when the servo rotates. It is recommended to place the wheels below and above the rails a little further from the rails to prevent the rope to run off the wheels.

Then the servo can be screwed in. It's recommended wrap the wire twice around the pulley to provide enough friction. The wire can then be clamped and tensioned between the two nuts on the bolt.

Step 4: Electronics

Next step is to connect the arduino, servo and sensors according to the schematic shown in the picture.

Step 5: Coding

The code for the arduino is as follows, this also is a good moment to test the sensors and mechanism before attaching the mdf board to the base.

Int topLightintensity;

int bottomLightintensity;

int difference;

//define top light intensity, bottom light intensity and the difference between the values

#include

Servo myservo;

//Servo library

void setup() {

Serial.begin(9600);

//set the serial

pinMode(9,OUTPUT);

//pin 9 as the output for powering servo

myservo.attach (6);

//servo is attached to pin 6

}

void loop() {

topLightintensity = analogRead(A0);

bottomLightintensity = analogRead(A1);

//top light intensity is read by analog A0, bottom is read by A1

difference = topLightintensity - bottomLightintensity;

//difference is the difference between two analog read values

Serial.println (difference);

//show value of difference in Servial

if (difference < 10 && difference > -10){

digitalWrite (9, LOW);

//if the difference is within 10, the servo doesn’t work

}

else if (difference>= 10)

{

myservo.write(0);

digitalWrite (9, HIGH);

}

//if top light intensity is larger than bottom light intensity (difference more than 10), the servo

goes up

else

{

myservo.write(180);

digitalWrite (9, HIGH);

//otherwise, it goes down

}

}

Step 6: Finish Up

The last step is to attach the sensors to the aluminium plate in front of the board.