Friday, April 20, 2018

Flex and Pressure sensors.

For a complete index off all my stories click this text

Up to now I have used all kinds of sensors for observing my environment like a rainsensor, soil humidity sensor, light sensor (ldr) etc. There is one sort of sensors I never had the chance to play with and these are the flexible and pressure sensors. Oh it is easy to just order some from Ali-express. However I think they are far to expensive just to play with, as I have no real purpose for them yet.

Then I noticed that my favorite Dutch electronics supplier (Kiwi Electronics) was stocking Velostat. As I had been searching for this for a long time I decided to get some to play with.


Velostat and its alternative (competition) Linqstat is a special sheet of thin plastic. Industrially it is sold in large rolls. And what is special about it is that it is conductive.

This feature makes it an ideal packaging material for electronic prints and components that are sensitive to static electricity. This also makes it usable for us hobbyists.

The interesting part is that if you bend it or put pressure on it, it's resistance alters. And an altering resistance can be measured.

Therefore we can make flexible sensors and pressure sensors from this material at a relative low cost.

Where to get it.

As stated it can be bought in the Netherlands from Kiwi Electronics, SOSSolutions and Floris.CC.  When you are not living in the Netherlands best choice is looking at your local Adafruit dealer or order it direct from Adafruit.

You may be able to obtain it for free though. If you have a computer or electronics dealer nearby ask them to save the black plastic bags in which electronics are shipped. Good chance there are some Velostat bags amongst those.

How does it work

Velostat is a thin piece of plastic that is as said is conductive. In the normal state the molecules are at a certain distance from eachother.

 As soon as there is pressure exercised by bending it or by just pushing on it the molecules are pressed together and therefore make more contact mutually which lowers the resistance. This can off course easily be measured by a multimeter.

How to make a flex sensor.

What you will need is shown in the above picture. A small strip of Velostat, some tape and two strands of uninsulated wire.

I started with cutting a small strip of velostat from my large sheet. Next I took some copperwire which I pressed onto some tape.

I put the velostat on top of that and added on top another piece of copper wire pressed onto some tape. Just make sure that the wires do not touch eachother.

And above you can some of the multimeter readings which are significant different when the velostat is stretched or bent. I found maximum reading of 2400 ohm and a minimum reading (when bend) of 300 ohm. Very promising.

There is room for improvement. There is little contact between a narrow copper wire and the wide velostat. So I guessed I could get better results with a wider replacement for the copper wire.

DIY shops sell aluminum tape which is cheap and conductive. I had some lying around and decided to use that instead of the copper wire.

The results were impressive. When stretched I had a maximum resistance of 6000 ohm. When bend I met a minimum resistance of 200 ohm. And these are just the max and minimum values. There is a scale. Meaning that the more you bend the velostat the less the resistance will be.

Somewhere on the internet I read a story on how someone used two strips of Velostat on top of eachother to get a better result. I had to try that also.

I started by cutting 2 Velostat strips and 2 smaller strips Aluminum tape.

The first strip Aluminum was put on some tape in such a way that the aluminum would be pressed to the Velostat.

The first strip of Velostsat was put on top.

Then the next strip of Velostat was put on top of the first and the second strip of Aluminum was again put on top.

Then a strip of tape covered the whole sandwhich to keep everything together.

The excess tape was removed and measurements were taken.

In stretched form I measured a resistance of about 2 K and in bend position I measured a minimum resistance of about 115 Ohm. So strangely two strips of Velostat pressed together gave a lower resistance as 1 strip did.

I therefore decided to stay with the single strip for the rest of my experiments.

Time for a real test.

As usual I take the easy way. I use a ESP8266, to be exact the Wemos D1 variety, and program it in Basic. This is the most easiest way to get fast results.

If you do not want to work in ESP-Basic you can easily adapt this test using an Arduino and putting the flex sensor on an analog pin.

Measuring resistance is best done by measuring the difference between the VCC, which is fed into one side of the resistor and the GND. To attach the resistor to the ground a pull-down resistor is used. Normally a pull down resistor of 10K is used however there is a formula that can be used for giving a better value for the pull-down resistor. That formula is the Axell-Benz formula and you can find a complete story on this here:
Using this formula you will get a much wider spectrum in values with your measurements.

