# Load Cell, INA128, Uno : Counting coins by weight

Good Evening,

I have been using this tutorial:

http://sciencestuff.xperiment.mobi/2012/04/19/measuring-weight-via-usb-with-electronic-kitchen-scales-and-the-arduino/

to use a load cell from kitchen scales and measure the analogue output reading when I increase the pressure to the load cell. I am counting coins by weight.

I have wired it up exactly as it says and installed the firmata software.

However, the readings I get from Analog5 fluctuate between 18 and 19 even without any pressure applied. I have looked at similar problems on the forum and I am just getting myself confused. (I am an absolute novice at this...op amp theory is something I am still getting my head around).

From what I am gathering, Rg should be less than 10k ohms due to the gain formula G=1+{50kOhms / Rg]. Perhaps I need a higher gain by decreasing the resistance over pins 1 and 8 of the Amp?

What would be a reasonable resistance then?
Am I missing something basic from the tutorial?
Could my soldering be a cause of the problem?

here is the data sheet from texas instruments: www.ti.com.cn/cn/lit/ds/symlink/ina128.pdf

Ultimately I want to plot the data on a graph which correlates voltage over the number of coins, but that's a few steps ahead for now.

Any advice would be greatly appreciated.

James

Hi, did the load cell have a measuring plate that fitted on top of the cell, you have what I think is a zero offset.
Do you get changing readings whent you apply mass to the assembly?
You can do the offset correction externally with a potentiometer or with the sketch.

[soapbox] Sorry but projects like the one you have mentioned worries me when the writer cannot supply a circuit diagram, but connect a to b, c to d, must be a designer from IKEA.[/soapbox]

Tom.....

Hey Tom..

When I put pressure on the load cell there is no change in the reading from A5.

Yes, I realise that I have been using a terrible tutorial

Cheers,

James

Common mode voltage range of the INA128, for 5V operation, is 1.7V to 3.6V (typical) per the datasheet. What that means is that the output of the amp never goes from 0V to 5V -- it goes from 1.7V to 3.6V. This limited voltage range is typical for OpAmps and InAmps.

When setting the gain, with too little gain and you'll always see ~1.7V. Too much gain and you'll always see ~3.6V. That should make sense, right? Because with too little gain you won't see any voltage change and the output will sit at the bottom of the range, and with too much gain it'll just be oversaturated and maxed out. You need to keep fiddling with the resistance that sets the gain until you see a voltage "in between" and then you'll start seeing varying output when you push on the load cell.

Also, in the long run, you'd be better off using an HX711 module or an ADS1231 (or similar). You'll get a lot more precision that way.

InAmps are great for filtering out noise and giving you a nice, clean, amplified signal, but then you're still stuck with the common mode voltage range and the Arduino's 10 bit ADC so you can't get a lot of precision. When you use a simple InAmp you really want to use a high precision ADC with it... and then you're way over the cost of the HX711/ADS1231 options.

Thanks Chagrin, that has helped.

I will do as you suggested.

James

Chagrin:
Common mode voltage range of the INA128, for 5V operation, is 1.7V to 3.6V (typical) per the datasheet. What that means is that the output of the amp never goes from 0V to 5V -- it goes from 1.7V to 3.6V. This limited voltage range is typical for OpAmps and InAmps.

I can't see anywhere on the data sheet that says the INA128 range for 5V operation is 1.7V to 3.6V.

Jamesas:

Chagrin:
Common mode voltage range of the INA128, for 5V operation, is 1.7V to 3.6V (typical) per the datasheet. What that means is that the output of the amp never goes from 0V to 5V -- it goes from 1.7V to 3.6V. This limited voltage range is typical for OpAmps and InAmps.

I can't see anywhere on the data sheet that says the INA128 range for 5V operation is 1.7V to 3.6V.

Actually I was wrong; I was looking at the input range (first row in the table on page 3). The output range is a bit wider, listed in the first row of the table on page 4: it states "(V+) - 0.9" and "(V-) + 0.8" for .8V to 4.1V under 5V operation.

ok cheers!

There are other, much better tutorials. However, a great deal depends on the load cell and its output. The output will change by only a few millivolts when you apply a small weight, so you need a gain of 100 or more, implying a resistance (Rg on the instrumentation amplifier) of a few hundred ohms. In order to set that accurately you will probably need to use a multiturn potentiometer in the range of about 500 ohms maximum.

Finally, if the two outputs of the load cell differ substantially, you have a voltage offset problem that is not easy to solve. If you have a good multimeter, hook up the load cell to +5 and ground (E+ and E- connections) and measure the voltages from ground to the outputs S+ and S-, with and without a test weight applied. Let us know what you find.

jremington:
There are other, much better tutorials. However, a great deal depends on the load cell and its output. The output will change by only a few millivolts when you apply a small weight, so you need a gain of 100 or more, implying a resistance (Rg on the instrumentation amplifier) of a few hundred ohms. In order to set that accurately you will probably need to use a multiturn potentiometer in the range of about 500 ohms maximum.

Finally, if the two outputs of the load cell differ substantially, you have a voltage offset problem that is not easy to solve. If you have a good multimeter, hook up the load cell to +5 and ground (E+ and E- connections) and measure the voltages from ground to the outputs S+ and S-, with and without a test weight applied. Let us know what you find.

Thanks jremington.

I will go out tomorrow and find a potentiometer.

Also, I will go into the electrical workshop and test if my load cell has a voltage offset problem as you suggested. I'll try to update you.

Thanks once again!

James

We used load cells at work so I have some experience with them and have a few pointers and ideas you should consider.
First you shouldn't try and build-in perfect calibration via the op-amp gain, just too many causes of drift and application requirements. It's better to build in a zero, and/or tare function in your software. Tare is the term they use when you want to weigh something that is in a container but only want to know the weight of the material, not the material + container weight. This effectively means you don't require perfect zero bridge output value, just have a software function read a user switch or control to tell your system to use whatever analog voltage it is seeing as the zero value. For gain you should have a calibration function where after you zero the system you place a known calibration weigh on the cell and again have a switch or control to tell your system it's maximum analog input voltage. After that it's a simple map() function to determine the unknown weight to be measured. You could store these bottom of range and top of range values in EEPROM memory if you don't wish to 'calibrate' the system with every use after powering off. I'm probably not explaining this that well, but you are bound to be disappointed if you just assume that the initial zero and gain values set externally by your load cell and op-amp will hold accuracy over time and temperature.

From my experience with these inexpensive load cells he's going to need a gain around 500 (set with 100R) to 2000 (set with 25R). That's a range of just 75 ohms so it's really helpful to have a low ohm pot or you'll go nuts swapping resistors in and out.

Also, considering the Arduino's 10 bit ADC, the imperfect load cell with an existing offset voltage, and the voltage range of the InAmp, he'll only get about 400 points of precision to measure with. It's really helpful to be able to set the gain within a few ohms to get reasonable precision.