FSR not showing more than 2047?

Hello everybody,
I followed the link below to setup Raspberry Pi with FSR sensor.

With the help of tech support, I got it to work but unfortunately, the max pressure the FSR produces is 2047. WHat can I change in the setup for it to show higher pressure? Please help, our project is STUCK :frowning:

I tried multiple FSR units but same results .
Thanks for your help!!
Julie

2 Likes

Hi Julie,

Are you looking to get higher numbers from the code or looking to get higher equivalent force values?

1 Like

Hey Liam,
I am collecting force applied on the FSR sensor. The reading doesn’t go beyond 2047. It appears there is a max value set somewhere. I found two other threads that mention the same issue, but I am sure where to modify.

gpio - Strange readings when connecting an FSR to Pi using MCP3008 - Raspberry Pi Stack Exchange

Swap size limited to 2047MB? - Raspberry Pi Forums

Any guidance will be much appreciated. Thanks!!

1 Like

Hey Julie,

Hm, 2047? I am almost certain this doesn’t have anything to do with the FSR.

It is interesting that value 2047 is exactly 11-bits (12-bits if combined with a bit representing signature).

The ADS1015 is a 12-Bit ADC - 4 Channel with Programmable Gain Amplifier, the maximum possible range of values that can be represented in 12-bits is -2047 to 2047 as each bit can either be a 1 or a 0. So with first or last bit representing + or - then the next eleven bits represented in base-10 would have values of:

1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024

Which if all zeros would represent zero, then all ones “unsigned” 2047, with combinations representing every value in-between and the sign bit whether it is positive or negative. This is your maximum level of precision capable with an ADS1015.

However, even with limited precision, you can “read” values from a wider range with the help of gain adjustment, there’s a programmable gain amp on the ADS1015 as stated in the description:

As a nice bonus, it even includes a programmable gain amplifier, up to x16, to help boost up smaller single/differential signals to the full range

All you should need to do is tweak that gain so each increment measured represents a wider/tighter measurement from the FSR, you’ll lose or gain some precision in exchange for a wider or shallower sensor measurement range.

Can you please shoot through the code and library you’re using? Should have a way to change the gain so 2047 actually represents either the maximum value of the FSR, or at least some higher max reading than what you’re getting now.

2 Likes

That’s a good question, but the only coding I have done is what’s in your article. Also, will it help if I get a 16 bit ADC instead? I have no idea how to modify the gain value. Thanks Julie

https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqazIyUFpYaU5jMWFzS2d5MUE1MERJd2YxX1ZoZ3xBQ3Jtc0tuZE0tSWI3S2F2RXdxSzJkRDcwVHZTS3lQMnMyV0xyakJxTUd5WFdDNk5NN2xsUjl5Z3I5ZGJzb1lmM1B1WGhtSzVQR2RHQ09CY2RJdTdubnBnRDFOeWhaMDF3Y1BfQUpIc2lJbVE3cUxWZXA2ejFNMA&q=https%3A%2F%2Fcore-electronics.com.au%2Fguides%2Fraspberry-pi%2Fforce-sensitive-pads-raspberry-pi%2F&v=SX0636jmktM

Just increase the variable GAIN? I’ll give that a try.

Hi @Julie261228 - can you provide a photo of how you have everything wired up, especially around the FSR + resistor

a paste of the code will be helpful too

It could just be that all you need is a change to the gain setting, but pictures really help too

2 Likes

Hey Michael,
I changed the GAIN value but the max value showing up is 2047. Will changing it to 16 bit ADC help?




Hi Julie,

I think you actually want less gain, and I’m not super sure 5 is a valid value looking at the tutorial page

Alternatively, you can adjust the resistor value to skew the voltage output of the FSR to keep it in range of your ADC, try a lower resistance to “pull it harder” towards GND.

James,
How do I adjust the resistor value? in the code? or hardware adjustment? sorry, I am such a newbie
Thanks for your time!!
Julie

Hi Julie,
The resistor value is a hardware adjustment. The resistor you have currently appears to be 80k Ohms.
There are many helpful calculators for determining resistor values.

Hi Julie,

Before you make any hardware changes, that shouldn’t be necessary. Once you change your gain, 2047 isn’t actually representing 2047 anymore, it’ll always max out to 2047 no matter what you do as that’s the maximum signed value that can be represented by 12-bits as I mentioned earlier.

Using a 16-bit adc will instead give you a range of 32767 if signed (2 ^ 15), as it has more bits worth of precision.

When you changed the GAIN to 5 in your earlier code, you’re essentially amplifying/minimizing the representative value of that 2047, exchanging your precision or range for a benefit in the other.

Should just be a straight multiplication/division of values by GAIN to get the actual representative value of each reading (can probably do it in an enumeration on a one-liner pretty easily) if I remember correctly (unless it is a non-linear relationship and I’ve misremembered this which could certainly be the case, please correct me if I’m wrong here :sweat_smile:).

1 Like