ESP32 S3 - Force Sensor

Learn how to interface a force sensor (FSR) with your ESP32 S3 to detect physical pressure and squeeze in your Arduino projects. This beginner-friendly guide walks you through wiring, coding, and reading analog values from a force sensitive resistor using the ESP32 S3 board.

What you'll build:

  1. A circuit that connects a force sensitive resistor to the ESP32 S3 analog input
  2. A sketch that reads raw ADC values from the force sensor in real time
  3. A Serial Monitor display showing pressure level descriptions alongside numeric readings
  4. A foundation you can extend into alarms, grip meters, or pressure-activated controls
ESP32 S3 - Force Sensor

Hardware Preparation

1×ESP32 S3 WROOM N16R8
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×Force Sensor
1×10 kΩ Resistor
1×Breadboard
1×Jumper Wires
1×Optionally, DC Power Jack

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of Force Sensor

A force sensor (also called a force sensitive resistor or FSR) is a passive component whose resistance drops as pressure increases, making it ideal for detecting touch, squeeze, and push events in embedded projects. When paired with the ESP32 S3's 12-bit ADC, it delivers readings from 0 to 4095 that map directly to pressure intensity. Because it requires no external power supply and wires up like a simple resistor, it is one of the easiest analog sensors to add to any project.

Key Specifications

  • Resistance behavior: Resistance decreases when pressure increases
  • Function: Detects physical squeeze, touch, and pressure
  • Output type: Analog signal (0–4095 on ESP32 S3)
  • Best for: Touch detection, pressure-sensitive buttons, grip sensors
  • Not ideal for: Precise weight measurement in pounds or kilograms
  • Advantage: Simple to use, no external power needed, works with analog pins
  • Beginner-friendly: Easy wiring with just two pins like a resistor

Force Sensor Pinout

The force sensor has two interchangeable pins that behave like a variable resistor — polarity does not matter for FSR sensors.

  1. Pin 1: Connect to analog input or the high side of a voltage divider circuit
  2. Pin 2: Connect to GND or the resistor in the voltage divider setup
Force sensor pinout

Wiring Diagram between Force Sensor and ESP32 S3

Connect your force sensor to the ESP32 S3 using a voltage divider circuit so the board can read a proportional analog voltage rather than a raw resistance. The 10 kΩ resistor sits between the sensor's second pin and GND, creating a stable mid-point voltage that rises with applied pressure.

Safety Notes

Keep signal wires short and away from high-current paths to avoid ADC noise. The ESP32 S3 analog pins are 3.3 V tolerant — never connect the sensor directly to 5 V without a level shifter.

The wiring diagram between ESP32 S3 Force Sensor

This image is created using Fritzing. Click to enlarge image

Force Sensor Pin 1 GPIO4 (Analog Input)
Force Sensor Pin 2 GND (via 10kΩ resistor)
10kΩ Resistor Between Pin 2 and GND
Power for divider 3.3V to Force Sensor Pin 1

How To Program Force Sensor

The ESP32 S3 reads force sensor values through its built-in 12-bit ADC, converting the voltage at the analog pin into a number between 0 and 4095. A voltage divider formed by the FSR and the 10 kΩ resistor ensures the pin voltage rises smoothly from near 0 V when there is no pressure to close to 3.3 V under maximum squeeze. The sketch uses analogRead() to capture these values and maps them to human-readable pressure descriptions that print to the Serial Monitor every 500 milliseconds.

ESP32 S3 Code

The following code reads analog values from the force sensor and displays pressure levels on the Serial Monitor.

The sketch samples the force sensor on GPIO4, compares the raw ADC value against a set of thresholds, and prints both the numeric reading and a matching pressure label so you can immediately understand what each value means. No libraries are required — only the built-in analogRead() and Serial functions from the Arduino core are used.

