# Arduino & HX711 to get strain values

Hi to everyone.

I recently get an arduino MEGA board to make some developments on sensors tin laboratorial environment.

My first project is to develop a system for strain monitoring under rock materials. For this, I purchased an HX711 opamp to do it.

There are tons of posts over the internet about the application of HX711 over load cells. My goal is not to have a force (or stress) but strain (deformation, using strain gauges) which I believe, is more difficult to calibrate.

According to Wheatstone Bridge principle, strain can be calculated from voltage variations (like the load cells) over a quarter bridge (one active strain gauge and a dummy strain gauge for temperature compensation) and the Gauge Factor of the applied strain gauge.

I already got my goal of getting stable (raw) readings but now I have a huge problem: translate the output of Arduino's Serial monitoring, which i believe is a 24-bit integer, to mV in order to calculate strains.

I am a newbie on these adventures... Anyone knows how can I make this translation?

All help will be appreciated.

Thank you

GAP

1 Like

I already got my goal of getting stable (raw) readings but now I have a huge problem: translate the output of Arduino's Serial monitoring, which i believe is a 24-bit integer, to mV in order to calculate strains.

The Mega is driven by 5V and I guess you use that voltage as the reference in your code. The value you get is a 10-bit integer so you can use that value, multiply by 5 and divide by 1024 to get the voltage in mV.
This is true if you use a standard analog input to measure your value. If you use some other circuit, post the schematics!

Yes, the driven voltage is 5V and you have the schematics in the attachment. According to the HX711 user manual:

â€ś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.â€ť

Yes, I am using A0 and A1 analog inputs and a 128 gain.

Given this, can I use the equation that you indicate?

GAP

No, you can't use that formula - that formula is for using the Arduino's ADC. You're not using that. You're using a stand-alone ADC...the HX711.

According to the HX711 datasheet, the allowable differential voltage is +/- 0.5 ( AVDD / gain); so if AVDD = 4.3 v (you could measure it to be sure) and gain = 128, then the allowable (that is, full scale) differential input is +/- 16.8 mV (which is from 0.5 x 4.3 volts / 128).

