A flex sensor or bend sensor is a sensor that measures the amount of deflection or bending. A flex sensor uses carbon on a strip of plastic to act like a variable resistor. The resistance changes by flexing the component. The sensor bends in one direction, the more it bends, the higher the resistance gets.
4.4″ Flex sensor
These sensors are easy to use, they are basically resistors that change value based on how much they’re flexed. If they’re unflexed, the resistance is about ~10 KΩ. When flexed all the way the resistance rises to ~20 KΩ.he bottom part of the sensor (where the pins are crimped on) is very delicate so make sure to have strain relief.
Flex sensor have 2 pins. One pin is connected to ground and other to analog pin and a resistor parallelly.
How to interface the Flex sensor-
Follow the steps below to connect the Flex sensor to evive:
- Take the 2 male-to-female jumper wires and connect their female ends to the 2 pins of the flex sensor.
- Take the free ends and connect them on the bread board as shown below.
- Connect the left terminal to ground as shown.
- Connect the other end to a 10 KΩ resistor.
- the pin below the resistor pin is connected to the analog pin A0.
- The other end of the resistor is connected to 5V pin.
Below is the complete circuit diagram-
- Connect evive to your laptop/PC, and select the appropriate port.
- Open mBlock; if already open and working on a project, save that project. Then, click on New.
- Go to the Robots palette and drag and drop the evive Program block in the scripting area from the evive Inbuilt Tools extension.
- Next, go to the Robots palette and from the evive TFT Display extension drag and drop the Fill screen with () colour block; select any colour of your choice from the drop-down menu.
- From the Control palette, drag and drop the forever block below the Fill screen with () colour block.
- From the Control palette, drag and drop the if() else() block.
- Set a condition that if Read analog pin A1 > 830 then.
- Go to the Robots palette and drag and drop the Set cursor at ()() block from the evive TFT Display extension inside the if() block; set the coordinates at 10,10.
- Then drag and drop Set text colour and background block and set text colour as green and background as black. Also, set the text size to 1.
- Then, drag and drop the Write () block below the Set text size() block. Write ‘finger folded’ in write () block.
- Do the same for else condition and write ‘Finger open’.
- Switch to Arduino mode and upload the script to evive.