Arduino Nano ESP32 - Force Sensor
The force sensor is called force sensitive resistor, the force sensing resistor, or FSR. This tutorial provides instructions on how to use Arduino Nano ESP32 with the force sensor. In detail, we will learn:
- How the force sensor works.
- How to connect the force sensor to Arduino Nano ESP32.
- How to program for Arduino Nano ESP32 to read value from a force sensor.
Hardware Preparation
1 | × | Arduino Nano ESP32 | |
1 | × | USB Cable Type-C | |
1 | × | Force Sensor | |
1 | × | 10 kΩ resistor | |
1 | × | Breadboard | |
1 | × | Jumper Wires | |
1 | × | (Optional) DC Power Jack | |
1 | × | (Recommended) Screw Terminal Adapter for Arduino Nano |
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Overview of Force Sensor
A force sensor is a resistor that its resistance is in inverse proportion to how much force it is given. The more force gives to the sensor, the smaller the sensor's resistance is. The force sensor is good for application that detects physical squeeze, pressure. However, it is not good for the application that finds how many pounds of weight
Force Sensor Pinout
A force sensor has two pins. Just like a resistor, we do NOT need to differentiate these pins.
Wiring Diagram between Force Sensor and Arduino Nano ESP32
This image is created using Fritzing. Click to enlarge image
How To Program Force Sensor
The resistance is in proportion to voltage. We can use the ESP32's analog input pin to measure voltage.
By connecting a pin of the force sensor to an analog input pin, we can read the analog value from the pin ⇒ voltage ⇒ resistance ⇒ force (all í in relative value)
Arduino Nano ESP32 Code
Detailed Instructions
- If this is the first time you use Arduino Nano ESP32, see how to setup environment for Arduino Nano ESP32 on Arduino IDE.
- Copy the above code and paste it to Arduino IDE.
- Compile and upload code to Arduino Nano ESP32 board by clicking Upload button on Arduino IDE
- Press the force sensor
- Check out the result on the Serial Monitor. It looks like the below:.