A sensor is usually an analog device. Analog devices are connected at the analog ports of arduino.
Arduino with the use of AnalogRead function can read the analog sensor value from the specified analog pin.
The Arduino board contains a 6 channel 10-bit analog to digital converter. A 10 bit analog to digital converter as we have seen in the "Binary Decimal and Hexadecimal numeral systems" equals to a 210 – 1 = 102410 (0-1023 => 1024 steps).
If the resolution of arduino (1024 steps) does not cover your project you should use an external ADC converter with more that 10 bits.
For example you can connect the LTC2400 ADC which happens to be a 24 bit analog to digital converter.
By default arduino uses an analog rerferrense of 5V this means that you have a resolution of
5 Volts / 1024 steps = 0 .0049 V/step = 4.9 mV/step.
So we get a diagram like this :
In order to change the resolution you have two options
The command analogReference(INTERNAL); is a built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328 and 2.56 volts on the ATmega8. For the Arduino mega you have to use the command analogReference(INTERNAL1V1); instead.
Notice that with this option you get a higher resolution since :
1.1v/1024 steps = 0,00107421875 v/step = 1,07421875 mV/step
The other option is to use the AREF pin (Analog reference pin). The AREF pin can handle values from 0 to 5V. Of course you should use the command analogReference(EXTERNAL); in order to enable this feature. Notice that AREF voltage must be stable since it will be used as reference.
So the easiest way to increase the resolution of the AnalogRead is to use the first option (analogReference(INTERNAL);)
There are several ways to measure weight. There are indirect methods and direct ones.
The indirect methods can be, for example, a flow sensor (for liquids and gases) or a pressure sensor with the help of a well constructed board with the sensor applied in it.
Let's start with the flow sensor. A flow sensor measures L/min (flow rate Q)
So for a certain time rage we know how many liters (volume) have been passed through the flow sensor.
We know that density = mass/volume.
From this we can indirectly measure the mass knowing the density of the liquid passed from our sensor.
Below is the flow rate formula :
Q flow rate (meter3/sec) = A flow area (meter2) * V flow velocity (meter/sec)
On the other hand a pressure sensor measures the force per unit area applied.
The pressure formula is :
As you can see we cannot measure directly weight with this device.
Notice that a pressure board should be used as a transducer