5
Sensor name: Flex Sensor/Bend Sensor Information Url: https://www.sparkfun.com/products/10264 Price per unit: 7.5USD (approx.. 64HKD) Worked Example: https://www.youtube.com/watch?v=3flQyvCYItY General Information: Flex sensors are sensors that change in resistance. Flex is the behavior of a slender structural element subjected to an external load applied perpendicularly to a longitudinal axis of the element, which is bending. When the flex sensor is being bent, the sensor will convert the range in bending to electrical resistance. The more the sensor is bent, the higher the resistance value.This is a bi-directional flex sensor. It generates readings wherever side you bent it. It has a nominal resistance of around 10kΩ. It may varies between 10kΩ and 40kΩ depends on the degree of the flex. There are different sizes for the sensors, from 1kΩ to 20kΩ, 50kΩ to 200kΩ. Flex sensors are analog resistors, they work as variable analog voltage dividers. There are carbon resistive elements inside the flex sensor, if there are more carbon that means there will be less resistance. When the substrate is bent, the sensor will thus produces a resistance output relative to the bend radius. Flex sensors are made by multiple materials in a sandwich way. Heat shrink tubing containing acetate, copper, resistive and copper. There are quite some of applications of flex sensors. For example to detect joint movement or placement in Robotics; bumper switches for wall detection or pressure switches on robotic grippers. And most commonly gaming gloves, multiple flex sensors can be implanted to a glove to detect movements and make virtual reality gloves. FEATURES Angle Displacement Measurement Bends and Flexes physically with motion device Simple Construction Low Profile Possible Uses - Robotics - Gaming - Medical Devices - Computer Peripherals - Musical Instruments - Physical Therapy

wan9724.files.wordpress.com€¦  · Web viewIt generates readings wherever side you bent it. It has a nominal resistance of around 10kΩ. It may varies between 10kΩ and ... multiple

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: wan9724.files.wordpress.com€¦  · Web viewIt generates readings wherever side you bent it. It has a nominal resistance of around 10kΩ. It may varies between 10kΩ and ... multiple

Sensor name: Flex Sensor/Bend SensorInformation Url: https://www.sparkfun.com/products/10264Price per unit: 7.5USD (approx.. 64HKD)Worked Example:https://www.youtube.com/watch?v=3flQyvCYItY

General Information:Flex sensors are sensors that change in resistance. Flex is the behavior of a slender structural element subjected to an external load applied perpendicularly to a longitudinal axis of the element, which is bending. When the flex sensor is being bent, the sensor will convert the range in bending to electrical resistance. The more the sensor is bent, the higher the resistance value.This is a bi-directional flex sensor. It generates readings wherever side you bent it. It has a nominal resistance of around 10kΩ. It may varies between 10kΩ and 40kΩ depends on the degree of the flex. There are different sizes for the sensors, from 1kΩ to 20kΩ, 50kΩ to 200kΩ.Flex sensors are analog resistors, they work as variable analog voltage dividers. There are carbon resistive elements inside the flex sensor, if there are more carbon that means there will be less resistance. When the substrate is bent, the sensor will thus produces a resistance output relative to the bend radius.Flex sensors are made by multiple materials in a sandwich way. Heat shrink tubing containing acetate, copper, resistive and copper.There are quite some of applications of flex sensors. For example to detect joint movement or placement in Robotics; bumper switches for wall detection or pressure switches on robotic grippers. And most commonly gaming gloves, multiple flex sensors can be implanted to a glove to detect movements and make virtual reality gloves.

FEATURESAngle Displacement MeasurementBends and Flexes physically with motion deviceSimple ConstructionLow ProfilePossible Uses- Robotics- Gaming- Medical Devices- Computer Peripherals- Musical Instruments- Physical Therapy

Page 2: wan9724.files.wordpress.com€¦  · Web viewIt generates readings wherever side you bent it. It has a nominal resistance of around 10kΩ. It may varies between 10kΩ and ... multiple

Fritz sketch of our actual connection.(note: we could not find the actual Serial LED that was provided by SCM on the Fritz software, we still have connected the wire the way we did on the actual serial LED)

Page 3: wan9724.files.wordpress.com€¦  · Web viewIt generates readings wherever side you bent it. It has a nominal resistance of around 10kΩ. It may varies between 10kΩ and ... multiple

Code: in plain English :

include <SoftwareSerial.h>

Include a special library for Arduino, which you can download it in here:https://roboticsclub.org/redmine/projects/quadrotor/repository/revisions/58d82c77908eee0e1c222f7b38691e6532deb77b/entry/arduino-1.0/libraries/SoftwareSerial/SoftwareSerial.hAfter you download it, you need to insert the library from sketch and import.

const int buttonPin = 4; int buttonState = 0; int flexSensorPin = A0; int flexSensorPin2 = A1;

Page 4: wan9724.files.wordpress.com€¦  · Web viewIt generates readings wherever side you bent it. It has a nominal resistance of around 10kΩ. It may varies between 10kΩ and ... multiple

Tell Arduino pin 4 is button input, pin A0 and A1 also the input which connect with the flex sensor. For A0 and A1, you can change the analog input as digital input.

void loop() {buttonState = digitalRead(buttonPin);

int flexSensorReading = analogRead(flexSensorPin);int flexSensorReading2 = analogRead(flexSensorPin2);int flex0to100 = map(flexSensorReading, 120, 270, 0, 100);int flex0to1002 = map(flexSensorReading2, 40, 241, 0, 100);Serial.println(flex0to100);Serial.println(flex0to1002);delay(400);

We need to tell Arduino the int setup is input, so we use DigitalRead for button and AnalogRead for Analog input which is the flex sensor.After Arduino read the data, we remap it to 0-100, so we can start to write if statement.

if (flex0to100 > 95 && flex0to100<105 && flex0to1002 >85 && flex0to1002<92 ){if (buttonState ==HIGH){mySerial.write("Peace");}}if (flex0to100 > 20 && flex0to100<50 && flex0to1002 >20 && flex0to1002<50 ){if (buttonState ==HIGH){mySerial.write("GooD LucK");}}if (flex0to100 > 20 && flex0to100<35 && flex0to1002 >75 && flex0to1002<90 ){if (buttonState ==HIGH){mySerial.write("Fuck You");}}}

We write 3 if statement for this, you can write as more as you want if you got enough input.For the first one, we write if flex0to100(the first flex sensor after mapping) bigger than 95 , smaller than 105 and flex0to1002 (the second flex sensor after mapping) bigger than 85,smaller than 92. The LEDdisplay need to write “Peace”, but before that we need a button to conform the input. So we made one more if statement which is buttonState ==HIGHT to conform and write “Peace”.

Page 5: wan9724.files.wordpress.com€¦  · Web viewIt generates readings wherever side you bent it. It has a nominal resistance of around 10kΩ. It may varies between 10kΩ and ... multiple