Introduction: How to Connect Flex Sensor to Arduino
Flex sensor is an type of sensor which gives an analog values based on the bending of the sensor. The Flex Sensor is a unique component that changes resistance when bent. An unflexed sensor has a nominal resistance of 10,000 ohms (10 K). As the flex sensor is bent the resistance gradually increases.
In this tutorial you will understand how to connect an flex sensor and based on the flex sensor value we can control the output device, here we are using Flex sensor as an input device which means we are taking an flex sensor value as input value and by using that we will be controlling an output device ie led, so in this tutorial we gonna control led using flex sensor
Step 1: Components Required
Hardware Components Required
1.Flex Sensor 2.2inch.
2.Arduinouno.
3.10k resistor.
4.LED470ohm ResistorJumper
5.WiresBread Board (Optional).
SoftwareRequired
1. ArduinoIDE
Step 2: Connecting Flex and Led to Arduino
Make the connection as per the circuit diagram
Step 3: Code
Const int flex1 = A0;
Const int led = 8;
voidSetup ()
{
Serial.begin (9600); // Begin Function
pinMode (A0,INPUT); // Initializing Flex sensor as input
pinMode(8,OUTPUT); // Initializing LED as output
}
voidloop ()
{
int temp1 = analogRead (A0); // Reading sensor values
Serial.print ("Flex1 value = ");
Serial.println (temp1); // Printing Sensor value on Serial monitor
if(temp1 > 850)
{
digitalWrite(8,HIGH);
delay(3000);
digitalWrite(8,LOW);
}
}
Step 4: Result
Click on the link for video demonstration
https://youtu.be/3JviCyDLFOM
Step 5: Follow Us on
Blog : https://protechel.wordpress.com
Facebook : https://m.facebook.com/Projects12345/
YouTube: https://www.youtube.com/channel/UCbANQLgkktgx1mT_FHolZwQ