Control Servo motor with Flex Sensor

This project is very cool and interesting to make. when we control a servo motor with our finger. control servo motor with flex sensor attached on the finger. we can attach anything to the servo motor so we can control these things with the help of our finger movement. or we can use our hand also to control things. It is a very interesting and useful project. we can use this method in any animatronic hand. which can be controlled by the Flex sensor attached over the glub. you can make a gesture control robot which will work on your hand movement. we will make a tutorial on that in next post. now in this post, we learn how to connect and how it’s work.servo motor with flex sensor

Working of servo motor with flex:- Flex sensor is a type of resistor. or we can say it a flex variable resistor. when we flex the sensor the value of resistance gradually change. the value is in the analog. so we get this analog value at the analog pin of the Arduino. and make some conditions in the code according to these values. on these condition servo get instructions. and rotate according to the instructions. here is another project on servo motor which is Sun tracking system which would you like. 

Components required in Control Servo motor with Flex Sensor:- There are some components required to make this awesome project.

  • Servo Motor 

servo motors

There are three components needed in the project. you have to attach this flex sensor to your finger for better work. or you can attach it to the glub. use five fingers for more function in the project. so when you close your hand with glub it will do any activity which you want to enter in the Arduino board. 

Circuit Diagram of servo motor with Flex sensor:-

circuit diagram servo motor with flex sensor

Connect flex sensor and servo motor according to the circuit diagram.

flex sensor with servo motors Arduino code:-

#include<Servo.h>
Servo myservo;
int deg=0;

void setup() {
pinMode(A0, INPUT_PULLUP);
pinMode(9, OUTPUT);
// put your setup code here, to run once:
myservo.attach(9);
Serial.begin(9600);
}
void loop()

{

int m= analogRead(A0);
delay(10);
Serial.println(m);
if(m>=860 && m<=890)
{
// put your main code here, to run repeatedly:

myservo.write(45);
delay(500);
}

else if(m>=891 && m<=920)
{
// put your main code here, to run repeatedly:

myservo.write(90);
delay(500);
}

else if(m>=921)
{
// put your main code here, to run repeatedly:

myservo.write(180);
delay(500);
}

else
{myservo.write(0);

delay(500);}
}

Upload the sketch into the Arduino Board. all the best . 

 

 

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *