Flex Sensor Library for Proteus V3.0: two Arduino UNOs with flex sensor modules, the amber strip of U2 bent to 90 deg on the sheet, the Flex Sensor Advance pop-up and the TEP Serial Monitor in its Simple interface printing ADC 128 and angle 90 deg

Flex Sensor Library for Proteus V3.0 (Bend Sensor + Arduino)

2.5K Views
40
700
60
25
60
PCBWay

Hello friends, I hope you all are doing great. Today, I am going to share the new Flex Sensor Library for Proteus V3.0. A flex sensor is a thin plastic strip whose resistance rises when you bend it. You find it in data gloves, robot hands and game controllers, because it turns the bend of a finger into a number. With this Flex Sensor Library for Proteus, the sensor looks like the amber strip you buy, it bends right on your Proteus sheet while the simulation runs, and your Arduino reads it on A0 with analogRead(), exactly as on real hardware.

Version 3.0 is the next version of our flex sensor library, after the earlier versions V1.0 and V2.0. You get three devices: the bare flex strip, a Flex Sensor Module Simple with a live panel on the schematic, and a Flex Sensor Module Advance with a pop-up window and four measured flex sensor test tools. The new Flex Sensor Arduino Proteus demo runs on two Arduino UNOs, shown in the compact Simple interface of our TEP Serial Monitor.

NOTICE: This library is very special to our team. Our flex sensor is a real analog resistor inside Proteus's SPICE simulator, the strip itself bends on your sheet, and the Advance window measures your circuit with four test tools. It took our team a lot of hard work, many test runs and many design changes. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the Flex Sensor Library board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the Flex Sensor Library for Proteus:

Flex Sensor Library for Proteus V3.0: two Arduino UNOs with flex sensor modules, the amber strip of U2 bent to 90 deg on the sheet, the Flex Sensor Advance pop-up and the TEP Serial Monitor in its Simple interface printing ADC 128 and angle 90 deg
Figure: The flex sensor demo in Proteus 8.5: U1 (Simple) flat, U2 (Advance) bent to 90 deg on the sheet, its pop-up reading OUT 0.625 V and ADC 128, and U4 printing "ADC: 128 A0: 0.63 V R: 69.9 k angle: 90 deg".

What is a Flex Sensor?

A flex sensor (also called a bend sensor) is a thin strip of plastic film with a layer of conductive ink printed on one side. When you bend the strip, the ink layer is stretched, its conductive particles move apart, and the resistance rises. Flat, a common 2.2 inch sensor has about 25 k (25,000 ohms); bent to 90 degrees, about 70 k. So a flex sensor is simply a variable resistor with two leads and no polarity. It needs no power of its own and sends no data.

The best-known flex sensors are the Spectra Symbol style strips in two lengths, 2.2 inch and 4.5 inch. They are used in data gloves (one sensor per finger), robot hand projects, game controllers, and to detect whether a hinge, a door or a lid is bent open. A flex sensor bends in one direction only: away from its printed side.

The Flex Sensor at a Glance

Flex sensor in numbers (the resistances are the model's defaults)
FeatureValue
TypeResistive bend sensor: a variable resistor with two leads, no polarity
Sizes2.2 inch and 4.5 inch (Spectra Symbol style)
Flat resistance25 k (2.2 inch), 10 k (4.5 inch)
Bent 90 degrees70 k (2.2 inch), 60 k (4.5 inch)
Bent 180 degrees115 k (2.2 inch), 110 k (4.5 inch)
Bend directionOne way only: away from the printed (ink) side
SpreadReal sensors differ by ±30 %, so calibrate yours
OutputA resistance; a voltage divider turns it into a voltage for analogRead()

Flex Sensor Terms You Will See in This Article

Flex sensor terms
TermMeaning
Voltage dividerTwo resistors in series between 5 V and GND; their middle point gives a voltage that depends on both
OUT / A0The divider's middle point, wired to the Arduino's analog pin A0
ADC countThe number analogRead() returns: 0 to 1023 for 0 to 5 V
STRAIGHT_RESISTANCEThe sensor's resistance when it is flat; your sketch needs it
BEND_RESISTANCEThe sensor's resistance when it is bent 90 degrees
R_DIVThe fixed divider resistor (10 k on the module)
CalibrationMeasuring your own sensor flat and at 90 degrees, instead of trusting typical values
RatiometricThe output follows the supply: if 5 V drops, OUT drops with it
10 - 90 % timeHow long a change takes from 10 % to 90 % of its way
Settle timeWhen the reading stops changing (within 1 count)

How a Flex Sensor Gives Your Arduino an Angle

Step 1: The Voltage Divider

An Arduino cannot measure a resistance directly; it measures a voltage. So the flex sensor goes into a voltage divider with a fixed 10 k resistor: 5 V, then the flex sensor, then the middle point OUT (to A0), then the 10 k to GND. The voltage on OUT is:

OUT = 5 V x 10 k / (R flex + 10 k)

Flat, R flex = 25 k, so OUT = 5 x 10 / 35 = 1.43 V, and the UNO reads 293. Bent 90 degrees, R flex = 70 k, so OUT = 5 x 10 / 80 = 0.625 V, and the UNO reads 128. Note the direction: with the flex sensor on top, A0 falls as the sensor bends.

2.2 inch sensor with the 10 k divider at 5 V (measured in Proteus by the Angle sweep tool)
BendFlex resistanceOUTUNO reads
0 deg (flat)25.0 k1.428 V293
45 deg47.5 k0.869 V178
90 deg70.0 k0.625 V128
180 deg115.0 k0.400 V82

Step 2: From the Reading Back to an Angle

The sketch does the divider maths backwards: volts = ADC x 5 / 1023, then R = R_DIV x (5 / volts - 1), then angle = (R - STRAIGHT_RESISTANCE) x 90 / (BEND_RESISTANCE - STRAIGHT_RESISTANCE), a straight line between "flat = 0 deg" and "bent = 90 deg". In our model the resistance rises in a straight line with the bend, so the same line works up to 180 degrees.

Why 60 Degrees Prints 59

The ADC moves in whole counts, and the sketch divides by 1023. At 60 degrees the sensor has 55.0 k and the UNO reads 158, which the sketch turns back into 54.7 k and 59 degrees. With about 1.8 counts per degree, the error stays within 1 degree, and our panel shows the same 59 as the Serial Monitor. One more detail: Proteus rounds the ADC to the nearest count, while a real ATmega328P truncates. Flat, 292.6 counts give 293 (24.9 k) in Proteus and 292 (25.0 k) on a real UNO.

The Analog SPICE Model

A flex sensor is analog, so our model is a real resistor inside Proteus's SPICE simulator, the part of Proteus that solves the voltages of the circuit. Proteus computes the voltage on OUT at every step, and the Arduino's ADC reads it. This flex sensor was our first analog model proven in Proteus 8.5 (8 Oct 2026): flat, ADC 293 and 24.9 k; at 90 degrees, ADC 128 and 69.9 k. Version 3.0 gives the same numbers. More about SPICE models: How to Add a SPICE Model in Proteus.

What's New in Flex Sensor Library for Proteus V3.0

If you used an earlier version of our flex sensor library, here is what has changed:

  • The strip bends on the sheet: the sensor looks like the amber flex sensor you buy, and it bends on your schematic while the simulation runs.
  • Three devices in TEPFLEX.LIB: FLEXTEP (bare sensor), FLEXMODTEP (module Simple) and FLEXMODADVTEP (module Advance).
  • A small blue module board with a PWR LED, an OUT LED and a readings display.
  • The Simple panel closes with a red X; the Advance pop-up has measured values, a chart and an event log.
  • Four measured test tools: Angle sweep, Divider, Bend step and Calibrate.
  • The ADC as Proteus converts it: the panel shows exactly what your sketch reads.
  • A two-UNO demo with the TEP Serial Monitor: a bend LED on D13 and calibration commands; every line of the earlier demo is kept.
  • Lighter package: about 1.47 MB, without the C++ source code.

The New Flex Strip: It Bends on Your Proteus Sheet

This is the part our team likes best. The flex sensor is no longer a box with a picture in it: the strip itself is the part, and it stands upright on your sheet like the yellow flex sensor you buy in the market. We drew it as a clean TEP model, not a photo:

  • The film: a translucent amber (Kapton) strip, lighter at its edges, with a rounded free end and a square connector end.
  • The sensing band: a silver band from 12 % to 87 % of the length, with dense black bars across it: 14 on the 2.2 inch sensor, 29 on the 4.5 inch sensor. Both sizes are drawn in scale, so the 4.5 inch strip is about twice as long.
  • The connector end: two thin silver traces run down to two silver crimp tabs, with two dark legs below them and a tiny "TEP" print between the tabs.
Flex sensor strip bent to 105 deg on the Proteus sheet: the amber strip with black bars curving to the right from the module header, a thin blue arc, the 105 deg label at the tip and the module display 2.2 in, 105 deg, 77.5 k
Figure: A click right of the strip bent it to 105 deg: the blue arc shows the path of the tip, the grey dots the rest of the way to 180 deg, and the display says OUT 0.571 V, ADC 117, SKETCH 105 deg.

When you press Run, the strip comes alive. It bends to the right from its stiff connector end, with an even curve over its sensing length, and the black bars stay across the film as it curls. A thin blue arc shows the path its tip has swept, grey dots mark the rest of that path, and the angle sits on a small label at the tip. FLEX SLOWLY animates the strip, and the 4.5 inch sensor at 180 degrees bends into a neat half circle.

Click next to the strip, and it bends towards your click, in 5-degree steps: a click level with the bend gives 180 degrees, a click straight above the strip gives 0. In the image, one click gave 105 degrees. The display shows 77.5 k, the model's value; the sketch, from its ADC count of 117, prints 77.4 k and 105 degrees.

There is no box behind the strip: when its angle changes, the model asks Proteus to redraw the part, at most 12.5 times a second. Two grey corner marks on the right frame the area the strip can sweep; keep it free of other parts. In Proteus 8.5, FLEX SLOWLY ran smoothly on both sizes, with no flicker and no trails.

Flex Sensor Library for Proteus: Simple vs Advance

All three devices run the same model (TEPFLEX.DLL) with the same resistance law and properties. They differ in what they include and in their panel:

The three flex sensor devices
FeatureFlex sensor (FLEXTEP)Module Simple (FLEXMODTEP)Module Advance (FLEXMODADVTEP)
Analog SPICE flex sensor, 2.2 or 4.5 inch, the strip that bends on the sheet✔✔✔
Readings display and click-to-bend next to the strip✔✔✔
Bare 2-pin sensor for your own divider (pins 1, 2)✔✘✘
Module with the 10 k divider (VCC, OUT, GND), PWR and OUT LEDs✘✔✔
FLEX SCENE panel on the schematic (red X, PANEL button)✔✔✘
Pop-up window you can move, resize and minimise✘✘✔
Flex page: measured values, 20 s chart, pin / event log✘✘✔
Angle sweep, Divider, Bend step and Calibrate tools✘✘✔
TEP Dark / Light theme, text size, Help page with Copy diagnostics✘✘✔

Choose the bare sensor when you want to build the divider yourself, the Module Simple to keep the controls beside your circuit, and the Module Advance when your sheet is full or you want hard numbers about your divider and your sketch. There is no Advance version of the bare sensor, because the test tools need the module's own divider. The demo uses the two modules.

Download Flex Sensor Library for Proteus

Click the button below to download Flex-Sensor-Library-for-Proteus-v3.0.zip (about 1.47 MB, without the C++ source code):

Flex Sensor Library for Proteus V3.0
  • README.txt: a detailed guide to the files, the wiring, the model, the test tools and real hardware.
  • Proteus Library Files: TEPFLEX.LIB (all three devices), TEPSERIALMON.LIB and our Arduino UNO library ArduinoV3TEP.LIB / ArduinoV3TEP.IDX.
  • Proteus Model Files: TEPFLEX.DLL and TEPSERIALMON.DLL.
  • Proteus Simulation: FLEX-Angle-ArduinoUnoV3.pdsprj, Flex_Angle.hex (both UNOs run it) and copies of both DLLs.
  • Arduino Code: Flex_Angle.ino, the demo sketch. It needs no Arduino library, only analogRead(), digitalWrite() and Serial.

No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.

How to Install Flex Sensor Library for Proteus

  1. Close Proteus and extract the whole zip file to a normal folder, for example your Desktop.
  2. Copy the four files from Proteus Library Files into the LIBRARY folder, usually C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY (on some PCs C:\ProgramData\Labcenter Electronics\Proteus 8 Professional\LIBRARY).
  3. Copy TEPFLEX.DLL and TEPSERIALMON.DLL from Proteus Model Files into the MODELS folder.
  4. Delete TEPFLEX.IDX from the LIBRARY folder if there is one; Proteus makes a new index.
  5. Start Proteus, press P and search for FLEX. You get the three devices (category Sensors > Flex).

Used an earlier version? Earlier versions of our flex sensor library may use other file names; you can keep them. If a design still shows an old symbol, replace TEPFLEX.LIB, delete TEPFLEX.IDX and re-pick the part. Tested in Proteus 8.5; Proteus 7 is not supported.

The Flex Sensor Module in Proteus

We drew the module as a small, clean TEP board in blue. The strip sits in J1, the black 2-pin header on its top edge. Below the "FLEX MODULE" print you see the 10 k divider resistor R1 (marked "103"), the red PWR LED, the OUT LED, a dark readings display, the PANEL button, the SIMPLE badge and the pins VCC, OUT and GND. Here is U1, the Module Simple, flat at the start of a run:

Flex Sensor Module Simple in Proteus at 0 deg: the upright amber strip on the blue module, the PWR LED lit, the display 2.2 in, 0 deg, 25.0 k and the FLEX SCENE panel with FLAT (0 deg) - LOWEST RESISTANCE 25.0 k
Figure: U1 (Simple) flat: "0 deg" above the tip, the display "OUT 1.428 V ADC 293 SKETCH 0 deg", and the FLEX SCENE panel with 25.0 k, ADC 293 and OUT 1.428 V.

Pinout

Flex sensor pins in Proteus (module: VCC OUT GND; bare sensor: 1 2)
PinWhat it doesDemo connection
VCC (module)Supply of the divider and the PWR LED+5V terminal
OUT (module)The divider's middle point; it falls as the sensor bendsArduino A0
GND (module)GroundGND
1 (bare sensor)One end of the flex resistor5V (in your own divider)
2 (bare sensor)The other endA0, with a 10 k resistor from A0 to GND

LEDs and Indicators

Board animations (the same on the Simple and the Advance module)
IndicatorWhat it shows
PWR LED (red)Lit while the module has power (the real module's LED; in the model also a real 1.5 k load)
OUT LED (amber)Lit while OUT changes, that is while the sensor moves
Readings displayThe size, the angle and the resistance ("2.2 in | 0 deg | 25.0 k"), then OUT, the ADC count and the angle the demo sketch prints
Blue arc, grey dots, angle labelThe path the tip has swept, the rest of its path and the angle at the tip
Corner marksThe area the strip can sweep
PANEL: SHOWN / CLOSED, OPEN PANELThe panel button (Simple) or the pop-up button (Advance), with a status dot
SIMPLE / ADVANCEThe device badge

Only the PWR LED is on a real module. The OUT LED, the readings display, the arc and the angle label are TEP additions.

The Bare Flex Sensor (FLEXTEP)

The third device is the flex sensor alone: the same amber strip with its pins 1 and 2 at the bottom, a small name, the readings display, the PANEL button and the badge. Wire it with a 10 k resistor (Proteus's RES part) as shown in the pin table. Its FLEX SCENE panel assumes the divider set in the DIVR property, at 5 V.

Component Properties

Flex sensor properties (double-click the part > Edit Properties)
PropertyMeaningDefault
SIZEThe sensor size: 2.2 or 4.5 (inch)2.2
ANGLEThe bend at the start of a run, 0 to 180 deg0
MOTIONSTILL, or FLEX (flex slowly) at the startSTILL
FLATRThe flat resistance (ohm, e.g. 30k), or AUTO = by sizeAUTO
BENDRThe resistance at 90 deg (ohm), or AUTO = by sizeAUTO
DIVRThe module's on-board divider resistor; for the bare sensor, the divider its readouts assume10k
PERIODThe FLEX SLOWLY period, 1 to 60 s4
PANELSimple devices only: the scene panel at the start, OPEN or CLOSEDOPEN

Ohm values accept 25000, 25k, 4k7, 1.2M, 470R or "10k ohm", from 100 ohm to 10 M. Every Run starts again from these properties; a bad value is logged and the default is used. With FLATR and BENDR you can simulate your own sensor, for example a 2.2 inch one that reads 30 to 40 k flat.

Flex Sensor Simple: The FLEX SCENE Panel on the Sheet

Beside the Simple module sits the FLEX SENSOR MODULE - FLEX SCENE panel (on the right of the image above). It shows a gloved finger from the side with the flex strip on its back, so you see what bends the sensor in a real data glove:

The FLEX SCENE panel (Simple devices)
PartWhat it does
Header, red XThe panel name; the X closes the panel
Status bannerFLAT, BENT, FULLY BENT, FLEX SLOWLY, MOVING or NO POWER, each in its own colour
Side viewThe glove finger with the amber strip on its back, and the fingertip's dotted path from 0 to 180 deg
BEND ANGLE dialThe angle on a small gauge
ReadoutsANGLE, RESISTANCE, SKETCH SAYS (the angle the demo sketch prints), ADC VALUE, and OUT (CIRCUIT) and VCC (CIRCUIT), measured in the circuit
RESISTANCE vs BEND ANGLEThe sensor's straight line with a red dot at the present angle
BEND ANGLE buttons0, 15, 30, 45, 60, 90, 120 and 180 deg
FINE-5 / +5 deg
MOTIONSTILL or FLEX SLOWLY
SENSOR SIZE2.2 in (25 k) or 4.5 in (10 k)
ON-BOARD DIVIDERThe module's divider: 10 k to GND
HOW A FLEX SENSOR WORKSFour short tips about the sensor and its divider

In the flat image, the banner says FLAT (0 deg) - LOWEST RESISTANCE 25.0 k, and the readouts agree with the board display: OUT 1.428 V, ADC 293, SKETCH SAYS 0 deg. OUT and VCC (5.000 V) come from the circuit that Proteus solved, not from a formula.

Bending to 90 Degrees

Flex Sensor Module Simple in Proteus bent to 90 deg: the amber strip curved to the right with the blue arc and the 90 deg label, the display 2.2 in, 90 deg, 70.0 k and the teal banner BENT 90 deg - RESISTANCE 70.0 k
Figure: Click 90: the strip and the finger bend; RESISTANCE 70.0 k, OUT 0.625 V, ADC 128, SKETCH SAYS 90 deg.

Click 90 in the BEND ANGLE row. The finger and the strip bend together in about half a second; the finger moves smoothly at about 200 degrees per second, so the resistance never jumps. The banner turns teal: BENT 90 deg - RESISTANCE 70.0 k. OUT drops to 0.625 V and the ADC to 128. On the sheet, the strip curls until its tip points sideways, and the blue arc shows the quarter circle the tip travelled. The sketch on UNO 1 now prints 90 degrees and lights the green LED D1.

FLEX SLOWLY: a Finger That Keeps Bending

Flex Sensor Module Simple in Proteus with FLEX SLOWLY: the strip at 157 deg, the OUT LED lit, the violet banner FLEX SLOWLY - BENDS 0 TO 180 deg AND BACK EVERY 4 s and the readouts 103.7 k and ADC 90
Figure: FLEX SLOWLY with 180 selected, caught at 157 deg: 103.7 k, OUT 0.440 V, ADC 90, SKETCH SAYS 157 deg; the OUT LED is lit.

Click 180, then FLEX SLOWLY. The finger now bends from 0 to the selected angle and back every 4 seconds (the PERIOD property), like a hand that opens and closes, and the banner turns violet. The image caught the strip at 157 degrees: 103.7 k, OUT 0.440 V, ADC 90, and the sketch says 157. The amber OUT LED is lit, because OUT keeps changing. This is the best way to test code that has to follow a moving finger.

The 4.5 Inch Sensor at 180 Degrees

The 4.5 inch flex sensor in Proteus bent to 180 deg: the long amber strip with 29 black bars bent into a half circle, the orange banner FULLY BENT 180 deg - HIGHEST RESISTANCE 110.0 k and SKETCH SAYS 171 deg
Figure: 4.5 in (10 k) at 180 deg: a half circle on the sheet; 110.0 k, OUT 0.417 V, ADC 85, but SKETCH SAYS 171 deg.

Click 4.5 in (10 k) and 180. The strip becomes the long sensor with its 29 bars and bends into a half circle, and the banner turns orange: FULLY BENT 180 deg - HIGHEST RESISTANCE 110.0 k. OUT is 0.417 V and the ADC 85. But SKETCH SAYS 171 deg, not 180.

That is not a bug; it is a lesson. The demo sketch is calibrated for the 2.2 inch sensor (25 k flat, 70 k at 90 degrees), and the 4.5 inch sensor has another line (10 k flat, 60 k at 90 degrees). When you swap the sensor, calibrate again: type CAL FLAT and CAL BENT, or FLAT 10000 and BENT 60000, as the sketch's comment says.

Closing the Panel

Flex Sensor Module Simple in Proteus with the FLEX SCENE panel closed: PANEL: CLOSED with a grey dot, the upright amber strip at 0 deg, the display 2.2 in, 0 deg, 25.0 k and two corner marks
Figure: The panel closed: PANEL: CLOSED; the strip, the display and the two corner marks stay.

Click the red X in the panel header: the panel disappears, and the board button says PANEL: CLOSED with a grey dot. The sensor keeps working, and the two corner marks of the strip's area are easy to see. Click PANEL to bring the scene back; the PANEL property sets how a run starts.

Flex Sensor Advance: The Pop-Up Window

The Advance device keeps only the module on the schematic, with an OPEN PANEL button and the ADVANCE badge. Here is U2, bent to 90 degrees:

Flex Sensor Module Advance in Proteus: the amber strip bent to 90 deg on the blue module, the display 2.2 in, 90 deg, 70.0 k, the OPEN PANEL button and the ADVANCE badge
Figure: U2 (Advance) at 90 deg: "OUT 0.625 V ADC 128 SKETCH 90 deg"; OPEN PANEL brings the pop-up back.

At Run, the TEP Flex Sensor Advance pop-up opens, with the look of our TEP Serial Monitor and no Windows title bar: move it by its header, resize or minimise it. The header shows the state (U2 · BENT 90 deg), the Flex and Test tabs and the palette (theme), gear (Settings) and ? (Help) icons. Below it, chips show BENT, the ADC count with the angle the sketch makes of it (128, 90 deg), R 70.0 k, the size and the divider.

The Flex Page

Flex page of the Flex Sensor Advance pop-up in Proteus at 90 deg: the live finger and dial, what the module does with OUT 0.625 V, UNO ADC 128 and flex R 70.00 k, the ADC curve, the bend slider and buttons, the 20 s chart and the event log
Figure: The Flex page at 90 deg: everything under WHAT THE MODULE DOES is measured on the running circuit.
  • THE FINGER - LIVE: the glove finger with the amber strip, and the BEND ANGLE dial.
  • WHAT THE MODULE DOES (MEASURED): Supply 5.00 V, OUT 0.625 V (12.5 % of VCC), UNO ADC 128, Sketch prints R 69.9 k and 90 deg, Flex R 70.00 k (from the node voltages), Current 0.063 mA, the on-board 10 k divider, the LEDs, and the last bend: 0 to 90 deg, still after 0.43 s.
  • UNO ADC vs bend angle: the count curve for this sensor and divider, with a red dot.
  • BEND THE SENSOR: an angle slider, the presets, - 5 / + 5, Still or Flex slowly, and the size.
  • LIVE - THE LAST 20 SECONDS: the ADC (blue) and the finger's bend (violet). The step is my click on 90: the bend rose, the ADC fell.
  • PIN / EVENT LOG: the newest line records that bend at 338.410 s (OUT 0.625 V = ADC 128, R 70.0 k, still after 0.43 s), above the tests I ran before.

The current is easy to check: 5 V / (70 k + 10 k) = 0.0625 mA. And 0.43 s is the finger's smooth 90-degree move.

FLEX SLOWLY on the 4.5 Inch Sensor

Flex page of the Flex Sensor Advance pop-up with FLEX SLOWLY on the 4.5 inch sensor: the slider at 90 deg (base) with an amber marker, FLEX SLOWLY now 26.6 deg, ADC 295, and two opposite waves in the 20 s chart
Figure: FLEX SLOWLY, 4.5 in: the slider keeps 90 deg "(base)"; the amber marker and the line "FLEX SLOWLY now 26.6 deg" show the finger.

Here I clicked 4.5 in (10 k) and Flex slowly. While the finger flexes, the slider keeps your angle, "Angle 90 deg (base)", and an amber marker shows where the finger is now: FLEX SLOWLY now 26.6 deg (0 - 90 deg and back every 4 s). The chart shows two waves in opposite phase, and the event log lists the run start, the power-on (VCC 5.00 V, OUT 1.428 V), the sensor change (4.5 in: 10.0 k flat, 60.0 k at 90 deg) and FLEX SLOWLY. At 26.6 degrees the 4.5 inch sensor has 24.77 k, about the 2.2 inch sensor's flat value, so the 2.2 inch sketch prints 0 deg: the same calibration lesson.

The Test Page: Four Measured Flex Sensor Test Tools

The Test tab has four tools. A tool moves the sensor only with the panel's own actions (the bend angle and, for two tools, the finger speed or the divider resistor) and reads the OUT and VCC voltages that Proteus's SPICE solver computes at every step. So every number is measured on the running circuit, with the simulation clock. Each tool puts your bend back when it ends, says why when it cannot start (no power, another test running) and ends with a bold "Good for:" line. All results below come from U2 in Proteus 8.5.

1. Angle Sweep: the Whole OUT Curve

Flex sensor angle sweep test in Proteus: 13 points from 0 to 180 deg, 1.83 counts per degree, ADC flat / 90 / end 293 / 128 / 82, sketch angle error 1 deg, the curve and the table of R, OUT, ADC and the sketch
Figure: Angle sweep, 0 - 180 deg in 15 deg steps: 13 points in 3.6 s; ADC 293 / 128 / 82; 1.83 counts per degree; the sketch within 1 deg.

Good for: "seeing the whole OUT curve and how well your sketch turns the reading back into an angle." Choose 0 - 180 deg, 15 deg steps or 0 - 90 deg, 5 deg steps and click Run test. At each angle, the tool waits for a flat OUT, averages it and lists what the circuit and the demo sketch make of it:

Angle sweep (U2, 2.2 inch sensor, on-board 10 k divider)
BendR (measured)OUTADCThe sketch prints
0 deg25.00 k1.428 V29324.9 k, 0 deg
15 deg32.50 k1.176 V24132.4 k, 15 deg
30 deg40.00 k1.000 V20539.9 k, 30 deg
45 deg47.50 k0.869 V17847.5 k, 45 deg
60 deg55.01 k0.769 V15854.7 k, 59 deg
75 deg62.51 k0.690 V14162.6 k, 75 deg
90 deg70.01 k0.625 V12869.9 k, 90 deg
105 deg77.51 k0.571 V11777.4 k, 105 deg
120 deg85.01 k0.526 V10884.7 k, 119 deg
135 deg92.51 k0.488 V10092.3 k, 135 deg
150 deg100.01 k0.455 V93100.0 k, 150 deg
165 deg107.51 k0.425 V87107.6 k, 165 deg
180 deg115.01 k0.400 V82114.8 k, 180 deg

The tiles sum it up: 1.83 counts per degree from 0 to 90, a sketch angle error of 1 degree at most (60 prints 59, 120 prints 119), and a resolution of 0.29 deg per count near flat but 3.00 deg near the end. The curve flattens out as the sensor bends, so a 10 k divider reads small bends well and big bends poorly. The next tool shows how to do better.

2. Divider: Which Resistor Reads the Bend Best?

Flex sensor divider test in Proteus: the ADC span from flat to 90 deg for 10 k, 4.7 k, 22 k, 47 k and 100 k to GND, the best 47 k with 257 counts in green, the ideal R 41.8 k and the table with the currents
Figure: Divider, 4.7 k to 100 k to GND: 5 resistors in 5.4 s; the on-board 10 k gives 165 counts, the best measured 47 k gives 257; ideal 41.8 k.

Good for: "choosing the divider resistor - the on-board 10 k against 4.7 k to 100 k, and the flipped wiring." The tool swaps the module's divider resistor for each value, reads OUT flat and at 90 degrees, and puts the 10 k back afterwards:

Divider test (U2; * = the module's on-board divider and the demo's R_DIV; per deg = counts per degree)
ResistorOUT flatOUT 90 degADC flat to 90SpanPer degmA flat
10 k to GND *1.428 V0.625 V293 to 1281651.830.143
4.7 k to GND0.791 V0.315 V162 to 64981.090.168
22 k to GND2.340 V1.195 V479 to 2452342.600.106
47 k to GND3.263 V2.008 V668 to 4112572.860.069
100 k to GND3.999 V2.940 V819 to 6022172.410.040

The span is the number of counts between flat and 90 degrees: the longer, the more counts per degree. The on-board 10 k gives 165, 47 k the most, 257. The rule: the best divider is near the square root of (R flat x R 90), here 41.8 k, and 47 k is the nearest common value. It also draws less current: 0.069 mA instead of 0.143 mA.

The second button, + 10 k to VCC (flipped), tests the 10 k on top and the flex sensor to GND: then OUT rises with the bend (the README lists 731 to 896, the same 165 counts). If you change the resistor, tell the sketch: RDIV 47000 in the demo, or R_DIV.

3. Bend Step: How Fast Does OUT Follow a Finger?

Flex sensor bend step test in Proteus: 0 to 90 deg, Quick finger, 3 steps, the ADC falling and rising against the finger, 87 ms from 10 to 90 %, still after 144 ms, 411 readings
Figure: Bend step, 0 to 90 deg, Quick, 3 steps: 87 ms from 10 to 90 %, OUT still after 144 to 150 ms, 411 readings in 2.9 s.

Good for: "seeing how fast OUT follows a bend and how often your sketch must read to catch the movement." Choose the start (0 or 45 deg), the end (90 or 180 deg), the finger (Quick 600, Normal 200 or Slow 50 deg per second) and 1 to 3 steps (bend, straighten, bend). Each step starts from a flat reading (the grey lead-in) and lasts until OUT is flat again; every reading is kept. I ran 0 to 90 deg, Quick, 3 steps:

Bend step (U2, 2.2 inch sensor; the rate is in ADC counts per second)
StepADC10 - 90 %Still afterSettled (1 count)RateReads
1 bend293 to 12887 ms144 ms136 ms-1514 /s97
2 back128 to 29387 ms150 ms142 ms+1511 /s97
3 bend293 to 12887 ms146 ms134 ms-1510 /s96

A flex sensor is a resistor: OUT follows the bend at once, so these times are the finger's own smooth move. With the Normal finger, the README lists 261 ms from 10 to 90 % and a still ADC after 430 ms. The important part for your sketch: the demo reads 4 times a second, so a quick bend is over between two readings. To see the movement, read faster: type EVERY 50.

4. Calibrate: the Two Numbers Every Flex Sketch Needs

Flex sensor calibrate test in Proteus: ADC 293 flat, 178 at 45 deg, 128 at 90 deg and 82 at 180 deg, the lines const float STRAIGHT_RESISTANCE = 24914.7 and BEND_RESISTANCE = 69921.9, and the check 45 deg reads 45, 180 deg reads 180
Figure: Calibrate: 4 points in 1.8 s; the two lines to paste into your sketch; check: 45 deg reads 45, 180 deg reads 180.

Good for: "getting STRAIGHT_RESISTANCE and BEND_RESISTANCE for your sketch - the two numbers every flex sketch needs." The tool holds the sensor flat, at 45, 90 and 180 degrees (400 ms each) and reads 293, 178, 128 and 82. From the flat and the 90-degree count, it writes the two lines to paste:

const float STRAIGHT_RESISTANCE = 24914.7;
const float BEND_RESISTANCE = 69921.9;

The 45 and 180 degree points check the line: 45 deg reads 45, 180 deg reads 180. Why 24914.7 and not 25000? The sketch's maths starts from the ADC count, and Proteus rounds 292.6 counts to 293, so these are exactly the values your sketch computes. In the demo, CAL FLAT and CAL BENT give the same numbers.

Settings and Help

The gear opens Settings: the theme (TEP Dark or Light), the text size, open the panel at Run (with Off, use OPEN PANEL) and a window size reset, saved for your Windows user.

Settings page of the Flex Sensor Advance pop-up: theme TEP Dark or Light, text size Small, Normal or Large, open the panel at Run On or Off, and reset to the default size
Figure: Settings, saved under HKCU\Software\TheEngineeringProjects\TEP Flex Sensor Advance.

The ? icon opens Help & Support: eight cards with their links (bugs and ideas in the flex sensor board of our forum, this article and user guide, updates, donate, website, forum) and Copy diagnostics for a bug report. A links.ini file next to the DLL can change the links.

Help and Support page of the Flex Sensor Advance: eight cards linking to the flex sensor forum board, this article, the donate page, the website and the forum, and the Copy diagnostics button
Figure: Help & Support: TEP Flex Sensor Advance v3.0, build 2026-10-09, TEPFLEX.DLL.

Flex Sensor with Arduino in Proteus

Open FLEX-Angle-ArduinoUnoV3.pdsprj from the Proteus Simulation folder, with Flex_Angle.hex and both DLLs beside it. Its two Arduino UNOs from our Arduino Library for Proteus V3.0 run the same HEX file:

  • NODE 1 - SIMPLE, PANEL ON THE SHEET: UNO 1 (ARD1) with the Flex Sensor Module Simple (U1), the green bend LED D1 with R1 (220R) on D13, and Serial Monitor U3.
  • NODE 2 - ADVANCE, POP-UP PANEL: UNO 2 (ARD2) with the Flex Sensor Module Advance (U2), the bend LED D2 with R2 (220R) on D13, and Serial Monitor U4.
Flex sensor Arduino Proteus circuit running: two Arduino UNOs, the Module Simple bent to 105 deg with its FLEX SCENE panel and LED D1 lit, the Module Advance flat with LED D2 off, and two TEP Serial Monitors
Figure: The whole circuit running, without the pop-up windows: U1 bent to 105 deg by a click (D1 lit, U3 printing ADC 117), U2 flat (D2 off, U4 printing ADC 293).

In this run, I clicked right of U1's strip: it bent to 105 degrees, U1's FLEX SCENE panel (in the middle) switched to BENT 105 deg, and D1 lit. U2 stayed flat, so D2 is off.

Wiring

Demo wiring (the same on both UNOs)
FromToWhy
Module VCC / GND+5V terminal / groundPower (the PWR LED lights)
Module OUTArduino A0The divider voltage
LED + 220 ΩD13 to GNDThe bend LED (on a real UNO, D13 also drives the board's own LED)
Serial Monitor RXD / TXD / GNDArduino D1 / D0 / groundShows what the Arduino prints, sends what you type
Serial Monitor RXD2Not connectedThe sensor sends no serial data

A0 is the first analog input of the UNO (see our Introduction to Arduino UNO).

The Arduino Code

The sketch Flex_Angle.ino uses no library. It starts with the pins, the supply and the divider:

const int FLEX_PIN = A0;               // the divider's middle point goes to A0
const int LED_PIN = 13;                // lights while the sensor is bent past LED_ANGLE

const float VCC = 5.0;                 // supply voltage of the divider (the UNO's 5V)
float R_DIV = 10000.0;                 // the fixed resistor from A0 to GND (10k)

Then the calibration, as variables, so the CAL FLAT and CAL BENT commands can change them:

// Calibration: the sensor's resistance when it is flat and when it is bent 90 degrees.
// Spectra Symbol 2.2 inch: 25k flat, about 70k at 90 deg (the Proteus model's defaults).
// For the 4.5 inch sensor use 10000.0 and 60000.0.  Real sensors vary +/- 30 % - measure yours!
float STRAIGHT_RESISTANCE = 25000.0;
float BEND_RESISTANCE = 70000.0;

setup() starts the serial port at 9600 baud and prints the welcome lines:

void setup() {
  Serial.begin(9600);
  pinMode(LED_PIN, OUTPUT);
  Serial.println("TEP Flex Sensor demo - www.TheEngineeringProjects.com");
  Serial.println("Bend the finger on the Proteus panel and watch the angle.");
  Serial.println("Type HELP for the commands.");
  Serial.println();
}

Each reading starts by reading A0 and turning the count into volts:

  // 1. Read the voltage on A0 (0 .. 1023 for 0 .. 5 V)
  int raw = analogRead(FLEX_PIN);
  float volts = raw * VCC / 1023.0;
  lastAdc = raw;

Then the divider maths, backwards: the resistance from the voltage...

  float resistance = R_DIV * (VCC / volts - 1.0);

...and the angle; a negative angle becomes 0:

  // 3. Turn the resistance into an angle: straight line between "flat = 0 deg" and "bent = 90 deg"
  float angle = (resistance - STRAIGHT_RESISTANCE) * 90.0 / (BEND_RESISTANCE - STRAIGHT_RESISTANCE);
  if (angle < 0) angle = 0;            // a flex sensor only bends one way

One line on the Serial Monitor:

  Serial.print("ADC: ");
  Serial.print(raw);
  Serial.print("   A0: ");
  Serial.print(volts, 2);
  Serial.print(" V   R: ");
  Serial.print(resistance / 1000.0, 1);
  Serial.print(" k   angle: ");
  Serial.print(angle, 0);
  Serial.println(" deg");

The bend LED: on from LED_ANGLE (45 deg), with one message when it switches:

  // 5. The LED: on while the sensor is bent past LED_ANGLE as printed (a message when it changes)
  bool bent = LED_ANGLE > 0 && angle + 0.5 >= LED_ANGLE;
  if (bent != ledOn) {
    ledOn = bent;
    digitalWrite(LED_PIN, bent ? HIGH : LOW);
    Serial.print(bent ? "LED ON - bent past " : "LED OFF - below ");
    Serial.print(LED_ANGLE);
    Serial.println(" deg");
  }

HELP prints two short lines, which fit the Simple interface of the Serial Monitor:

void printHelp() {
  Serial.println("Commands: HELP, STATUS, READ, EVERY ms (0 = pause), LED deg,");
  Serial.println("  CAL FLAT, CAL BENT, FLAT ohms, BENT ohms, RDIV ohms");
}

CAL FLAT measures the sensor and stores STRAIGHT_RESISTANCE (CAL BENT does the same for BEND_RESISTANCE):

  } else if (strcmp(cmd, "CAL FLAT") == 0) {
    float r = measureNow();
    if (r < 0) return;
    STRAIGHT_RESISTANCE = r;
    Serial.print("STRAIGHT_RESISTANCE = ");
    Serial.print(r, 0);
    Serial.println(" (the sensor is flat now)");
    checkCalibration();

The loop reads a command line and takes a reading every everyMs ms, with millis() instead of delay(), so commands get their answer at once:

  if (everyMs > 0 && millis() - lastRead >= everyMs) {   // the readings (millis, not delay: commands stay quick)
    lastRead = millis();
    readSensor();
  }

Everything lives in RAM, so a new Run brings back the start values. To change the sketch, export a new HEX file and load it into both UNOs; see How to get the HEX file from Arduino. New to Arduino? Start with our Arduino Tutorial for Beginners.

Serial Monitor Commands

Commands of the demo sketch, upper or lower case (quick buttons: U3 STATUS, READ, EVERY 1000, EVERY 250; U4 STATUS, CAL FLAT, CAL BENT, LED 60)
CommandWhat it does
HELPThe command list (two lines)
STATUSTwo lines: the calibration, R_DIV and the reading interval; then the LED and the last reading
READOne reading now
EVERY msThe reading interval in ms (start: 250; 0 = pause, READ still works)
LED degThe bend LED on D13 lights from this angle (default 45, 0 = never)
CAL FLATThe sensor is flat now: this reading becomes STRAIGHT_RESISTANCE
CAL BENTThe sensor is bent 90 deg now: it becomes BEND_RESISTANCE
FLAT ohms, BENT ohmsSet the two resistances by hand
RDIV ohmsYour divider resistor (10000 on the module)

How to Run the Demo

  1. Press Run. Both Serial Monitors (9600 baud) and U2's pop-up open, and both monitors print ADC 293.
  2. On U1's panel, click 90: the ADC drops to 128 and D1 lights. Click right of the strip, then try FLEX SLOWLY and 4.5 in.
  3. On U3, click STATUS, READ, EVERY 1000 and EVERY 250.
  4. Calibrate U2: with U2 flat, click CAL FLAT on U4; with U2 bent to 90 deg, click CAL BENT.
  5. On U2, try the Flex page and the four tools on the Test tab.

Flex Sensor Proteus Simulation Results

The Serial Monitor in Its Simple Interface

Both monitors in this demo run in the Simple interface of our TEP Serial Monitor, as in every monitor screenshot here. Only the log, the send box and one slim toolbar row stay visible (baud rate, follow, pause, search and clear), so the window stays small.

  • Switch to it: right-click the log and choose Simple interface, or press Ctrl+Shift+U.
  • Back to the full view: click the corner button (the expand arrows at the top right), press Esc or Ctrl+Shift+U, or right-click and choose Full interface.
  • Your choice is remembered.

Type commands in the send box and press Enter; the quick buttons come back with the full view. Every line the demo prints is 80 characters or less. Read all about the monitor in TEP Serial Monitor Advance for Proteus.

Start-Up

After Run, U3 and U4 print the welcome lines and a reading four times a second (the README's expected output):

TEP Flex Sensor demo - www.TheEngineeringProjects.com
Bend the finger on the Proteus panel and watch the angle.
Type HELP for the commands.

ADC: 293   A0: 1.43 V   R: 24.9 k   angle: 0 deg
ADC: 293   A0: 1.43 V   R: 24.9 k   angle: 0 deg

A Click Next to the Strip

TEP Serial Monitor Simple interface in Proteus: ADC: 232 angle 18 deg, ADC: 130 angle 87 deg, LED ON - bent past 45 deg, then ADC: 117 A0: 0.57 V R: 77.4 k angle: 105 deg
Figure: U3 after a click right of U1's strip: two readings during the bend, the LED line, then 105 deg.
ADC: 232   A0: 1.13 V   R: 34.1 k   angle: 18 deg
ADC: 130   A0: 0.64 V   R: 68.7 k   angle: 87 deg
LED ON - bent past 45 deg
ADC: 117   A0: 0.57 V   R: 77.4 k   angle: 105 deg
ADC: 117   A0: 0.57 V   R: 77.4 k   angle: 105 deg
ADC: 117   A0: 0.57 V   R: 77.4 k   angle: 105 deg

One click right of the strip asked for 105 degrees. The finger needs about half a second for that, so two readings caught it on the way: 18 deg and 87 deg. The 87-degree reading was past 45 degrees, so the sketch printed "LED ON - bent past 45 deg" and lit D1. Then every line reads ADC 117, 0.57 V, 77.4 k and 105 deg.

Bent 90 Degrees on U4

TEP Serial Monitor Simple interface in Proteus: U4 printing ADC: 128 A0: 0.63 V R: 69.9 k angle: 90 deg four times a second
Figure: U4 with U2 at 90 deg: "ADC: 128 A0: 0.63 V R: 69.9 k angle: 90 deg", four times a second.
ADC: 128   A0: 0.63 V   R: 69.9 k   angle: 90 deg
ADC: 128   A0: 0.63 V   R: 69.9 k   angle: 90 deg
ADC: 128   A0: 0.63 V   R: 69.9 k   angle: 90 deg

U4 shows U2 at 90 degrees: ADC 128, 0.63 V, 69.9 k and 90 deg, exactly what the pop-up's "Sketch prints" line showed.

STATUS and Calibration

STATUS answers in two lines; here is the README's example, with U1 at 180 degrees:

Status: flat 25000 R, bent 70000 R, R_DIV 10000 R, every 250 ms
  LED from 45 deg (ON), last ADC 82 = 114.8 k = 180 deg

And with U2 flat, CAL FLAT, then bent to 90 degrees, CAL BENT, U4 prints (README):

STRAIGHT_RESISTANCE = 24915 (the sensor is flat now)
BEND_RESISTANCE = 69922 (the sensor is bent 90 deg now)

These are the Calibrate tool's 24914.7 and 69921.9, rounded to whole ohms.

Troubleshooting

  • The sketch prints "ADC: 0" and "no signal on A0 - check the wiring": the module has no power. Check VCC and GND; the PWR LED must be lit, and the display says NO POWER.
  • A piece of an older strip picture stays on the sheet while the strip bends: the design holds an older TEPFLEX.LIB symbol (the Simulation Log says so). Replace TEPFLEX.LIB, delete TEPFLEX.IDX and re-pick the part.
  • The angle is a degree off (60 reads 59): the ADC moves in whole counts; calibrate, and the error stays within about 1 degree.
  • The angles are far off after you changed the divider or the sensor: set R_DIV (RDIV n) and calibrate again.
  • The reading rises instead of falls: your divider is the other way round (10 k to VCC); the demo's formula assumes the flex sensor on top.
  • The panel's buttons do nothing during a test: the tool owns the bend; wait, or click Stop.
  • The part is not simulated, or no monitor window: TEPFLEX.DLL or TEPSERIALMON.DLL is missing from MODELS and the project folder; click OPEN MONITOR on a closed monitor.
  • The Advance pop-up does not appear: click OPEN PANEL on the module, or turn "Open the panel at Run" back on in Settings.
  • The red X does not close the Simple panel: the LIBRARY folder holds an older TEPFLEX.LIB; replace it, delete TEPFLEX.IDX and re-pick the part.

Things to Know Before Using a Real Flex Sensor

The demo sketch uses only analogRead(), digitalWrite() and Serial, so it runs on a real UNO with a real flex sensor, too. Keep in mind:

  • Bend it the right way: bend the sensor away from its printed (ink) side only, and never at its base, where it kinks. Clamp the base and let only the sensing length bend.
  • Every sensor is different: real flex sensors differ by ±30 %, and a 2.2 inch sensor often reads 30 to 40 k flat. Calibrate yours flat and at 90 degrees, and put the divider you fitted into the sketch (RDIV).
  • Choose the divider: about 42 k suits a 25 k / 70 k sensor; 47 k reads 257 counts from flat to 90 degrees, the module's 10 k only 165.
  • Supply: A0 is ratiometric, and the sketch assumes 5 V, so power the divider from the UNO's 5V pin.
  • Real UNO vs Proteus: a real ATmega328P truncates the ADC (flat: 292, 25.0 k), Proteus rounds (293, 24.9 k).
  • Creep and hysteresis: a real reading drifts a little after a bend and differs between bending and straightening, so leave some margin in your thresholds.

Limitations of the Simulation

  • Modelled: a SPICE resistor that follows the bend (a straight line from 0 to 180 degrees, one direction, both sizes, your own FLATR / BENDR), the divider and PWR LED load, a ratiometric OUT, smooth finger motion, and the UNO's ADC as Proteus converts it.
  • Not modelled: creep and hysteresis, bending the wrong way, temperature, the ±30 % spread (set FLATR / BENDR instead) and wear.
  • The model is our own implementation, written from the Spectra Symbol datasheets; it contains no third-party code. The HEX file contains the Arduino AVR core 1.8.6, which includes LGPL-licensed code; its source is on GitHub.
  • Tested in Proteus 8.5 in October 2026 (the demo, the strip, the four tools and every screenshot here; about 0.43 x real time with the pop-up open and both monitors running) and with 3,025 automatic PC checks, all passed, 49 of them with the real demo sketch on two UNOs. Proteus 7 is not supported.

Want another analog sensor whose resistance changes? See our LDR Sensor Library for Proteus, where light does what the bend does here. For two analog axes and a push button, try our Joystick Module Library for Proteus.

So, that was all about the Flex Sensor Library for Proteus V3.0. I hope the amber strip that bends on your sheet and the four test tools make the flex sensor easy to understand, so your glove or robot hand works the first time you wire a real sensor. If you use the Flex Sensor Library for Proteus in a project, please share your feedback in the comments or in our forum, and if you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!


Comments

0

Join the conversation