Skip to content

A simple PCB to use HX711 module in strain gauge applications.

License

Notifications You must be signed in to change notification settings

maviterlikli/HX711_SimpleBridge

Repository files navigation

About The Project

This is a simple PCB that is designed to work with commonly found HX711 Arduino module. So, this is an extension to the original HX711 module shown below.

This is still under work. Design is finished. However, I am still writing the manual. As you can see, even for first grade electronical engineering students, there is nothing hard or important about this repo, since this is a simple Wheatstone bridge for HX711 module. However, while I work in my university, several students from computer sciences and engineering departments required a simple Wheatstone bridge for strain gauge applications. This was a design for a really primitive strain reader. It will not be useful in data acquisition applications, but it will help you learn if you are a new starter to strain gauge applications. It will, also, give you a great trick to easily calibrate your system or readings. A calibration that does not only calibrates the IC, but calibrates the whole system.

Why do you need a PCB when you can do new-starter-things on breadboard?

Since Wheatstone bridges are highly sensitive, it is impossible to acquire data on breadboards. If you like to see why, build a Wheatstone bridge on breadboard with any 24bit ADC and softly blow on the breadboard. The readings will go crazy. Also, any use of standard breadboard jumpers will have the same effect. This SIMPLE one sided PCB is to minimize such environmental effect.

BE CAREFUL!
This PCB is designed to work with HW-27 Arduino module. However, it will work for the modules that has the same "J1" (see picture below) pin configuration.

Module

(back to top)

Built With

The design and schematics are made in Eagle. I aim to add universal data packages as well. However, if you would like to change the dimensions, packages, or anything else, Eagle is a free software right now.

(back to top)

Getting Started

There are several ways to use the PCB. It mainly depends on your budget and required output quality. NO DOT FORGET that HX711 is not an IC that a medium or advanced strain reader can be designed from. With that in mind, if you want to use the bridge, you can simply produce it however you want, but do not spend too much money on this.

If you are going to use HX711 with load cells, this is not for you. This repo is basically for an adapter to use strain gauges with HX711. A simple extension.

If you are going to use strain gauges and would like to read the ADC data with HX711, please do continue.

After this point, every value, name or component will be refered to the following image, if otherwise not stated. Take the image as reference. Module

Prerequisites

First of all, you need to know basics of Wheatstone bridge, and calculations. If you do not know where to start, HBM provides a good start-up knowledge here. If you already have another source, you can use that as well, but be careful of resistor names, excitation points and reading points. They will vary.

You are required to know how ADC output works. It is simply a bit value converted to decimal, which has the maximum decimal value as maximum voltage and minimum decimal value as your minimum voltage. Maximum and minimum decimal values are dependent on your ADC bit resolution. For HX711, in data sheet it is given as "The output 24 bits of data is in 2’s complement format. When input differential signal goes out of the 24 bit range, the output data will be saturated at 800000h (MIN) or 7FFFFFh (MAX), until the input signal comes back to the input range" So;

800000h will be equal to -8388608

7FFFFFh will be equal to +8388607 in decimal.

Choosing the Strain Gauge

In here, if you already have a strain gauge, use that. However, if you do not have any strain gauges, there are 3 ohm values: 120, 350, 1000 ohms. Choose as you like, but remember you will need to buy resistors according to those values. So be careful if you will be able to supply resistors.

Quality of the strain gauges is totally up to your budget. If this is your first time, buy the cheap ones. However, be careful to get EXACT gauge factor. Without exact factor, you can not convert ADC readings to meaningful strain values. This value is not SAME all over a single product from a single factory. High end suppliers measure and give exact strain gauge factor for every batch of gauges.

You will require following resistors for following strain gauge resistance values.

Assuming quarter-bridge configuration with trimpot as zero-balancer;

Strain Gauge Required Resistors Required TrimPots
Ohm NumberofResistorsxOhm NumberofTrimpotsxOhm
350 Ω 3x330 1x50

Secondly, how we calculate the resistor values is this. Assume R2 to be your strain gauge, so 120 Ω, 350 Ω or 1000 Ω. For the PCB above, (R4+RT/2)/(R1+RT/2) should be equal or really close to R2/R3. In here, if you have a really minor imbalance, it can be corrected by trimpot. You can decide your resistor values like this, or you can use my implementation, which will be based on 350 Ω stain gauges and most common resistor values. BE CAREFUL your choose of resistors will effect the output. So you may need to do more calculations.

So, if we chose 350 Ω strain gauge, and 330 Ω commonly found resistors for R1, R3 and R4, as a trimpot 50 Ω for RT, and set the trimpot to divide resistance 36 Ω to 14 Ω (which 36 Ω should be added serially to R1) system ALMOST balances. So balance equation becomes;