/* * This ESP32 S3 code was developed by newbiely.com * * This ESP32 S3 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3/esp32-s3-force-sensor */ #define FORCE_SENSOR_PIN 4 // The ESP32 S3 GPIO4 pin connected to the force resistor void setup() { Serial.begin(115200); // set the ADC attenuation to 11 dB (up to ~3.3V input) analogSetAttenuation(ADC_11db); } void loop() { int analogReading = analogRead(FORCE_SENSOR_PIN); Serial.print("The force sensor value = "); Serial.print(analogReading); // print the raw analog reading if (analogReading < 10) // from 0 to 9 Serial.println(" -> no pressure"); else if (analogReading < 200) // from 10 to 199 Serial.println(" -> light touch"); else if (analogReading < 500) // from 200 to 499 Serial.println(" -> light squeeze"); else if (analogReading < 800) // from 500 to 799 Serial.println(" -> medium squeeze"); else // from 800 to 1023 Serial.println(" -> big squeeze"); delay(1000); }

Detailed Instructions

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first.
  2. Install Arduino IDE: If this is the first time you use ESP32 S3, see how to setup environment for ESP32 S3 on Arduino IDE.
  3. Copy the code: Copy the above code and paste it into Arduino IDE.
  4. Connect your board: Plug the ESP32 S3 into your computer via USB Type-C cable.
  5. Upload the code: Compile and upload the code to the ESP32 S3 board by clicking the Upload button in Arduino IDE.
  6. Open Serial Monitor: Set the baud rate to 115200 to view readings.
  7. Test the sensor: Press the force sensor with varying pressure levels.
  8. Observe results: Check the Serial Monitor to see real-time analog values and pressure descriptions.
  9. Pro Tip: Experiment with different pressure levels to find the threshold values that work best for your specific application — every FSR has slightly different sensitivity characteristics.

Serial Monitor Output

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
The force sensor value = 0 -> no pressure The force sensor value = 0 -> no pressure The force sensor value = 142 -> light touch The force sensor value = 156 -> light touch The force sensor value = 389 -> light squeeze The force sensor value = 417 -> light squeeze The force sensor value = 623 -> medium squeeze The force sensor value = 798 -> medium squeeze The force sensor value = 934 -> big squeeze The force sensor value = 1002 -> big squeeze The force sensor value = 987 -> big squeeze The force sensor value = 5 -> no pressure The force sensor value = 0 -> no pressure
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

※ NOTE THAT:

This tutorial uses the analogRead() function to read values from an ADC (Analog-to-Digital Converter) connected to a sensor or component. The ESP32 S3's ADC is suitable for projects that do not require high accuracy. However, for projects needing precise measurements, keep the following in mind:

  • The ESP32 S3's ADC is not perfectly accurate and might require calibration for correct results. Each ESP32 S3 board can vary slightly, so calibration is necessary for each individual board.
  • Calibration can be challenging, especially for beginners, and might not always yield the exact results you want.

For projects requiring high precision, consider using an external ADC (e.g ADS1115) with the ESP32 S3 or using another Arduino, such as the Arduino Uno R4 WiFi, which has a more reliable ADC. If you still want to calibrate the ESP32 S3's ADC, refer to the ESP32 ADC Calibration Driver.

Application Ideas

The ESP32 S3 and a force sensor open up a wide range of pressure-sensing projects across robotics, gaming, health monitoring, and smart home automation.

  1. Smart doorbell: Detect when someone presses against a door or panel
  2. Gaming controllers: Create pressure-sensitive buttons for custom game controllers
  3. Robot grip sensors: Measure how hard a robotic gripper holds objects
  4. Musical instruments: Build touch-sensitive pads for electronic drums or keyboards
  5. Presence detection: Detect when someone sits on a chair or lies on a bed
  6. Handshake strength meter: Measure grip strength for fitness or medical applications
  7. Touch lamp controls: Create dimming lights that respond to touch pressure

Video Section

Watch the step-by-step video walkthrough for this ESP32 S3 project below.

Challenge Yourself

Extend your ESP32 S3 force sensor project with these progressive challenges to deepen your understanding of analog sensing and embedded control.

  1. Beginner: Add an LED that lights up when pressure exceeds a threshold value
  2. Beginner: Display "Pressed" and "Released" messages instead of raw analog values
  3. Intermediate: Use multiple force sensors to detect pressure in different locations simultaneously
  4. Intermediate: Create a pressure-activated alarm system that triggers at specific force levels
  5. Advanced: Build a data logging system that records pressure patterns over time with timestamps
  6. Advanced: Combine force sensor with a servo motor to control movement based on pressure intensity

Learn More

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!