Arduino Sensor Applications with Flex

0
6933
arduino sensor

Arduino Sensor Applications with Flex

[nextpage title=”Introduction” ]

Hello friends we have made in this article with a simple Arduino uno flex (flexibility) sensor will let the oil according to the state of the analog value of the applications received from flex sensor.

Used materials:

  • Arduino UNO R3
  • 2.2 “Flex Sensor
  • 3 LED diodes
  • 10K resistance (flex sensor)
  • 220 ohm resistor (for LED diodes)

It seems that the circuit diagram in the image below.

arduino with flex sensor

[/nextpage]

[nextpage title=”Arduino UNO” ]

Arduino Uno

The Uno is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.. You can tinker with your UNO without worrying too much about doing something wrong, worst case scenario you can replace the chip for a few dollars and start over again.
“Uno” means one in Italian and was chosen to mark the release of Arduino Software (IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference versions of Arduino, now evolved to newer releases. The Uno board is the first in a series of USB Arduino boards, and the reference model for the Arduino platform; for an extensive list of current, past or outdated boards see the Arduino index of boards.

Technical specs

Microcontroller ATmega328P
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limit) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
PWM Digital I/O Pins 6
Analog Input Pins 6
DC Current per I/O Pin 20 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328P)
of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328P)
EEPROM 1 KB (ATmega328P)
Clock Speed 16 MHz
Length 68.6 mm
Width 53.4 mm
Weight 25 g

[/nextpage]

[nextpage title=”Flex Sensor” ]

The logic of the flex sensors

Flexibility sensors are bent sensor .flex in English at the bend or flex (stretch it) when the sensor resistance of the sensor. flex sensor resistance on metal pads is 2.2 in inside fold, outside the fold “and 4.5” sizes of flex sensors as often we can make this sensor in ourselves.

flex_ac theflex_boy

Below is a simple flex sensor circuit is provided.

flex_devre_basıt

[/nextpage]

[nextpage title=”Arduino Code” ]

Arduino Code

#define green 2
#define red 3
#define yellow 4
void setup()
{
pinMode(yellow,OUTPUT);
pinMode(green,OUTPUT);
pinMode(red,OUTPUT);
Serial.begin(9600);
}
void loop()
{
int sensor, degrees;
sensor = analogRead(0);
degrees = map(sensor, 768, 853, 0, 90);
Serial.print("analog input: ");
Serial.print(sensor,DEC);
Serial.print(" degrees: ");
Serial.println(degrees,DEC);
if(sensor<580)
{
digitalWrite(yellow,LOW);
digitalWrite(green,HIGH);
digitalWrite(red,LOW);
}
else if((sensor>580)&&(sensor<650))
{
digitalWrite(green,LOW);
digitalWrite(yellow,HIGH);
digitalWrite(red,LOW);
}
else
{
digitalWrite(red,HIGH);
digitalWrite(green,LOW);
digitalWrite(yellow,LOW);
}
delay(100);
}

[/nextpage]