Left Side Right Side
1.063953488 1.060606061

Remaining unbalance can be corrected with trimpot easily.

As a final important note, DO NOT USE your strain gauges without properly gluing it to a proper reading surface. Strain gauges consists of a thin backing layer, which will not stand usage on their on. Find a piece of metal, plastic or anything, apply the strain gauge with a proper and strong adhesive, use strain gauge terminal to increase the cable dimension, and make sure your cables are not going to rip off. It is really easy to damage the cables of strain gauge.

Choosing Bridge Structure

In here, the first thing you need to know is if you are going to need a manual way to zero balance the bridge. This depends on several things like resistor tolerances, ADC gain (PGA) and required reading range. Simply, if you are using high gain with high tolerances, your zero reading may be off scale already. In that case, your system will not work at all.

So, if you are using %5 tolerance resistors with the implementation given in the Choosing the Strain Gauge topic, due to resistor tolerances, there can be up to 0.25 V initial imbalance. However, at the largest reading range, (5 V excitation, 32 gain) HX711 will read voltages between +0.078125 V and -0.078125 V. As you can see, the resistor tolerances will shift your output to out of range. This is why a trimpot is used in the system to zero-balance the bridge.

The only case you can implement the given bridge without trimpot is if you have 0.1% tolerance resistors which are quite expensive. It would not be logical to dump so much money into a system of this quality. So, if you do not know better, use trimpot to zero balance the system, so you can use cheap solutions. Also, in this tolerance calculation, resistance of PCB pathways are neglected. If you include pathway resistances, tolerances, and PCB quality becomes much tighter, meaning even more expensive.

So, if you use

330 Ω resistors for R1, R3 and R4,

350 Ω strain gauge for R2,

and 50 Ω trimpot for RT

you will make the bridge work. However, this implementation will make things a bit harder later on, in calibration, but it will be nothing that a little math cannot solve.

Choosing Shunt Calibration Resistors

Shunt calibration resistors are used to apply a virtual strain to the system. Since the applied values of resistors are known and output can be obtained, system can be calibrated. There is an excellent guide on how to use and calculate shunt calibration. In this implementation, I am going to use 2 resistors, since we have much higher tolerances and not so sensitive bridge. Choosing the resistor values depends on your reading range. It is better to apply higher strains, which means lower resistor values on shunt calibration. However, it cannot exceed the reading range of the ADC. So ideally, if you apply 10 kΩ parallel resistor to system (as RS1 or RS2) you will cause 0.043005 V shift in ADC reading. Since 32 gain measures voltages between +0.078125 V and -0.078125 V, this will work. However, 128 gain and 64 gain will have a reading range of ±0.01953125 V and ±0.0390625 V, respectively. 10 kΩ shunt calibration resistors will not work for 128 and 64 gain, since it will shift the value out of range.

If you do not know which gain you are going to use, 50 kΩ and 100 kΩ shunt calibration resistors will work fine.

(back to top)

List of Components

To use my implementation with 350 Ω strain gauges, you will need;

  • 3 x 330 Ω resistor (prefer metal film, or as low tolerance as can be)
  • 1 x 50 Ω trimpot (prefer as much turn as possible. Usually I use 20 turn)
  • 1 x 2 pin connector (to your preference)
  • 3 x DIP Switch
  • 1 x 50 kΩ resistor for RS1
  • 1 x 100 kΩ resistor for RS2

(back to top)

Preliminary Measurements

This step is the most important step. To have a proper measurement, you have to know your resistor values. You can use a simple multimeter, or anything more advanced. My procedure is as follows;

  1. Measure R1, R3, R4 and RT, and SAVE them somewhere you will not misplace.
  2. (optional) If you want more precision, you can measure the PCB pathway resistances and add them to proper resistor values.
  3. ONLY solder the RS1, RS2 and DIP switch that connects shunt calibration resistors to the main bridge.
  4. Measure the resistor values at the ends of RS2 (be careful R2 should not be soldered yet, or any other components.) in 3 possible states and SAVE them somewhere you will not misplace. 3 possible states are;
    • switch1 (RS1) on, switch2 (RS2) off
    • switch1 (RS1) off, switch2 (RS2) on
    • switch1 (RS1) on, switch2 (RS2) on
  5. You can now solder the remaining parts.

(back to top)

Soldering

It is assumed that the PCB is one sided and components are on the other face of the copper layer. However, since all the components are passive, you can switch sides, except HX711 pins.

BE CAREFUL to follow soldering order given in Preliminary Measurements to obtain best results.

