DAILY DEVICES: Camera Autofocus Working With Servo Motor

The project started with exploring varies parts used in camera lens and discovered that the whole mechanism was based on servo motors and gears. The process of focusing focal length is done with adjusting back and fourth the lens front and backward.

img_glossary06

canonl4

LENS-font-b-Focus-b-font-font-b-Motor-b-font-18-55mm-18-105mm-18

The working of servo motor is programmed with intelligent algorithmic approach which search for a perfect angle to get a perfect focus in auto mode.The components used in the project includes servo motor, arduino uno board and potentiometer.

02

CIRCUIT DIAGRAM

Untitled Sketch_bb

DSC_5476

SKETCH

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
for (pos = 0; pos <= 60; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos);              // tell servo to go to position in variable ‘pos’
delay(15);                       // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos);              // tell servo to go to position in variable ‘pos’
delay(15);                       // waits 15ms for the servo to reach the position
}
}

DEMO

CLICK HERE TO VIDEO THE VIDEO