DFRobot Gravity: Throw-in Type Liquid Level Transmitter. results are bouncing all over the place

userHead RichardVince 2024-03-20 11:58:06 406 Views5 Replies


I purchased a DFRobot Gravity: Throw-in Type Liquid Level Transmitter in Australia from Core-electronics.

I am using a Wemos D1 Mini but have also tried using an Arduino Uno with the same results. The depth reported back is never stable. The water tank I am measuring is 1600mm tall and the sensor is at the bottom. 

I have wired the Wemos and UNO the same as the example from DFROBOT's Wiki page at. 



The exception is the Wemos only has 1 analogue input at A0.


I have tried several power supplies from 12VDC switch mode plug packs to a 12VDC battery and then also building a 15vDC and 5VDC regulated power supply to power both the sensor and current to voltage converter and the Wemos or UNO boards. I   have attached a schematic of this PSU.


I have also made sure that the sensor has been powered for at least 30 mins as I have read it needs to stablise. Also note if I pull the sensor slowly up out of the water the depth readings do change  but 1. The level is no where near accurate and its still bounces all over the place.


Below is just a short list of the data read by the sensor to the Wemos. These are the depths in mm. You will see that they range from 573.75mm to 594.84mm. The water is still and not moving. The level has not changed at all. The tank is actually full at the moment so I would expect to see a level of around 1500 - 1600 mm.




What can I check. the code I am using for the UNO is below.



#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display


    #define ANALOG_PIN A2

    #define RANGE 5000 // Depth measuring range 5000mm (for water)

    #define VREF 5000 // ADC's reference voltage on your Arduino,typical value:5000mV

    #define CURRENT_INIT 4.00 // Current @ 0mm (uint: mA)

    #define DENSITY_WATER 1  // Pure water density normalized to 1

    #define DENSITY_GASOLINE 0.74  // Gasoline density

    #define PRINT_INTERVAL 1000



  int16_t dataVoltage;

  float dataCurrent, depth; //unit:mA

  unsigned long timepoint_measure;

  unsigned long delayTime;


void setup()


  Serial.begin(9600);       //Start serial port


  Serial.println("Started App");


  delayTime = 30000;      //get depth readings every 30 seconds

  lcd.init();                      // initialize the lcd

  // Print a message to the LCD.




void loop()























