diff --git a/Domains/Robotics-Automation/MiniProjects/Flex-sensor(Robotic-finger)+servo-motor/Interfacing flex sensor with Servo motor using Arduino.pdf b/Domains/Robotics-Automation/MiniProjects/Flex-sensor(Robotic-finger)+servo-motor/Interfacing flex sensor with Servo motor using Arduino.pdf new file mode 100644 index 00000000..c367afdc Binary files /dev/null and b/Domains/Robotics-Automation/MiniProjects/Flex-sensor(Robotic-finger)+servo-motor/Interfacing flex sensor with Servo motor using Arduino.pdf differ diff --git a/Domains/Robotics-Automation/MiniProjects/Flex-sensor(Robotic-finger)+servo-motor/code.ino b/Domains/Robotics-Automation/MiniProjects/Flex-sensor(Robotic-finger)+servo-motor/code.ino new file mode 100644 index 00000000..8b908ee4 --- /dev/null +++ b/Domains/Robotics-Automation/MiniProjects/Flex-sensor(Robotic-finger)+servo-motor/code.ino @@ -0,0 +1,24 @@ +#include +int flex0=A0,flex1,flex2; +Servo myservo; +void setup() +{ + myservo.attach(9); + pinMode(flex0,INPUT); + Serial.begin(9600); +} +void loop() +{ + flex1=analogRead(flex0); + flex2=map(flex1,990,1017,0,180); + Serial.println(flex2); + if (flex2 > 90){ + myservo.attach(2); + myservo.write(90); + + } + else{ + myservo.write(0); + } + delay(200); +} diff --git a/Domains/Robotics-Automation/MiniProjects/Flex-sensor(Robotic-finger)+servo-motor/readme.md b/Domains/Robotics-Automation/MiniProjects/Flex-sensor(Robotic-finger)+servo-motor/readme.md new file mode 100644 index 00000000..7b54de2a --- /dev/null +++ b/Domains/Robotics-Automation/MiniProjects/Flex-sensor(Robotic-finger)+servo-motor/readme.md @@ -0,0 +1,41 @@ +# 🤖 Flex Sensor Controlled Servo Motor using Arduino + +This project demonstrates how to control a **servo motor** using a **flex sensor** with an **Arduino**. The servo motor moves according to the bending of the flex sensor — making it great for projects like robotic fingers, gloves, or motion-controlled devices. + +--- + +## 🧠 Project Overview + +The **flex sensor** changes its resistance when bent. This change is read as an analog input by the Arduino, which maps the sensor value to a servo motor angle (0° to 180°). +As the sensor bends, the servo motor moves proportionally. + +--- + +## ⚙️ Components Required + +- Arduino UNO (or any compatible board) +- Flex Sensor +- Servo Motor (e.g., SG90 or MG995) +- 10kΩ Resistor +- Breadboard and Jumper Wires + +--- + +## 🔌 Circuit Connections + +| Component | Arduino Pin | Description | +|------------|-------------|-------------| +| Flex Sensor | A0 | Analog input to read sensor values | +| Servo Motor Signal | D9 | PWM pin to control servo | +| VCC (Servo + Flex Sensor) | 5V | Power supply | +| GND (Servo + Flex Sensor) | GND | Common ground | + +**Note:** Connect a 10kΩ resistor in a voltage divider setup with the flex sensor for stable readings. + +--- + +Author + +Shirsha Nag + +Contributor