ESP32 C3 Super Mini - Force Sensor

Learn how to interface a force sensor (FSR) with your ESP32 C3 Super Mini 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.

In this tutorial, you'll learn:

ESP32 C3 Super Mini - Force Sensor

Hardware Preparation

1×ESP32 C3 Super Mini
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 force sensitive resistor or FSR) is a component that changes resistance based on applied pressure.

  • Resistance behavior: Resistance decreases when pressure increases
  • Function: Detects physical squeeze, touch, and pressure
  • Output type: Analog signal (0-4095 on ESP32 C3 Super Mini)
  • 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 pins that work like a variable resistor.

  • Pin 1: Connect to analog input or voltage divider circuit
  • Pin 2: Connect to GND or the resistor in voltage divider setup

Note: Pins are interchangeable - polarity doesn't matter for FSR sensors.

Force sensor pinout

Wiring Diagram between Force Sensor and ESP32 C3 Super Mini

Connect your force sensor to the ESP32 C3 Super Mini using a voltage divider circuit with a 10kΩ resistor.

  • Note: The 10kΩ resistor creates a voltage divider to produce readable analog values
The wiring diagram between ESP32 C3 Super Mini Force

This image is created using Fritzing. Click to enlarge image

Force Sensor Pin 1 GPIO2 (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 C3 Super Mini reads force sensor values through its analog input pin using a simple voltage measurement principle.

  • Voltage divider: The FSR and 10kΩ resistor create a voltage divider circuit
  • Analog reading: ESP32 measures voltage at the analog pin (0-3.3V range)
  • Value range: analogRead() returns values from 0 (no pressure) to 4095 (maximum pressure)
  • Interpretation: Higher values = more pressure applied to the sensor
  • Reading method: Use analogRead() function on the connected GPIO pin

ESP32 C3 Super Mini Code

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

What this code does:

  • Reads analog values from the force sensor connected to GPIO2
  • Converts readings to pressure levels (no pressure to big squeeze)
  • Displays real-time force sensor values on Serial Monitor
  • Updates readings every 500 milliseconds
  • Helps you understand FSR sensitivity and response
/* * This ESP32 C3 Super Mini code was developed by newbiely.com * * This ESP32 C3 Super Mini code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-force-sensor */ #define FORCE_SENSOR_PIN A0 // The ESP32 C3 SuperMini pin connected to the force reistor void setup() { Serial.begin(9600); // 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

  • New to ESP32 C3 Mini? Complete our Getting Started with ESP32 C3 Mini tutorial first to set up your development environment.
  • Install Arduino IDE: If this is the first time you use ESP32 C3 Super Mini, see how to setup environment for ESP32 C3 Super Mini on Arduino IDE.
  • Copy the code: Copy the above code and paste it to Arduino IDE.
  • Connect your board: Plug the ESP32 C3 Super Mini into your computer via USB Type-C cable.
  • Upload the code: Compile and upload code to ESP32 C3 Super Mini board by clicking Upload button on Arduino IDE.
  • Open Serial Monitor: Set baud rate to 9600 to view readings.
  • Test the sensor: Press the force sensor with varying pressure levels.
  • Observe results: Check the Serial Monitor to see real-time analog values and pressure descriptions.
  • Pro Tip: Experiment with different pressure levels to find the threshold values that work best for your specific application.

Serial Monitor Output

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32C3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32C3 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
ESP32C3 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 C3 Super Mini'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 C3 Super Mini's ADC is not perfectly accurate and might require calibration for correct results. Each ESP32 C3 Super Mini 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 C3 Super Mini 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 C3 Super Mini's ADC, refer to the ESP32 ADC Calibration Driver.

Application Ideas

Use your ESP32 C3 Super Mini and force sensor to build these practical pressure-sensing projects:

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

Video Section

Watch the video below for a visual walkthrough of this project.

Challenge Yourself

Test your skills by enhancing this ESP32 C3 Super Mini force sensor project with these challenges:

  • Easy: Add an LED that lights up when pressure exceeds a threshold value
  • Easy: Display "Pressed" and "Released" messages instead of analog values
  • Medium: Use multiple force sensors to detect pressure in different locations simultaneously
  • Medium: Create a pressure-activated alarm system that triggers at specific force levels
  • Advanced: Build a data logging system that records pressure patterns over time with timestamps
  • 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!