void GetDepth(){

 if (millis() - timepoint_measure > PRINT_INTERVAL) {

        timepoint_measure = millis();


        dataVoltage = analogRead(ANALOG_PIN)/ 1024.0 * VREF;

        dataCurrent = dataVoltage / 120.0; //Sense Resistor:120ohm

        depth = (dataCurrent - CURRENT_INIT) * (RANGE/ DENSITY_WATER / 16.0); //Calculate depth from current readings


        if (depth < 0)


          depth = 0.0;






This is just sending the data every 30 seconds to a LCD display and it is bouncing all over the place.


I am 100% positive the power is very stable.


What else can I try. 


I have tried using ultra sonic sensor for getting the tank water level and also using TOF laser sensors. The problem with both these is that they tend to get false readings from the sides of the tank. I was hoping that this pressure sensor would be accurate but alas I think I have wasted $90.









icon Water Pressure Depth sensor with Wemos_schem.zip 92KB Download(0)
2024-04-21 00:27:26

I am facing exactly similar problems. However there are 2 things that help. 

A. Using an ADS1115 16 Bit analog to Digital converter. 

B. Using a moving period array to average out the values. The averaged results are somewhat in the range

 However, calibrating the sensor is still a major issue. It simply doesn't sticks to 1 calibration. At 1 point we get values close to actual depth. But with the same code, when we try the next day the calibration factor needs to be re adjusted. It would be so much help if some one from DF robotics answers some of the queries here and help us using their product. 



userHeadPic Ashish.Kumar
2024-03-24 19:55:34

Hello again,


I managed to add a low pass filter from code and place a filter capacitor on my analog read pin (0.1uF).  The results I got was far more stable than before but still inaccurate.  Below is my low pass filter lines in case you wanna try and by yourself:


     const float alpha = 0.95;   // low pass filtering 5%

     const int resolution = 10;  // resolution could be 10, 12 or 14 bit according your arduino specs

     const float aRef = 5000;   // analog Voltage reference


     rawVal = analogRead(A1); 
     filteredVal = (alpha * filteredVal) + ((1.0 - alpha) * rawVal);      // Low Pass Filter

     voltage = (filteredVal / pow(2, resolution)) * aRef;                     // Calculate voltage according resolution
     dataCurrent = voltage / 120.0;                                                       // Current to Voltage (SEN0262) resistor: 120ohm
     depth = ……. bla bla


And of course you may add a ceramic capacitor of 0.1uf between your A1 and GND.  Keep in your mind that I am taking snapshots every 1 sec and therefore low pass filter is able to correct the values I got in a few seconds.  If you read your sensor every 30sec then the low passed value should be corrected in a long time.


In any case I would be very happy if someone from DfRobot team advise something for our issue.





userHeadPic Leosoft
2024-03-24 00:56:08

Hello Richard,


Today i spent some time doing experiments on my setup but unfortunately i had no luck.   First of all I tried to change the battery with a stabilized 24vdc power supply.  Nothing changed. Then I tried to power my arduino though usb (instead of barrel connector) and therefore my current-to-voltage converter (SEN0262) module and level transducer had different power feed. Nothing changed either. Also tried to test my transducer inside a tall bottle of water.  Of course the values I took back was quite small (as expected to be) but still completely unstable. And finally I tried with my transducer out of the water and even that way, the values I took was from -600mm till 250mm.  


So what I can guess, the problem seems to be independent from the power supply or water pressure. Maybe the there is an issue with termination resistance.  According SEN0262 official documentation there is a 120ohm termination on this device that may be incompatible with our transducers.  A bad termination can cause these kind of results but all this needs further research.


It would be ideal if somebody from DfRobot technical team could give us a suggestion and lets hope we will have a reply from them soon.


Btw… You said that you have read that lots of people have this problem. Can you share some links for this? 





userHeadPic Leosoft
2024-03-22 22:53:55

Hello Richard,


I am experiencing the same issue. My transducer is capable to measure from 0 to 10.000mm (10m) and works from 9 to 30VDC. I am feeding it through a 12V lead-acid battery (fully charged) and also from a stable power supply.  My water depth is 4m and am getting values from 3 to 5m randomly.


My setup has an Arduino UNO R4 Wifi, with a SEN0262 voltage to current converter and the water level transducer. Very similar to KIT0139 (https://wiki.dfrobot.com/Throw-in_Type_Liquid_Level_Transmitter_SKU_KIT0139).  My Arduino powered up from its barrel DC connector with the same 12VDC source as the transducer (if this is not a bad move). 



Looking forward for any suggestion…



userHeadPic Leosoft
RichardVince wrote:

Hi Leosoft.

I have nothing. I have almost given up on this project. Ive tried ultrasonic sensors and TOF laser sensors to detect the water level but they all have a cone of detection that hits the side of the tank and gives false readings. THis is why I was excited for this DFRobot presure sensor.

I have read that lots of people have this problem but all point to bad power. How can you have bad power from a 12v fully charged lead acid battery? I used a lipo battery.


My next step is to maybe buy another SEN0262 current to voltage converter just in case this one is a dud. I must say that the documentation is poor from DFRobot. They even have errors in their schematic. They also mention in the code a 120 Ohm resistor. Is this built in or should we add it to the circuit? 



Also i may look at using a 16bit analog to digital converter ADS1115 which is an I2C device so insead of using the A0 analog pin on the Wemos or UNO as I have read that they are not too accurate. That may help but if it is the current to voltage adapter thats causing the problem or the pressure sensos themselves then I've wasted $$ and time.


Does DFRobot monitor these forums? Why do they not answer?





2024-03-23 08:00:14
1 Replies