0% found this document useful (0 votes)
8 views4 pages

MPI LAB - 5 08102024 040257pm

Uploaded by

Shahnawaz Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

MPI LAB - 5 08102024 040257pm

Uploaded by

Shahnawaz Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Lab No.

05
Interfacing Sensors and Actuators with AVR Microcontroller
Objective:
To interface the Sensor and servo motor with Arduino Uno and control position of servo
motor.
Components required:
1. Sensor
2. Servo motor
3. Arduino Uno R3
4. Jumper wires
Sensor:
Select sensor from sensors box to provide input to AVR Microcontroller for the design
experiment to operate the actuator accordingly.
Servo motor:
It is an electric device that is used to control angular rotation. It is a rotary actuator or linear
actuator. Servo motors have servomechanism. The servo mechanism helps the servo motor to
control and monitor the motion of the motor. The user can control the rotation speed and
position (angle) precisely.
Servo motor pins:
A servo motor has 3 pins.
1. VCC ( 5 Volts )
2. GND
3. Signal ( Control input signal )
Servo motors operate on the principle of closed-loop
control, using feedback to continuously adjust and
maintain the motor's position, speed, and/or torque. This
feedback mechanism allows servo motors to precisely
follow a desired trajectory or maintain a specific position. Here's a step-by-step explanation of
how servo motors work:
Motor Control Circuit:
The core of the servo motor is a regular DC motor, typically a small brushed or brushless motor.
This motor is responsible for driving the mechanical output of the servo.
Position Feedback Device:
Servo motors have a built-in position feedback device, often a potentiometer or an encoder. This
device is directly connected to the output shaft of the motor.
Control Signal Input:
The user or a controlling system provides a control signal to the servo motor. This signal is
usually a pulse-width modulation (PWM) signal.
Amplifier and Error Detector:
The control signal is amplified to provide the necessary power for the motor. Simultaneously, the
servo motor has an error detector that constantly compares the actual position (feedback from the
potentiometer or encoder) with the desired position based on the control signal.
Feedback Loop:
The error detector generates an error signal, which represents the difference between the desired
and actual positions. This error signal is used to adjust the motor's movement.
Motor Movement:
The amplified control signal drives the motor, causing it to rotate. As the motor turns, it also
rotates the feedback device (potentiometer or encoder).
Continuous Feedback:
The feedback device continuously provides information about the motor's actual position. This
information is sent back to the error detector, closing the feedback loop.
Adjustment and Stabilization:
The error detector uses the feedback information to continuously adjust the motor's movement.
As the motor gets closer to the desired position, the error decreases until the motor reaches and
maintains the specified position.
Precise Positioning:
The closed-loop control system ensures that the servo motor accurately reaches and holds the
desired position. If an external force tries to move the motor away from its set position, the
feedback loop responds, correcting the motor's movement.
Circuit Diagram:
Sketch:
#include <Servo.h>

Servo myservo;
int pos = 0;

void setup()
{
myservo.attach(4);
}

void loop()
{
for(pos = 0; pos <= 180; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 180; pos>=0; pos-=1)
{
myservo.write(pos);
delay(15);
}
}

Lab Task:
Add 1 sensor and 3 buttons with AVR Microcontroller and now with this 1 sensor and 3
buttons, move the Servo motor to 90, 45, 0 degrees. So, each button has its precise angle and it
will move the motor to that angle only.

You might also like