Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Sensor Series
      • 3D Printing
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to use a flex sensor with Arduino

By Usman ali Butt September 13, 2021

A flex sensor is a variable resistor, which measures the amount of deflection or bending it undergoes. The bending or molding of the sensor is what affects its resistance and this is what differentiates it from a standard, variable resistor.

A flex sensor’s resistance is directly proportional to the amount of bend that occurs. Its resistance can be determined by connecting an ohm meter across its two terminals, which is similar to a resistor-resistance measurement.

The flex sensor is composed of two materials:

1. A conductive material – it’s etched on the more flexible part
2. A flexible pad – it’s similar to hardened rubber

When the sensor is in “normal mode” and is stationary, its resistance remains undisturbed. When the sensor is bent, the conductive material particles move apart from one another, increasing the distance between them. This distance also results in an increase of resistance.

When the sensor is released, it will return to its original shape. This results in a decrease in resistance. Flex sensors are used in several industries, including robots, mining, security, health care, and others.

In this tutorial, we’ll learn how to interface a flex sensor using Arduino, which is similar to a potentiometer or variable resistor with Arduino.

Here’s how it works:

  • The flex sensor’s output is connected with Arduino’s analog pin input.
  • An LED is connected to Arduino Uno’s pulse-width modulation (PWM) pin # 3.
  • The sensor is powered with Arduino’s 5V regulator output.
  • The sensor’s “bend” or flex is monitored by Arduino and the brightness.
  • The LED is controlled by the sensor’s input.

Circuit diagram

In the code, two variables are declared for the LED and analog pin assignment. In the setup function, the LED pin is declared as output and the serial port of Arduino is activated.

The code

In the loop function, the sensor’s output is read by Arduino’s analog pin. This output is converted to a digital number and displayed on the serial monitor.

Arduino ADC (analog to digital) converter is 10-bit wide. The maximum value it can read is 1023. However, Arduino’s digital and PMW pins are 8-bit wide (255 max range). So, to output the ADC data for the PWM pin, it’s necessary to trim it and bring it into the 0-255 range. This is where the statement map () comes in. At the end, the signal is written on the PWM pin.

Flex sensor drawbacks
Flex sensors are not easy to design or manufacture. Over time, they lack the ability to sustain their original shape and parameters. Once stretched, for example, they return to their previous state but lose the constants including the resistance and angle that corresponds to the voltage.

Use cases
Despite their drawbacks, flex sensors are used in several sectors. One example is in fitness devices that aim to correct one’s body posture. They’re also commonly used in electric chairs for better seating posture.

Flex sensors are also often used in applications that monitor activity. Combined with other technologies, such as an oximeter, these sensors can be used in medical devices. For instance, flex sensors can monitor and person’s movement (say, of the movement of their knee or foot), tracking orthopedic recovery.

Where to purchase the parts?

  • Arduino: Mouser
  • Flex sensor: Mouser

You may also like:


  • What are different types of industrial robots?

  • What are Arduino force-sensitive resistors?

  • How to use the ADXL345 accelerometer sensor

  • How to use the BME680 multi-purpose sensor with Arduino

  • Using a potential transformer with Arduino
  • HMI systems
    Human Machine Interface systems: Harmonising man and machine

Filed Under: Electronic Projects
Tagged With: Arduino
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Power Efficiency
Discover proven strategies for power conversion, wide bandgap devices, and motor control — balancing performance, cost, and sustainability across industrial, automotive, and IoT systems.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions.

  • Looking for FEMM expert. Need help to assess my model.
  • PCB layout impact on RF path impedance
  • Op-Amp oscillating
  • rechargeable battery and simple alkaline battery in one single product
  • Impedance Matching Under Low Modal Significance.

RSS Electro-Tech-Online.com Discussions

  • WTB: "The Theory Of Servicing AM, FM, And FM Receivers" by Clarence R. Green and Robert M. Bourque
  • Anyone In The US Ordered From AliExpress Recently?
  • Calculation of A Class amplifier
  • strange laptop problem
  • restarting this Christmas project

Featured Tutorials

Real Time Hardware Filter Design

  • Practical implementation of bandpass and band reject filters
    Practical implementation of bandpass and band reject filters
  • Practical application of hardware filters with real-life examples
    Practical application of hardware filters with real-life examples
  • A filter design example
    A filter design example
  • Types of filter responses
    Types of filter responses
  • What are the two types of hardware filters?
    What are the two types of hardware filters?
  • What are hardware filters and their types?
    What are hardware filters and their types?
More Tutorials >

Recent Articles

  • Stackpole introduces compact jumpers for high-current circuit routing
  • Ironwood Electronics launches near-device-footprint SMT elastomer socket for BGA264
  • Amphenol RF releases P67 FAKRA plugs for 6 GHz RF transmission
  • Microchip releases platform to deliver real-time specifications for AI assistants
  • GigaDevices introduces 32-bit MCUs with integrated DSP and FPU support

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Sensor Series
      • 3D Printing
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
  • Guest Post Guidelines
  • Advertise
  • Subscribe