Force Sensor wrong weight measurement

Hi all,

I just started working with the ESP32 and I plan to use it to activate something when a pressure of around 10kg is applied. I purchased the following sensor, which should have the desired range (max force 22 lbs): Pressure Sensor Amazon

Here is my circuit setup with a 10 kOhms resistor:


and here is my code:

#include <Arduino.h>

const int fsrPin = 34;  // FSR is connected to GPIO 34

void setup() {
  Serial.begin(115200);  // Start serial communication at 115200 baud
  pinMode(fsrPin, INPUT);  // Define fsrPin as an input
}

void loop() {
  int fsrReading = analogRead(fsrPin);  // Read the value from the FSR
  float voltage = fsrReading * (3.3 / 4095.0);  // Convert ADC reading to voltage (3.3V reference, 12-bit resolution)

  // Calculate force from voltage - this formula needs calibration with actual sensor data
  float force;
  if (voltage == 0) {
    force = 0;  // No pressure
  } else {
    force = (voltage / 3.3) * 100;  // Example conversion, replace with calibrated formula
  }

  // Print the readings
  Serial.print("FSR Reading: ");
  Serial.print(fsrReading);
  Serial.print(" - Voltage: ");
  Serial.print(voltage);
  Serial.print("V - Force: ");
  Serial.print(force);
  Serial.println("g");

  delay(500);  // Delay for half a second
}

The issue is that I easily reach the highest FSR value (4095) with just slight pressure, which should correspond to about 100g, not nearly 10kg.

Am I doing something wrong? I need help, please.

Not enough information to figure out what you are doing wrong. You need to know the force versus resistance curve of the FSR to make an informed choice for the other resistor of the voltage divider.

Keep in mind that FSRs aren't useful for quantitative force or weight measurements. Also, the ESP32 ADC has very poor characteristics.

This line of code is complete nonsense:

 force = (voltage / 3.3) * 100;  // Example conversion, replace with calibrated formula

Have a look at this tutorial: Force Sensitive Resistor Hookup Guide - SparkFun Learn

That diagram is not an official Arduino ESP board but you posted this in the section for only an official ESP32.

Therefore I have moved your post to another location.

Please be sure to check you post in the correct place in future.

Remove the pressure sensor and measure the resistance of it. Then replace that 220R resistor with one roughly the same size as the resistance of the sensor.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.