Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <Servo.h>
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);
}
Original file line number Diff line number Diff line change
@@ -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