Once the hardware is assembled you will need to calibrate the output offset and gain of the instrument amplifier. The output offset is a small voltage that will be applied to the output of the amplifier and is necessary to push the amplifier into a stable, linear range. Because the amplifier is being used with a single positive voltage supply (as opposed to a dual supply with positive and negative voltages), the output of the amplifier is limited to a low value of only about 0.3 V above ground. With no weight applied to the load cell the output is likely below this 0.3 V limit so the behavior of the amplifier can be unstable and inaccurate. By applying voltage to the IAref pin on the amplifier (by using a trim potentiometer as a voltage divider) the output of the amplifier will be adjusted up above 0.3 V into a stable range.
To calibrate the output offset, connect your multimeter positive probe to the Vo output pin of the amplifier and the negative probe to ground. Apply power to the hardware and observe the voltage on the output pin when no weight is applied to the scale. Slowly turn the trim potentiometer connected to the IAref pin until the voltage on the output pin is around 0.5 volts.
Next you must calibrate the gain of the amplifier. The easiest way to do this is to place a maximum amount of weight on the scale and adjust the gain trim potentometer until the output of the amplifier is 5 volts (the maximum voltage for the Arduino analog input). A good maximum weight for this project is a cocktail shaker or heavy glass filled completely with water (since this is likely the largest amount of weight to expect in a mixed drink). With the multimeter still connected to Vo and ground, place a glass that is full of water on the scale. Adjust the trim potentiometer connected to the Rg pins until the voltage on the output pin is around 5 volts.
Note: If you see the voltage drop on the output when weight is applied to the scale, swap the V+in and V-in wires (load cell signal wires) and try the calibration again.
After adjusting the gain, double check the output offset with no weight applied is still around 0.5 volts. Readjust both the output offset and gain as necessary to get them near the 0.5 and 5 volt values with no weight and maximum weight.
Below is a summary of the calibration on my hardware:
In this step you'll calibrate the Arduino sketch for the project so it can accurately measure weight applied to the scale. You will need another scale to measure the weight of an object like a glass or shaker to use in the calibration. If you don't have a second scale, look for an object with a known weight like a pile of coins.
Download the software for this project at the following link and unzip the archive to a folder.
Note: If you have a Bluefruit EZ-link hooked up but are uploading over USB, disconnect the power and ground of the EZ-link temporarily so it does not interfere with the upload of the sketch. Also on an Arduino Nano I found it was necessary to remove the Arduino's Vin power pin while communicating over USB (this might not be necessary for other Arduinos).
Open the Arduino serial monitor and change the baud rate to 9600. You should see a message like the following:
Scale Calibration Sketch
Type OK and press enter to start.
If you don't see the message, try resetting the Arduino.
Follow the prompts on the serial monitor and type OK and enter to start.
The calibration will tell you to remove all weight from the scale and type OK and enter to continue.
Next the calibration will tell you to place something on the scale and enter its weight in grams. For example if I had an object that was 120.5 grams I would place it on the scale and type 120.5 and enter to continue.
Finally the calibration will output two values you need to save for use later. For example I saw these values with my calibration:
Calibration finished! Write down the following calibration values:
ZERO_OFFSET = 103.00000
GRAMS_PER_MEASUREMENT = 1.00061
If you type OK and press enter the sketch will enter a loop where it prints the weight (in grams) of whatever is on the scale. Try placing items of various known weights on the scale to confirm it is reasonably accurate. Based on the Arduino's 10-bit ADC and a full glass of water as maximum weight, the scale will only have around 1 gram resolution.
Now load the SmartCocktailShakerSketch in Arduino and adjust the ZERO_OFFSET and GRAMS_PER_MEASUREMENT #define values with the values you found from calibration. Also adjust the ADC_PIN value for your hardware if necessary. Upload the sketch to your Arduino, open the serial monitor at 9600 baud, and confirm if you type ? (a single question mark) and press enter the hardware responds with the weight on the scale in grams.
At this point the hardware is setup and ready to use with the Android application. Continue on to learn how to use the Android application with a USB connection.