# Force sensor reading values Raspberry Pi [duplicate]

I have this force sensor: http://www.robofun.ro/docs/2010-10-26-DataSheet-FSR400-Layout2.pdf

I need to connect it to a digitial pin of a Raspberry Pi. In order to do that I want to use a polarized capacitor of 1μF measuring the frequency of the capacitor discharges.

However I don't know exactly How can I connect the pieces, is the following scheme ok? If yes, what vlue should R2 take?

Thank you!

simulate this circuit – Schematic created using CircuitLab

No, that circuit is a mess. Forget about it and step back to the real problem.

You want to measure a resistance varying over a wide range, like a few 100 Ω to a few 10s of kΩ.

You have decided to do that with a digital input by measuring how long a capacitor takes to discharge. Such schemes can be made to work, but are tricky to get right. The biggest problem is that the digital input switching level is very loosely defined. It will vary considerably from one unit to another, and over temperature and probably some over time too. Then there is the problem that unless this is specifically a Schmitt trigger input, it probably doesn't like being held at intermediate levels for very long.

Considering your electronics level as exhibited by your proposed circuit, just us a A/D input. Make a resistor divider from the pressure cell and a fixed resistor. This divider takes the power voltage and ground, and makes a voltage in between, depending on the relative value of the pressure cell to the fixed resistor. Feed this voltage into a A/D input, and the rest is math.

This method will have the highest resolution when the pressure cell resistance is equal to the fixed resistance. The resolution will fall off from there to either end. Pick the fixed resistance to be near the middle of the range you care about, or at the point you want particularly good resolution.

If whatever A/D inputs the processor has don't have enough resolution to resolve what you want over the whole range, use a external delta-sigma A/D. These have high resolution (20 bits is readily available) and can be connected to a few digital I/O pins, like over a SPI or IIC bus. Their main drawback is that they are slow, like 10s of ms per conversion. However, that doesn't sound like a problem for a pressure cell unless you are doing something unusual.

• Which shows how the RPi is a poor choice: It doesn't come with any AD – PlasmaHH Feb 29 '16 at 12:41
• @Plas: In that case, either use a external A/D, preferably a delta-sigma, or use a real microcontroller. – Olin Lathrop Feb 29 '16 at 12:51