Calibrating Sensor Water Level (funduino)

Hi, i have problem when calibrating sensor water level. I have took data and get value slope and intercept for linierization. I use sensor water level (rain drop sensor). But, i can’t get best value in my code. Please help me. :slight_smile:

there is my code.

#include <LiquidCrystal.h>
LiquidCrystal lcd(10, 9, 8, 7, 6, 5);
float value;
float Ketinggian;
float voltw;

void setup()
{
  Serial.begin(9600);
  lcd.begin(20,4);
}
void loop()
{
  value = analogRead(A0); //Read data from analog pin and store it to value variable
  voltw = ((value*4.3)/1023);
  Ketinggian = (((voltw*1.218905053)-0.565117967));
  Serial.print("Ketinggian");
  Serial.println(value);
  Serial.println(Ketinggian);
  lcd.setCursor(0,0); 
  lcd.print(value);
  lcd.setCursor(0,1);
  lcd.print("Level=");
  lcd.print(Ketinggian);
  delay(1000); // Check for new value every 5 sec
}

But, i can't get best value in my code.

Why not? What is the problem?

Hi, i have problem when calibrating sensor water level.

Please, answer to the following questions in order receive reasonable solutions to your problem from
Forum Members:

  1. How do you define Rainfall Intensity:(Is is continuous or discrete?)
    (a) Heavy Rain, (b) Moderate Rain, (c) No Rain, and (d) anything else

  2. What DC voltages do your Rain Drop Sensor produce in response to the discrete
    excitation of Step-1?

  3. Is your Learning Kit (Funduino) use ATmega328 MCU?

  4. Refer to your code : voltw = ((value*4.3)/1023);
    From where have you got 4.3? If the MCU is of type ATmega328, it should be 5V or 1.1V.

  5. Refer to your code: Ketinggian = (((voltw*1.218905053)-0.565117967));
    This is a response equation of a sensor whose output varies continuously.
    Your Rain Drop Sensor (If Step-1 is True), your Rain Drop Sensor is a discrete one.

  6. The attached file extracted from the net might be helpful for you.

  7. If your Rain Drop Sensor is a continuous one, abide by the following steps for the
    correct calibration of your sensor.

(a) You are saying that you have problem in calibrating your sensor.

(b) We assume that you are doing two-point calibration; the sensor is real (not ideal) and linear.

(c) You need to have known excitation-response (e, r) parameters for two known points:
A(e1, r1) and B(e2, r2). The 3rd unknown-point is Q(e, r).

(d) The excitation could be Voltage/Level/etc. (the independent variable); the response
(dependent variable is usually an electrical quantity that can be processed by MCU.

(e) Find the response equation of your sensor as: r = me + c.

(f) Write codes to implement the equation of Step-5.

(g) Your sensor must measure the correct value of the unknown parameter of interest

rain_sensor_module.pdf (420 KB)

thank you very much for your reply ^^

  1. d. i use this sensor for measure high level of water

  2. i don't understand about this question, ^^ but the point is when the sensor is inserted into the water the deeper the higher the value of ADC and VOut

  3. no, this is my sensor
    http://www.haoyuelectronics.com/Attachment/Water_Level_Sensor/Water_Level_Sensor_3.jpg

  4. the value 4.3 from Vin arduino,

  5. I get that value when retrieving data with the smallest error then I use linearization method slope and intercept. is there any other way?

  6. I've been looking for from many sources but still not met :smiley:

  7. it seems like the slope intercept method

thank you very much ^^

  1. You are using Continuous Sensor.

  2. Go for 2-point calibration.

  3. Insert your sensor to a known water depth-1 (say, 1 metre).
    Record A (1, ADC1) // to record ADC1, you may connect your PC and use Serial.println()

  4. Insert your sensor to another known water depth-2 (say, 1.5 m)
    Record B (1.5, ADC2)

  5. Your unknown depth: C(d, ADC).

  6. Use data of Step-3, 4 and find equation for d = f(ADC) + c
    If you do correctly, the equation must be same as your one -
    Ketinggian = (((voltw*1.218905053)-0.565117967));

    value = analogRead(A0); //Read data from analog pin and store it to value variable
    voltw = ((value*4.3)/1023);
    Ketinggian = (((voltw*1.218905053)-0.565117967));
    
    voltw = (value*5)/1023
            = analogReda(A0)*5/1023
            = ADC*5/1023