Hi Guys,
I am testing my RP-S40-ST force sensor with my ESP32 and while reading about this sensor, it has a range of 10g-10 Kg but when I am measuring I can only reach a value of 4095 (not sure about the unit but I attached a photo of the readings) but I can easily reach it just by making a bit of pressure with my fingers so I think I am not doing a force of 10 kg.
Do you know if I am limiting the sensor or the reading? How can I read the force/kg and see that I can reach 10 kg with this sensor?
Images of code are nearly worthless. We can't copy the code to an editor or the IDE for examination. Please read the forum guidelines to see how to properly post code and some information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Serial monitor output should be copied and pasted into a post as text, not a screen shot, please.
Ok thank you for explaining this. I think now its possible to use the code to check my question.
Hope you can help
/*
* This ESP32 code is created by esp32io.com
*
* This ESP32 code is released in the public domain
*
* For more detail (instruction and wiring diagram), visit https://esp32io.com/tutorials/esp32-force-sensor
*/
#define FORCE_SENSOR_PIN 36 // ESP32 pin GIOP36 (ADC0): the FSR and 10K pulldown are connected to A0
void setup() {
Serial.begin(9600);
}
void loop() {
int analogReading = analogRead(FORCE_SENSOR_PIN);
Serial.print("The force sensor value = ");
Serial.print(analogReading); // print the raw analog reading
if (analogReading < 100) // from 0 to 99
Serial.println(" -> no pressure");
else if (analogReading < 1500) // from 100 to 1499
Serial.println(" -> light touch");
else if (analogReading < 2500) // from 1500 to 2499
Serial.println(" -> light squeeze");
else if (analogReading < 3500) // from 2500 to 3499
Serial.println(" -> medium squeeze");
else // from 3500 to 5000
Serial.println(" -> big squeeze");
delay(1000);
}
Try replacing the 10K resistor with a 4.7K or 1K and see if that makes a difference. That will change the sensitivity.
I just tested with my FSR, a 4.7K load resistor and ESP32 with your code and get pretty good results. My FSR may not be the same as yours so you still may need to experiment a bit.
Ow awesome I don't have one with me but I will check this. I tried to remove the 10k resistor but the system works without it and the values are the same. Did you get a value higher than 4095? Do you know which unit is it? I can easily reach the higher value (4095) just by clamping the sensor without to much force so I am definitely not reaching the limit of 10 Kg....
If you do not have a 4.7K resistor, just put 2 10K resistors in parallel. That will result in 5K. Close enough.
I get a maximum of about 4070 as hard as I can press with my thumb. That is probably because the FSR never can get down all the way to 0Ω.
The ESP32 Analog to Digital Converter (ADC) is a 12 bit converter so the maximum output is 4095. If you got more than that, something is weird. You are wiring the FSR to 3.3V, right? NOT 5V?
Hi @groundFungus sorry for the late answer. I am actually using a USB cable connected to the laptop so 5V (not sure if I am answering correctly to your question).
Oh ok, I didn't know 4095 was the maximum because I want to weigh objects from 1Kg to 8 Kg and have different values but I always have the same for those - 4095. I was reading about what you mentioned a 12 bit has a 2^12 = 4096 so that's what I am reading. That makes sense and is out of my little knowledge of this topic. If I would like to measure weight with such a sensor, should I buy a different ADC or a different sensor? Since the sensor says that has a range until 10 Kg, I thought I would be able to measure 8 Kg objects...
That kind of sensor is not really suited to weighing objects with any accuracy. Their output depends on pressure and the amount of area that the pressure is applied. And they are not very linear. It is just their nature.
If you want to weigh something, get a load cell and amplifier. Those can be very accurate once calibrated. I bought one of these and using my kitchen scale as a standard, calibrated it, and it works really well. Use the library mentioned in this tutorial and it is easy to interface and use them.
If your issue is solved, please mark the thread as solved so that other members that wish to help will not waste their time opening the thread only to find that you no longer need help.