# Liquid Filling Machine – Liquid Filler Part 4

We have already seen till now how we have constructed our project in PCB .
Liquid filler at this point needs calibration.
The first step is to dimension correctly the RG resistor.
From the weight sensors article we already know that :
a) For a 1Kg load cell we are going to need Gain=1,07421875/0,005473=196 for a 1.1V arduino reference analogReference(INTERNAL); So we need a Rg=312 Ohm.

b) For a 20Kg load cell we need a Gain =  3925 for a 1.1V arduino reference analogReference(INTERNAL);
So we need a Rg=15 Ohm.

The RG values proposed are theoretical. A lot of factors may influence these values. In order to get the real value you want you have to do this :

Select the maximum weight you want to measure. For a 1Kg load cell this should be for example 1Kg .
For a 20Kg load cell we needed a maximum value of 8,5 Kilos.
Firstly power your liquid filler with the weight board. Press or add weight till the analog reading of the weight does not increase any more.
At the 1Kg load cell this value was around 878 (analog read value)
At the 20 Kg load cell again was around 880.

The trick here is to dimension RG in a way that the max weight that you want to measure will stand below the max analog read value, but not too far.
For example the 1Kg load cell at 1Kg with a RG=68 Ohm gave us a 784 value which was around 878 but not higher.
The 20Kg load cell at a (RG = 22+7,5 = 29,5Ohms) gave us a 866 reading at 8,5 kilos.

Notice that at the 3rd article of liquid filler we put 2-pin male headers in order to change easily the RG.
After a few tries you should be able to find the RG value that cover your needs.

As we will see later, each load cell, at least at the beginning, does not have a linear behavior.
So keep in mind that a load cell has a "wake up" limit. Below this limit does not count well or count at all.

After testing we will see that a 1Kg load cell "wake up's" after 180gr till 1Kg.
The same thing happens with the 20Kg load cell. The wake up limit in that case was 1700gr and was linear up to 8,5kg.

A tip here is that if you use a big load cell you can raise your "needed limit". For example if you want to measure from 0-10Kg and you know that the linearity starts at 1700gr (the load cell wake up's at that point) then you can set your max limit at let's say 12Kg (10kg+1700gr). By doing this you have a linear range from 1700gr up to 11700gr => the 10 Kg that you wanted.
This can always be done as you do not reach the load cell limit.

Another trick here is to construct the upper surface of your weight board in a way that its weight equals the  "wake up" limit.

Generally in both cases (1Kg/20Kg load cells) the wake up limit was around 50 and the maximum around 850 (analogread)
So from the 1024 steps we are using effecttively 800points.
This gives a resolution of :
1000gr/800steps = 1,25 gr/step for the 1Kg load cell

and
8500gr/800steps=10,625 gr/step for the 20Kg load cell