In this step the Arduino sketch will be calibrated to report the volume of measured liquid. To get started, download the software for this project from the following link:
Unzip the archive and load the LiquidSensor sketch in Arduino. This sketch will read the raw sensor resistance and help you calibrate for volume measurements.
At the top of the sketch you can adjust the following #define values based on your hardware:
Resistance: 1963.70 ohms
Calculated volume: 0.00000
The resistance value is the measured resistance of the liquid sensor. With no liquid touching the sensor it should read a value around 1500-2000 ohms (depending on the length of the sensor).
Try pressing the sensor in various locations to see how the resistance changes. If you touch near the top of the sensor at the MAX line you should see a resistance around 200-400 ohms.
To calibrate the sensor for measuring volume, you will need to measure the following:
Once you've determined the above calibration values, update the #defines at the top of the sketch appropriately:
If you're not using an Arduino Yun, the software setup is done and you're now able to read the volume of liquid in the container. Consider adding a display, like this small OLED, to show the measured volume!
If you're using the Yun, continue on to learn about how to setup the Yun to display volume data on a web page.
At the top of the sketch you can adjust the following #define values based on your hardware:
- SERIES_RESISTOR - This is the value in ohms of the resistor you attached to the hardware in series with the sensor. This should be 560 unless you used a different resistor value.
- SENSOR_PIN - This is the analog input pin which is connected to the sensor.
Resistance: 1963.70 ohms
Calculated volume: 0.00000
The resistance value is the measured resistance of the liquid sensor. With no liquid touching the sensor it should read a value around 1500-2000 ohms (depending on the length of the sensor).
Try pressing the sensor in various locations to see how the resistance changes. If you touch near the top of the sensor at the MAX line you should see a resistance around 200-400 ohms.
To calibrate the sensor for measuring volume, you will need to measure the following:
- The resistance value with no liquid touching the sensor.
- The resistance value when a known volume of liquid is touching the sensor.
- The volume of liquid used to find the above resistance value.
Once you've determined the above calibration values, update the #defines at the top of the sketch appropriately:
- ZERO_VOLUME_RESISTANCE - Set this to the resistance value with no liquid, in my case 1963.70.
- CALIBRATION_RESISTANCE - Set this to the resistance value with a known volume of liquid, in my case 512.81.
- CALIBRATION_VOLUME - Set this to the volume of liquid, in my case 500.00 milliliters (you can use other units, but milliliters are what the web application expects).
If you're not using an Arduino Yun, the software setup is done and you're now able to read the volume of liquid in the container. Consider adding a display, like this small OLED, to show the measured volume!
If you're using the Yun, continue on to learn about how to setup the Yun to display volume data on a web page.
Page last edited April 10, 2014
Text editor powered by tinymce.