Something wrong with FRS Circuit

Hi, I am using FSR in a voltage divider circuit with resistors of 100k ohms. I created a program to convert the output value to grams because the range of the FRS is 0g to 2000g like this:

int avg = (analogRead(A0)+analogRead(A1))/2;
avg = map(avg, 0, 1023, 0, 2000);
lcd.print(avg);

Okay, I know that FSR aren't accurate, but I expected this to give at least a consistent value while being pressed but this isn't the case... it is giving me inconsistent values ranging from 0 - 600. Here is my code...

#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <ezButton.h>


LiquidCrystal_I2C lcd(0x27, 16, 2);
ezButton calibrate(3);
ezButton reset(5);

int speed = 0;
float P1 = analogRead(A0);
float P2 = analogRead(A1);
int AVGPRS;
int getD = 0;

void setup() {
  Wire.begin();
  Wire.setClock(400000);
  reset.setDebounceTime(10);
  calibrate.setDebounceTime(10);
  Serial.begin(19200);
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  delay(500);
  lcd.print("Loading...");
  delay(1000);
  lcd.setCursor(1, 2);
  pinMode(P1, INPUT);
  pinMode(P2, INPUT);
  lcd.setCursor(0, 1);
  lcd.print("Starting Devices...");
  delay(1550);
  lcd.clear();
  
}

void loop() { 
  calibrate.loop();
  reset.loop();
    int us = Serial.parseInt();
    P1 = analogRead(A0);
    P2 = analogRead(A1);
  
    if(Serial.available()==0){
    lcd.setCursor(0, 1);
    if(Serial.available()==0){
    //Calibration & Reset
      if(calibrate.isPressed()){
        getD = getD+10;
        Serial.print(getD);
      }
      if(reset.isPressed()){
        getD = 0;
      }
    lcd.print("DragPrs: ");
    lcd.setCursor(8, 1);
    float avg = (P2 + P1)/2;
    avg = map(avg, 0, 1024, 0, 2000);
    avg = 2000 - avg;
    avg = map(avg, getD, 2000, 0, 2000);
    avg = constrain(avg, 0, 2000);
    lcd.print(avg);
    lcd.setCursor(14, 1);
    lcd.print(" g"); 
    }
    
  
}}

A 100k Ohm resister seems awfully high! Make a divider using a resister that same value as the maximum resistance of your FSR.

FSRs are not just inaccurate, they are highly nonlinear and inconsistent, which is why they are not recommended for quantitative applications.

A post was merged into an existing topic: How to send message via bluetooth

Do you know how to find that out? I mean I got that thing from amazon... Do you
think they have it on there? Because the FSR were awfully small and the details were kinda hard to understand... lemme check.

Okay, here is what I found...

  • product description
  • The RP-C flexible thin film pressure sensor is composed of polyester film of excellent comprehensive mechanical properties, high conductive material and nano-scale pressure sensitive material; the top is a flexible film and pressure sensitive layer above, the bottom is a flexible film and conductive circuit above.Both are glued by double-sided adhesive and the isolation sensitive zone.When there is pressure on sensitive area, the disconnected circuit on the bottom will be connected by top pressure-sensitive layer, and the output resistance of the port changes along with pressure.
  • Specification:
  • Model: RP-C10-ST
  • Thickness: 0.4 mm
  • Trigger force: 20 g, triggered when resistance is less than 200 kΩ by default
  • Pressure sensing range: 20 g ~ 2 kg
  • Pressure action mode: Static or dynamic (frequency within 10 Hz)
  • Non-trigger resistance: More than 10 MΩ
  • Activation time: less than 0.01 S
  • Operating temperature: -40 ℃ ~ +85 ℃
  • Lag: +10%, (RF+ - RF-)/FR+, 1000g force
  • Response time: < 10 ms
  • Drifting: <5%, 1Kg force static load 24H
  • Weight: 1g / 0.04oz (approx.)

Is the boxed thing what I am looking for?

Well, this tells you the resistance is infinite with less than 20 g. So you can only use it with 20 g weight or more. So, perhaps your voltage divider resistance of 100k Ohms may be ok.

okay, but this doesn't explain why the output is ranging from 0 - 800. Do you know what may be going wrong?

Do you have a DMM?
If so can you please read the DC voltage across the FRS as you apply pressure?

Can you please post a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

How are you applying pressure?
You need to apply pressure "evenly" along the FRS I believe.

Can you please post an image of your project, showing how you are applying prressure to the FRS?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

Using 2 analog pins makes NO sense at all. You have a single variable resister, the FSR in series with a second resistor, to make a voltage divider. There is only ONE variable to be read, the voltage across the FSR.

As I always say in these cases RTFM (read the fine manual). To save you some time go to section 24.6.1 in the data sheet.

What this is telling you is that with high input resistance you need a longer sample time to get reasonable answers. If you have a long time between readings you can put a 100 nf capacitor from the voltage divider input to the pin and ground. This will charge up between readings and drive the sample capacitor.

Otherwise you need to change the sample time (sections 24.4 and 24.9.2). If you can't do that you need to buffer the input.

The circuit is working as I would expect. Your expectations are probably incorrect, and the code is wrong, as pointed out above.

the range of the FRS is 0g to 2000g

No, it is 20g to 2000g, but you can't be sure of where the actual value lies within that range.

You have not gotten one FSR to work right, why have two?

I have to have two for my science fair project. Anyways, I think I fixed the bug... It was probably over complicated code and low resistor values and bad cable connections. I think it sorted itself out. thx for your help guys.

With that many problems, you will be back.

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