# Bending with flex sensors

Contents

Flex sensors are relatively helpful in determining how much bent there is on a particular object. For example, you can use flex sensors on a glove to determine how much you bend your fingers. In this tutorial, we will be exploring how to interface a flex sensor with an Arduino.

## What is a flex sensor? Flex sensors are actually passive resistive devices. When the flex sensor is bent, the resistance of it increases depending on how much you bend it. This could be use to determine how much an object is bent by comparing the initial resistance of the unbent flex sensor to the current bent state. Applications of flex sensors may include determining joint movement in robotics, a virtual reality glove that is used to control certain interface, etc.

## For this tutorial…

In this tutorial, we will use the flex sensor to measure the intensity of how much the sensor is bent, which will determine the brightness of the LED. When the sensor is bent, the flex sensor changes its resistance, which I will be measuring with Arduino’s analog pin. But to do that, we need a fixed resistor to be used as a comparison (I use a 22K-Ohm resistor as the unbent flex sensor measures around 22K-Ohm).

The values received by the analog input will then be mapped to 0 – 255, as to determine the brightness of the LED. (The maximum analogWrite() value for a LED is 255).

Here are some images of the setup:

## Parts used

• Flex Sensor x 1
• 10k-Ohm Resistor x 1
• 330-Ohm Resistor x 1
• LED x 1
• Jumper Wires

[Coming soon…]

## Code

int flexSensorPin = A0; //analog pin 0
int ledPin = 9;

void setup(){
Serial.begin(9600);
pinMode(ledPin,OUTPUT);
}

void loop(){
}
{"ft_lang_label":"__label__en","ft_lang_prob":0.8216661,"math_prob":0.8967823,"size":1951,"snap":"2023-40-2023-50","text_gpt3_token_len":473,"char_repetition_ratio":0.14124294,"word_repetition_ratio":0.018518519,"special_character_ratio":0.24243978,"punctuation_ratio":0.11873351,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9597395,"pos_list":[0,1,2],"im_url_duplicate_count":[null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-30T07:10:43Z\",\"WARC-Record-ID\":\"<urn:uuid:146a431a-146d-45b5-aff0-a9af9513ad28>\",\"Content-Length\":\"103149\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e2972cf7-eded-4618-b68c-6cd5c8b44ef7>\",\"WARC-Concurrent-To\":\"<urn:uuid:f7ea3117-6f3a-4411-bef8-997da9ade53d>\",\"WARC-IP-Address\":\"104.21.29.172\",\"WARC-Target-URI\":\"https://cyaninfinite.com/bending-with-flex-sensors/\",\"WARC-Payload-Digest\":\"sha1:FWXVRWTFPGFTOTRLRP3RFNNG55IPO2IR\",\"WARC-Block-Digest\":\"sha1:OTGLSLQGEFXQUINZODWORCQAUYT5ZWOI\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510603.89_warc_CC-MAIN-20230930050118-20230930080118-00200.warc.gz\"}"}