There are 2 elements to every component at a Wheatstone bridge, a resistor and a connector. Connector is to add strain gauge to system, and resistors are static components. So, if you are going to use quarter-bridge, DO NOT solder X1, X3 and X4 connectors, but solder R1, R3 and R4 resistors. To add the strain gauge, DO NOT solder R2 resistor, but solder X2 connector. For other bridge implementations, logic is same. So, you eighter use a connector or a resistor.

Calibration

If you are going to calibrate the system with any other method, or if you do not require a calibration, you may skip this step. But if you need calibration, we will conduct a Ax+B calibration.

To do so, it is required to know shunt calibration resistor values, bridge resistor values and virtual strain that is applied by shunt calibration resistors. Assuming R1, R3 and R4 to be static,

Epsilon_s = -R_G/(F_G*(R_G+R_S))

where;

Epsilon_s : Strain on the strain gauge (m/m) R_G : Strain gauge resistance value (Ω) R_C : Shunt calibration resistor value (Ω) F_G : Strain gauge factor (must be given by supplier)

By conducting the calculation for every state of RS1 and RS2 switch, you will have 3 strain values and 3 outputs from the ADC. You do not have to but you can also add your zero reading (not perfectly zero) to this data set, which makes 4 strain values and 4 ADC outputs (given as Parameters in Usage). Only remaining thing is to linearly convert ADC values to match strain values.

  1. First thing I suggest you to do is a check of system. To do that, take your readings (4 state of switch (R_G), 4 ADC output) and calculate linear regression error. As an alternative, you can use Microsoft Excel (or any other related software) draw the diagram of data as scatter graph, then make Excel to calculate equation and R^2 value. If your R^2 value is really close to 1, you have a good working system.
  2. By applying the calculations above, you should have 4 strain values (Epsilon_s).
  3. Take the values from ADC output that are designated as Parameter: ADCout0, ADCout1, ADCout2, ADCout3
  4. Make a table.
Strain values ADC Outputs
Epsilon_s=0 ADCout0
Epsilon_s RS1 ADCout1
Epsilon_s RS2 ADCout2
Epsilon_s Rs1 and RS2 ADCout3
  1. Calculate the number that you need to multiply and add with ADCout to match with epsilon values.

For example,

Strain values ADC Outputs ADCout x A + B Calibrated Output
0 1000 1000 x -0.00001 + 0.01 0
-0.01 2000 2000 x -0.00001 + 0.01 -0.01
-0.02 3000 3000 x -0.00001 + 0.01 -0.02
-0.03 4000 4000 x -0.00001 + 0.01 -0.03

Readings in this method are always gives results in compressive strain.

Usage

First of all, you need to select a channel, POSITIVE_CHANNEL_SELECT and NEGATIVE_CHANNEL_SELECT switches are made for that. I added this switches and I have not tested it. It is simply to direct signal to channels. This may not be necessary. If you are sure you do not need that, you can short the connections. However, if you are going to use;

If you are going to use channel A,

  • set POSITIVE_CHANNEL_SELECT, 1st to off and 2nd to on
  • set NEGATIVE_CHANNEL_SELECT, 1st to off and 2nd to on

If you are going to use channel B,

  • set POSITIVE_CHANNEL_SELECT, 1st to on and 2nd to off
  • set NEGATIVE_CHANNEL_SELECT, 1st to on and 2nd to off

Make sure switch of RS1 and RS2 are open (is not connected to system) (off).

Then power-up the system and take ADC readings. Turn the trimpot RT until you get a zero or near zero reading. Take a several second stable reading, take the average and save. Parameter: ADCout0

IMPORTANT NOTE: DO NOT use any code that has in-code zero function (tare). Make sure that you are seeing the direct output of the ADC

After you have your zero level;

  • Close switch that is connected to RS1, take a several second stable reading, take the average and save. Parameter: ADCout1
  • Close switch that is connected to RS2, take a several second stable reading, take the average and save. Parameter: ADCout2
  • Close switches that is connected to RS1 and RS2, take a several second stable reading, take the average and save. Parameter: ADCout3

While calibrating, DO NOT change the strain of the material your strain gauge is placed. Make sure there are no external loads on measured part. While closing and opening switches, please wait for system to converge.

After this step, open the switches of RS1 and RS2. Now, you are ready to take your strain reading. In this method, you will convert your readings into meaningful strain values after you completed strain readings. However, after calculating necessary calibration values, you can input those values to your code that reads ADC as well.

(back to top)

License

This is not licensed. You can steal it.

(back to top)

Contact

Fahri Emre Özdemir - @linkedin

Project Link: HX711_SimpleBridge

(back to top)