
Using a Flex Sensor — SIK Circuit 9
Imiyalelo
Parts & Introduction
Parts & Introduction
A flex sensor changes resistance when bent. Combined with the servo from Circuit 8, you can create gesture-based controls — bend the sensor to move the servo. This combines analogRead() with the Servo library.
Parts Needed
- 1x Arduino Uno + USB cable
- 1x Breadboard
- 1x Flex Sensor
- 1x Servo Motor
- 1x 10KΩ Resistor
- 11x Jumper Wires
Izinto zokwakha zalesi sinyathelo:
SparkFun Inventor's Kit - V3.21 ikhithiAmathuluzi adingekayo:
Computer with Arduino IDEHardware Hookup
Hardware Hookup
Wiring Instructions
Flex Sensor
- Connect one pin of the flex sensor to 5V.
- Connect the other pin to Analog Pin A0.
- Connect a 10K resistor from Analog Pin A0 to GND (voltage divider).
Servo
- Connect Red wire to 5V.
- Connect Black wire to GND.
- Connect White wire to Digital Pin 9.
Izinto zokwakha zalesi sinyathelo:
Flex Sensor1 ucezu
Breadboard1 ucezu
Jumper Wires7 izicucuArduino Code
Arduino Code
Open the Arduino IDE and upload the following sketch to your Arduino board.
Izinto zokwakha zalesi sinyathelo:
Arduino Uno R31 ucezuAmathuluzi adingekayo:
Computer with Arduino IDETest & Experiment
Test & Experiment
What You Should See
The servo moves in response to bending the flex sensor. Open the Serial Monitor to see both the raw sensor value and the mapped servo position.
Troubleshooting
- Servo not moving: Check servo wiring — easy to plug in backwards.
- Sensor only works one way: The flex sensor bends in one direction. The striped side should face outward on a convex curve.
- Limited range: Adjust the
map()range values (600, 900) to match your sensor's actual readings from the Serial Monitor.
Experiments to Try
- Build a "robot finger" that mimics your finger bending.
- Replace the servo with an LED and control brightness by bending.
Izinto
7- SparkFun Inventor's Kit - V3.2ikhomishini engu-10%1 ikhithi$107.84
- 1 ucezuIsibambeli
- kusukela ku-$9.67
- kusukela ku-$4.24
- kusukela ku-$27.55
- 1 ucezuIsibambeli
- kusukela ku-$1.21
Amathuluzi Adingekayo
1- Isibambeli
CC0 Isizinda Somphakathi
Le blueprint ikhishwe ngaphansi kwe-CC0. Ukhululekile ukukopisha, ukuguqula, ukusabalalisa, nokusebenzisa ngaphandle kwemvume.
Sekela uMenzi ngokuthenga imikhiqizo nge-Blueprint yabo IKhomishane Yomenzi kumiswe ngabathengisi, noma dala inguqulo entsha yale Blueprint bese uyifaka njengoxhumaniso ku-Blueprint yakho ukuze wabelane ngemali engenayo.