So if the HX711 gives you the maximum or minimum output value, then the differential voltage at HX711 input will be plus or minus 16.8 mV...approximately (unless you've been sloppy and have a configuration that produces input voltages higher than the allowable). And with zero output, the differential input should be about zero volts.

But you should calibrate it with known loads (or strains).

I noticed that... I've directly applied the formula and the results were completely strange... Than I remember about the opamp and I divided the output by the Gain (128). The results are apparently fine, with an error of approximately 4E-6 strain (my goal is to have a maximum error of 1E-6 strain), which is quite good considering that I have some not so good connections between elements.

In the meantime I'm going to make a validation test (using only strain measurements) and compare the Arduino/HX711 results with traditional data acquisition systems (that costs thousands of euros/dollars).

Hopefully everything will work fine and I am really impressed with the capabilities of this system.

GAP

One of my interests is to use Arduino as a data logger for load cells (to measure forces) and strains using strain gauges attached to samples. For that I had read a lot over the internet and (one more) because of its low cost, I bought a HX711 board.

I've made some tests (my first tests with Arduino) using HX711 + Arduino where I used two strain gauges (one active and the other dummy for temperature compensation) and a Wheatstone bridge completion using 120 Ohm (1% accuracy) resistors. By the way, my strain gauges have 120 Ohm resistance and a gauge factor of 2.033.

I thought that using HX711 this apparatus should work properly and with low effort (probably it does with load cells, but I decided to start in the hard way) but I am now facing with I think is a noise problem.

You can find the schematics here.

My first try to minimize the noise was to properly solder all connections and put all boards inside a closed metal box. In fact, the noise has reduced, however, only on the static situation (with no deformation of the active strain gauge).

My measurement resolution goal is 1E-6 strain and I am using the Arduino's power source of 5V 80Hz data acquisition and 128 gain.

Given this, I make the following questions:

1. The HX711 has a input voltage regulator. Nevertheless, it is better to use a more stable power source (like a 9V battery, for example)?
2. I've read over some internet sites the use of capacitors on A+ and A-, it will work?
3. Am I doing something wrong (well, during my tests, my HX711 heated a little bit, I must say...)?
4. To calculate voltage variation from the strain gauge deformation, i am using the following relation: mvRead = ((rawRead/128)*5)/1024, which gives me the voltage variation in mv. I decided the rawRead by 128 to correct the applied gain. Is this correct?

Thank you in advance for the help that you can give me.

GAP

That should be floating point, not integer, division:
`mvRead = ((rawRead/128.0)*5)/1024`

Thank you MarkT for your help.

Gpaneiroâ€™s post appears to have little to nothing to do with the original topic: â€śnoise-free resolution.â€ť

In fact, it looks like a continuation of his/her quest to figure out how to get mV from the HX711 output, as started in his/her own post here: https://forum.arduino.cc/index.php?topic=485080.0

I suggest the moderators move this discussion there.

Hi guys.

Sorry about possible thread split. However, If you notice, I didn't had the same questions. In this post my only question was about converting raw values to mV. Apparently I could solve this issue. However, during my quest, I really noticed noise problems and, considering an older post about it, to avoid creating a new one about the same issue, I stated my questions there. Given this fact, I made the same question (and linked this post to avoid another upload).

However if I made something against this forum rules, I really apologize.

I am seriously convicted to get my goal. However I would appreciate all the help that you guys can give me. Are my questions not clear? English is not my native language (as you can clearly notice) If you get any misunderstandings, please let me know.

Thank you.

gpaneiro:
I am now facing with I think is a noise problem.
Given this, I make the following questions:

1. The HX711 has a input voltage regulator. Nevertheless, it is better to use a more stable power source (like a 9V battery, for example)?
2. Iâ€™ve read over some internet sites the use of capacitors on A+ and A-, it will work?
3. Am I doing something wrong (well, during my tests, my HX711 heated a little bit, I must sayâ€¦)?
4. To calculate voltage variation from the strain gauge deformation, i am using the following relation: mvRead = ((rawRead/128)*5)/1024, which gives me the voltage variation in mv. I decided the rawRead by 128 to correct the applied gain. Is this correct?

Why do you think you have a noise problem? You have given no information to support that supposition.

1. My tests seemed to indicate that a more stable power source helped, but not much. But you better read the datasheet regarding the HX711â€™s input voltage limits.
2. Your breakout board probably already has a capacitor across A+ and A-. One of the fun things about this hobby is the ability to easily experiment. Why not add a capacitor from A+ to ground and A- to ground, re-run your tests, and post your results (with and without the caps)?
4. No, it is not correct. You still seem to think the formula for the Arduinoâ€™s ADC has something to do with your situation. Post #3 above has everything you need to know to develop the â€śrelationâ€ť (formula).

Regards.

Hello to everyone, could someone explain me how I could get deformation or strain from the output value of the HX711 with Arduino. I saw a lot of videos or codes explaining how to get weight or a voltage, but not deformation. It will really help me because Iâ€™m working in a university project designing a circuit able to measure strain with strain gauges. My electronic circuit is based on a SG, Wheatstoneâ€™s bridge, an HX711 and an Arduino Uno. If someone has got the code or any help to do that one I will really appreciate it. Thank you so much !

Heyy!!

Even I am working on a similar thing. I am using an arduino UNO, hx711, and a strain gauge wheatstone bridge (full bridge with four strain gauges). If you got the code for getting the strain values, please let me know. I don't have much knowledge of electronics.

gpaneiro:
Hi to everyone.

I recently get an arduino MEGA board to make some developments on sensors tin laboratorial environment.

My first project is to develop a system for strain monitoring under rock materials. For this, I purchased an HX711 opamp to do it.

There are tons of posts over the internet about the application of HX711 over load cells. My goal is not to have a force (or stress) but strain (deformation, using strain gauges) which I believe, is more difficult to calibrate.

According to Wheatstone Bridge principle, strain can be calculated from voltage variations (like the load cells) over a quarter bridge (one active strain gauge and a dummy strain gauge for temperature compensation) and the Gauge Factor of the applied strain gauge.

I already got my goal of getting stable (raw) readings but now I have a huge problem: translate the output of Arduino's Serial monitoring, which i believe is a 24-bit integer, to mV in order to calculate strains.

I am a newbie on these adventures... Anyone knows how can I make this translation?

All help will be appreciated.

Thank you

GAP

Hey I am doing basically the same project is there any way i could look at your code ?