Skip to main content

Analog control of servo motor

Project Name :- Control the position of servo motor using the potentiometer

Today i am going to show the control of the direction of the servo motor on varying the value of the   potentiometer.
Component required
  1. Computer
  2. Arduino UNO with cable
  3. Servo motor
  4. 10 kohms potentiometer
  5. Jumper wires



  And a software named Arduino IDE in computer also we need library file for servo .
 According to Wikipedia "A servo motor is a rotary actuator or linear actuator that allows for precise control of angular or linear position,Velocity and acceleration.It consists of a suitable motor coupled to a sensor for position feedback."
Differ from the other motor,Servo motor have three wires ground,power and the signal.The  brown color indicate ground,red wire indicate positive supply of the arduino. and the last is orange color which indicate the signal.
                                                                              fig :- servo connector
We are going to control the direction of the servo motor via potentiometer,arrange the circuit as shown below

fig:- circuit arrangement

code
#include <Servo.h>
Servo deneshservo;   //create  object to control the servo
int potpin=A0;           // connect analog pin of potentiometer  
void setup() {
  deneshservo.attach(9);//attach the servo signal pin on pin 9 of arduino


}

void loop() {
int val = analogRead(potpin); //read the value of potentiometer between 0 to 1023
  val=map(val,0,1023,0,180);//scale the value of potentiometer to 0 to 180 to use in servo
  deneshservo.write(val);    //set the servo according to the scaled value
  delay(15);                       //delayed time


}
In this project we,first measure the value of the potentiometer the we scale it using map   function  from 0 to 180.And we set the servo according to the scaled value.

Popular posts from this blog

SMPS of computer

                                            fig:- working principle of SMPS       fig :- SMPS of computer From the above figure, we came to know that the function of SMPS in computer which is to convert  the high 220V-AC to 0-12V DC.SMPS contain several color of wires which carry the different voltage to the different parts of the computer.The following table shows the different color cables and its carrying voltage.      

warm clothes distribution program

‘ Small step can make a big difference ’ Rural Women Development Centre from morang,Nepal distributed the warm clothes to the needy people. They manage it possible by collecting fund from working staffs and management committe. Here is the video link of the distribution program. https://youtu.be/AxaHbivcQUM

Multiple mcp23017 interfacing with Arduino

MCP23017 is the I/O port extender that runs on 12C. It is 16-bit I/O expender.in this tutorial we are going to interface the single and multiple  mcp23017 with arduino.  fig:- mcp32017 module IT has 16 I/O ports from PA0 to PA7 and PB0 to PB7. first of all we are going to interface the single mcp23017 with Arduino. For this  connect the circuit as shown on figure. Download the library for mcp23017  from  sketch-- include library -- manage libraries.