> For the complete documentation index, see [llms.txt](https://wvu-neuromint.gitbook.io/neuromint-resources/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wvu-neuromint.gitbook.io/neuromint-resources/technical-guides/strain-gauges/strain-gauge-amplification-circuit.md).

# Strain Gauge Amplification Circuit

Clarus Goldsmith, June 2024

This page will go into how to design a strain gauge amplification circuit that can be balanced in software using a digital potentiometer, using the circuit found here as an example.

## Wheatstone bridge

\<Purpose of wheatstone bridge goes here>

### How to include a digipot in one of the arms

The digipot allows us to balance the Wheatstone bridge in software on data collection startup instead of manually turning a potentiometer. Particularly useful when you have a ton of temperature and humidity sensitive sensors (i.e., the strain gauges) you want to read from across multiple days.

The circuit schematic for the Wheatstone bridge with a digipot included is below. By adjusting the wiper, we adjust the resistance difference between the two arms.

<div><figure><img src="https://2585980925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbT0JvqdvF6kx3gpkbo%2Fuploads%2FgC2IVv3L17DwilvO5oGq%2FScheme-it-export-New-Project-2024-08-21-13-58.png?alt=media&amp;token=c9adec08-f207-4893-9a5a-9b9ad2bc4db6" alt=""><figcaption><p>Circuit diagram for the Wheatstone bridge section of the strain amplification circuit.</p></figcaption></figure> <figure><img src="https://2585980925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbT0JvqdvF6kx3gpkbo%2Fuploads%2FqzFSX5FcJHYKHR3CL8ko%2Fwheatstone%20with%20values.png?alt=media&amp;token=ea071900-3dc7-451f-9db0-87d0b0715332" alt=""><figcaption></figcaption></figure></div>

Note that for this schematic the potentiometer is wired in [rheostat](https://byjus.com/physics/rheostat-and-rheostat-symbol/) mode. This involves "floating" (i.e., not connecting) one of the terminals, and allows the digipot to act as a variable resistor rather than a voltage divider. Digipot manufacturers typically sell versions of their components already wired as a rheostat in the package, meaning you don't have to do anything extra to get it to behave as such.&#x20;

\
To help with analysis, we will create a variable $$R\_{x2}= \frac{1}{1/R\_2+1/R\_x}$$ to represent the total resistance of the two parallel resistors. The equation to balance this Wheatstone bridge is:

$$
\frac{R\_x2}{R\_{1}} = \frac{R\_{SG}}{R\_{3}}
$$

For our example circuit, the grid resistance of a [MMF402103](https://www.digikey.com/en/products/detail/micro-measurements-division-of-vishay-precision-group/MMF402103/9857837) strain gauge is 350Ω, so $$R\_{SG}$$ = 350Ω. 350Ω resistors are weirdly expensive, so we'll instead use a 352Ω resistor. As $$\frac{350}{352}=0.9943$$ our equation becomes:

$$
\frac{R\_{x2}}{R\_{1}} = 0.9943
$$

The digipot we'll use for our example is the [MCP4532](https://www.digikey.com/en/products/detail/microchip-technology/MCP4532T-502E-MS/2061345), a digital rheostat with a total resistance $$R\_{AB}$$of 5kΩ. At startup, the digipot wiper will be at its halfway point, so 2.5kΩ.

Ideally we want the resistance of one tap of the digipot, $$R\_{s}$$, to be approximately 0.1% of the total resistance of the arm to give us enough fine enough precision when adjusting the digipot. From the manual of the digipot:

$$
R\_s= \frac{R\_{AB}}{128}\approx 39\~\Omega
$$

Additionally, we need to choose a resistance value of the digipot for which the bridge will be balanced. For this circuit we'll first the resistance at a tap \~1/4 of the way through the digipot's range, 1753Ω. Thus, our balance equation becomes:

$$
\frac{\frac{1}{1/1753+1/R\_2}}{R\_1}=0.9943
$$

To satisfy our first condition regarding a single tap, we can create a second equation:

$$
\frac{\frac{1}{1/(1753+39)+1/R\_2}}{R\_1}=0.9943+.001
$$

$$
\frac{\frac{1}{1/1792+1/R\_2}}{R\_1}=0.9953
$$

Solving each equation in parallel for $$1/R\_2$$:

| $$\frac{1}{1/1753+1/R\_2}=0.9943R\_1$$                 | $$\frac{1}{1/1792+1/R\_2}=0.9953R\_1$$                 |
| ------------------------------------------------------ | ------------------------------------------------------ |
| $$\frac{1}{1753}+\frac{1}{R\_2}=\frac{1}{0.9943R\_1}$$ | $$\frac{1}{1792}+\frac{1}{R\_2}=\frac{1}{0.9953R\_1}$$ |
| $$\frac{1}{R\_2}=\frac{1}{0.9943R\_1}-\frac{1}{1753}$$ | $$\frac{1}{R\_2}=\frac{1}{0.9953R\_1}-\frac{1}{1792}$$ |

We can then set the two equations as equal to find $$R\_1$$:

$$
\frac{1}{0.9943R\_1}-\frac{1}{1753}=\frac{1}{0.9953R\_1}-\frac{1}{1792}
$$

$$
\frac{1}{0.9943R\_1}-\frac{1}{0.9953R\_1}=\frac{1}{1753}-\frac{1}{1792}
$$

$$
\frac{1}{0.9943}-\frac{1}{0.9953}=R\_1(\frac{1}{1753}-\frac{1}{1792})
$$

$$
0.001=R\_1(1.241e^{-5})
$$

$$
R\_1= 80.55
$$

I also generalized this equation for $$R\_1$$ to make it easier to pick values:

$$
R\_1=\frac{TOL}{\frac{1}{R\_{balance}}-\frac{1}{R\_{balance}+39}}
$$

Where $$TOL$$ is the desired tolerance and $$R\_{balance}$$ is the desired digipot resistance when the Wheatstone bridge is balanced.

At this point, check the available resistor values on Digikey to see if this resistance is feasible. 80.6Ω resistors are available, so we'll set $$R\_1 = 80.6\Omega$$. If resistors for the calculated value aren't available or are too pricey, simply use the next closest one and solve for $$R\_{balance}$$ in our generalized equation for $$R\_1$$ to find where the bridge will now balance.

Now that we've selected $$R\_1$$, we can use one of the equations for $$1/R\_2$$ to find  $$R\_2$$:

$$
\frac{1}{R\_2}=\frac{1}{0.9943R\_1}-\frac{1}{1753}
$$

$$
\frac{1}{R\_2}= \frac{1}{0.9943(80.6)}-\frac{1}{1753}
$$

$$
\frac{1}{R\_2}= 0.0119
$$

$$
R\_2 = 83.97
$$

Similarly as for $$R\_1$$, we next check if this is a feasible value resistor value. The closest resistor value is 84.5Ω, so we set $$R\_2=84.5\Omega$$.

This whole process can be highly iterative, depending on the performance you want from the whole circuit. In the final version of the PCB I designed, $$R\_1 = 80.6\Omega$$ and $$R\_2=85.6\Omega$$, yielding a tolerance of 0.0013 with a balance resistance of 1521Ω.

Thus, for my PCB the Wheatstone bridge schematic becomes:

<figure><img src="https://2585980925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbT0JvqdvF6kx3gpkbo%2Fuploads%2FqzFSX5FcJHYKHR3CL8ko%2Fwheatstone%20with%20values.png?alt=media&amp;token=ea071900-3dc7-451f-9db0-87d0b0715332" alt=""><figcaption><p>The Wheatstone bridge schematic with resistor values for the PCB I designed.</p></figcaption></figure>

## Instrumentation Amplifier

<figure><img src="https://2585980925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbT0JvqdvF6kx3gpkbo%2Fuploads%2Ftt4o02m9ynbqEqn8hPCN%2Fimage.png?alt=media&amp;token=3493f423-f95f-4b5c-80b9-ca8c8ea90cae" alt=""><figcaption><p>The internal schematic for the <a href="https://punchout.digikey.com/en/products/detail/texas-instruments/INA821IDR/10448327">INA821D</a> instrumentation amplifier</p></figcaption></figure>

The instrumentation amp takes the signal from the Wheatstone and amplifies it by a gain value set using a gain resistor put between two of the ports.

### Choosing the gain resistor

The instrumentation amplifier manual will include an equation for calculating the resistor value for a chosen gain. The example circuit uses the [INA821D](https://punchout.digikey.com/en/products/detail/texas-instruments/INA821IDR/10448327) instrumentation amp, which has the gain equation:

<figure><img src="https://2585980925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbT0JvqdvF6kx3gpkbo%2Fuploads%2FIyCAzkRMDWotArc8vZtF%2Fimage.png?alt=media&amp;token=489c2ea7-968d-49fd-af8d-f2b6a673f7b5" alt=""><figcaption><p>Gain equation for the INA821D, taken from the manual</p></figcaption></figure>

Past experimentation to design this circuit has shown that we want gains between 56 and 77 to allow for a nice range of adjustment from the digipot without completely overloading the inst amp. These gains are produced by resistors between 898Ω and 649Ω, respectively. Anything in that range can be used, depending on the use case for the circuit.

### Connection between the Wheatstone bridge and the inst. amp.

The instrumentation amp has two input pins: +IN and -IN. Which arm of the Wheatstone bridge connects to which pin matters. You'll notice that I marked the outputs of the Wheatstone accordingly in the above figures. From my experience:

* The arm including the digipot needs to go into +IN
* The arm including the strain gauge needs to go into -IN

If your design ends up being substantially different than this example, I would build the circuit on a breadboard first to double check the inputs to the instrumentation amp are oriented correctly.

## Other considerations for the digipot

The digipot is controlled using the I2C bus, so will need to be connected to pins D24 and D25 on the OpenCM. Because I2C relies on pulling voltage down to communicate, we need to supply voltage to these connections before they get into the digipot. As covered in the [I2C communication page](/neuromint-resources/technical-guides/i2c-communication-with-arduino.md), a 2kΩ resistor is sufficient for standard I2C speed. Thus, we'll connect a pair of 2kΩ resistors between power and connections from pins D24 and D25. &#x20;

## Other considerations for the inst. amp.

The manual for the instrumentation amp recommends placing a 0.1uF capacitor between the voltage source and the voltage pin, as close to the voltage pin as possible on the physical board.

## Final circuit diagram

<figure><img src="https://2585980925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbT0JvqdvF6kx3gpkbo%2Fuploads%2FTLToE40M8e6PRisODWob%2FScreenshot%202024-08-21%20153804.png?alt=media&amp;token=192bdf19-6b24-4e04-aee5-b402635766d6" alt=""><figcaption><p>Full circuit schematic for a single strain amplifier. The strain amplifiers in the lab are six of these circuits combined.</p></figcaption></figure>
