LowPowerLab Forum

Hardware support => General topics => Topic started by: baxterdavid on April 03, 2014, 12:13:40 AM

Title: Weight based system
Post by: baxterdavid on April 03, 2014, 12:13:40 AM
Hi Guys,

I have a weight scale (only the sensor) connected to an INA125P to measure money, and to my Arduino analog pin 0.

I followed this tutorial: http://www.instructables.com/id/Arduino-Load-Cell-Scale/

The good news is that it is working! I can put a dollar note on the scale and it will give me a good reading. However, I have a question about weighing coins as well. The scale should read like 100 coins, but the scale of the analog system seems to be only small enough to take in like 10 coins. After that it goes off the scale.

* The analog number ranges from 422 (me not touching it) to 900 (me pressing down on it)

Can anyone recommend any suggestions? I have thought of the following ideas if someone could share some light that would be great:

1. Chanding the 10hm resistor when counting coins on the INA125P

2. I heard that the Ardunio has some software syntax that you can change analog inputs, but I'm not sure about that.

Also, can anyone recommend how to stop ripples in the weight system? For example, the reading I get is:

421..422, 425, 421, 421, 421, 423

Any suggestions would be appreciated.

Thanks
Title: Re: Weight based system
Post by: LazyGlen on April 03, 2014, 09:38:07 AM
I think you need to adjust the gain on your amplifier. Assuming you are using a 3.3v Moteino, the analog input pin can measure voltage from 0 - 3.3vdc. The first thing you need to do is determine what the max output signal is from your load cell. These two numbers will determine what gain your amp needs. Lets assume that max signal out is 0.33 volts.

    3.3v (Analog max input)
------------------------------------- = 10  (calculated gain)
0.33v (load cell max output)

Once you have your gain calculated, you need to figure out how to set it on the amp you are using. The datasheet linked in the instructable shows:
QuoteGain of the INA125 is set by connecting a single external resistor, RG, between pins 8 and 9:

60Kohm
----------- + 4 = G
     RG
Note that the datasheet suggests using 1% resistors. Also note that standard resistor values may not produce precisely the gain you want, which may require using a trim-pot to dial in exactly what you want. I don't know how precise you want this to be, temperature MAY affect the values of these resistors, and hence your gain.

Once you get that figured out, add some smoothing to your code to help with the drifting values. This is pretty standard code for inputs like this, basically you average the previous N samples to get a stable result. It's up to you if you want to round off the result or display decimals. Given the dataset you show below,

421 + 422 + 425 + 421 + 421 + 421 + 423
------------------------------------------------------  = 422
                                 7

A nice round number, but if the next sample was, say 425, the new equation and result would be:

422 + 425 + 421 + 421 + 421 + 423 + 425
-----------------------------------------------------  = 422.571
                                7

perhaps not so obvious if you have unitary objects like coins on your scale. Hopefully, the result would settle to a new round number as more samples come in.

Sounds like a fun project,
LG