The setup.

Above is the breadboard setup. The Axell-Benz formula prescribed a pull-up resistor of 1100 ohm. This is connected together with one end of the flex resistor to the analog imput of the ESP-8266. The other side of the flex-sensor is connected to the 3.3 Volt connection of the ESP-8266.

The Basic program

timer 100,[test]

wprint |<h1 style="text-align:center;">Luc Volders</br>Flex sensor</br>|
wprint "<br/>"
textbox value
wprint "<br/><br/>"
button "<h2>Off</h2>", [Off]
wprint "<br/>"

sensor =  io(ai)

value = sensor


As you can see it is pretty straightforward.
I start with a timer that every 100 miliseconds calls a routine that reads the analog port and puts the result in the variable called value.
The main part has some fancy HTML code that makes sure everything looks great on the webpage and puts the variable in a textfield which is updated every time the test routine is called and that is every 100 miliseconds.

In stretched form the analog input reads a minimum value of 340

When bend to the max the value of the input is at maximum 900

The readings make perfect sense as they are the reverse of the multimeter readings. The ESP reads the voltage on its analog port and as the sensor is bended more the resistance is lower and therefore more voltage will be read which gives a higher value on the analog port.

All kinds off readings were seen by the in between steps. So the more the sensor is bend the higher the reading will be. This is exact the thing I was looking for.

Beware. The values of the measurements alter not only when bending the sensor but also when putting pressure on it. So make sure you do not touch the part of the sensor where the Velostat is when bending, but just bend it by the ends.


As just stated the resistance not only alters by bending the Velostat but also by putting pressure on it.
So next to making a flex sensor I wanted to test it as a pressure sensor.

I started by cutting a piece of Velostat of 7 x 7 cm.

Just as with the flex sensor I put some Aluminum tape on both sides and glued it together with some painters tape.

Again make sure that the pieces aluminum tape on both sides do not touch eachother and touch only the Velostat.

Time for some testing.

I did some readings with my multimeter and measured a maximumj resistance of 1200 ohm in the normal condition and a minimum resistance of 20 ohm when I put an enormous pressure on the pad.

The Axell-Benz formula tells me to use a pull-down resistor of 220 Ohm to get the best readings on the ESP's analog port.

And indeed the readings were great.

About 190 in normal condition.

About 800 when under pressure.

So I had an idea.

Could I use this as a scale for measuring weights ???

I did some testing with various weights in a bowl. The results were indeed varying with the weight. However they were not consequent. When I moved the weight a bit on the presure pad the readings were differnt at the same weight. When I put a bowl with 400 gram sugar on the pad it sometimes would give me a reading of 616 and the next time 580. So the readings were not consequent with the same weight.
Therefore this is not usable as a scale.


An empty pack of milk would give me a reading of 100 to 190.
When filled with 100 ML water I would get a reading of about 400.

This means that for pressure testing this works flawlessly.


What is it good for.

Well I am not going to tell you that I made a sensor that I put in my fridge to tell me that I was running out of milk. That would be as stupid as the April fools joke that told me that the light of the fridge was actually out when I closed the door (and believe me people thought it was indeed a serious project).
Although I do know that some fridge maunufacturers are indeed experimenting with pressure pads that tell you that you are running out of eggs, milk etc etc etc.

So let's look at some real, practical solutions.
- A pressure pad can tell wether a water tank (be it for irrigation or whatever) is running low.
- A pressure pad put into your shoe can be made into a step counter

- A pressure pad can be positioned under a mat to detect a person entering a room
- A pressure pad can be put in the bottom of a bag/box detecting if it's being lifted
- A flex sensor put on your finger can control the movement of a servo for controlling a robot finger.
- A flex sensor on your finger could control the volume of an audio installatiuon
- A flex sensor on your finger could control an IR remote

Keep in mind that you can not solder the aluminum tape. So this is only usefull for testing purposes, or if your project is not that critical and you can use alligator clips. If you want a more permanent solution use copper tape. I bet it will be even more conductive and you can solder it for a permanent project.

That's it for now.
Have fun

Luc Volders