Arduino 5 Minute Tutorials: Lesson 6 - Force, Bend, Stretch Sensors

Posted on 17/09/2018 by cbenson in Arduino 5 Minute Tutorials
Modified on: 23/03/2023
Steps completed / 2
Press to mark a step as
completed or click here to complete all
Introduction

Welcome to RobotShop's 5 Minute Tutorials. This specific series focuses on getting started with Arduino and covers core concepts like basic code structure, interfacing with sensors, actuators, and more. This lesson covers the concept of a voltage divider which is needed when using many types of force, bend or stretch sensors. Once complete, use the table of contents to move on to the next lesson.


  1. Computer / Laptop or Netbook
  2. Arduino Microcontroller
  3. USB to Serial Adapter (if your microcontroller does not have a USB port)
  4. Appropriate USB cable (Arduino boards draw power from the USB port – no batteries yet)
  5. Standard servo motor (current consumption <50mA)
  6. Pin headers/cables
  7. Bend /stretch sensor and/ or Force sensor

Force “sensors” are actually “force sensing resistors” (FSRs). Similarly, bend “sensors” are actually products whose resistance changes with flexing. These can all be categorized as “variable resistors”. To interface a product whose resistance changes with a microcontroller, you need a voltage divider circuit. This “circuit” is nothing complex – aside from wires, the only part you are missing is a resistor.

To create the circuit, add the variable resistor in series with a similar (standard) resistor of roughly the same resistance (in ohms). Connect a wire between the two - this wire goes to the analog input of the board. There should only be two wires left - one end of the standard resistor, and one end from the variable resistor - these ends are connected to +5V and GND respectively. You can now use it as a regular sensor with analog output.

Arduino 5 Minute Tutorials

If you want a pre-made circuit, consider the Phidgets voltage divider:

Phidget Voltage Divider

The output of this “mini-circuit” is a signal between 0 to 5V (this is referred to as an analog signal), which is connected to an analog pin of the microcontroller. The microcontroller's onboard analog-to-digital converter (ADC) interprets this voltage and assigns it a number that you can use in your code. For 10-bit ADC (210), you will get a number between 0 and 1024 representing 0V to 5V. You would need an equation in your code to use this number to send the appropriate signal to a motor controller. As you might have suspected, the code is now identical to that used to get an analog input.

To get a sample code, open the Arduino software and go to File -> Examples -> Analog -> AnalogInOutSerial

The video above shows a bend sensor connected to an Arduino, and the Arduino is connected to a small servo motor. The analog value associated with the flex sensor is read by the Arduino, and that value is converted to a rough position. You would merge the Analog example code with the servo code, and add a single line to convert the 0 to 1024 value to 0 to 180 degrees. It is easy to see how, with many of these sensors, you can create a data glove that controls a robotic hand.

Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post