How to interface Flex sensor with evive

About This Tutorial
This tutorial discusses what are Flex sensors, how to interface them with Evive in Scratch with the help of a sample circuit and program in Scratch mode.
Tutorial Info

Introduction

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.

The flex sensor gives output as analog values which range from 700 to 900, which can be scaled according to the convenience.

How to interface the Flex sensor-

Wiring

Follow the steps below to connect the Flex sensor to evive:

  1. Take the 2 male-to-female jumper wires and connect their female ends to the 2 pins of the flex sensor.
  2. Take the free ends and connect them on the bread board as shown below.
  3. Connect the left terminal to ground as shown.
  4. Connect the other end to a 10 KΩ resistor.
  5. the pin below the resistor pin is connected to the analog pin A0.
  6. The other end of the resistor is connected to 5V pin.

Below is the complete circuit diagram-

 

Scratch Script

  1. Connect evive to your laptop/PC, and select the appropriate port.
  2. Open mBlock; if already open and working on a project, save that project. Then, click on New.
  3. Go to the Robots palette and drag and drop the evive Program block in the scripting area from the evive Inbuilt Tools extension.
  4. 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.
  5. From the Control palette, drag and drop the forever block below the Fill screen with () colour block.
  6. From the Control palette, drag and drop the if() else() block.
  7. Set a condition that if Read analog pin A1 > 830 then.
  8. 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.
  9. 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.
  10. Then, drag and drop the Write () block below the Set text size() block. Write ‘finger folded’ in write () block.
  11. Do the same for else condition and write ‘Finger open’.
  12. Switch to Arduino mode and upload the script to evive.

Below is the complete script:

 

Share this Tutorial
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Related Projects & Tutorials
arithmetic Operators
Arduino IDE: Arithmetic Operators
This tutorial discusses what are arithmetic operators, and the arithmetic operators in Arduino IDE for addition, subtraction, multiplication, division, and finding out the remainder.
All articles loaded
No more articles to load
Featured Projects
Space-Battle-Game on Scratch
Space Battle

This project will show you how to make a cool space battle game on your own in PictoBlox (Scratch-based programming) and play using your Smartphone!

All articles loaded
No more articles to load

Leave a Reply

Close Menu
×

Cart