4-20mA Level Sensor for Kerosene Tank

I’ve been using an ultrasonic sensor in my Kerosene Tank (Home Heating Oil) for a while now, but was not happy with the stability of the readings. Especially on relatively warm days, as the fumes in the tank seemed to confuse the readings. So I decided to try a different type of sensor, in the form of a 4-20mA Liquid Level sensor. This article shows the setup and compares to the ultrasonic sensor.

 

My search for a replacement sensor was ongoing for several months, as I was relatively happy with the ultrasonic sensor, but I was always on the look-out for something more reliable. The hydrostatic sensors were too expensive, but then I spotted what looked like a decent enough sensor for only €33 on AliExpress.

The Specs looked good, mainly that the range was for 0-5m. My tank is only 1m, but it should be good enough. Here’s some more specs (I’ve highlighted the important ones to me):

Range: 0-5m H2O/50kPa;
Cable Length: 6 meters
Measurement Medium: Water, Diesel, Fuel and Acid;
Power Supply: 9-32VDC;
Output Signal: 4-20mA;
Accuracy: ±0.5%FS;
Overload Capacity: Two times full-scale pressure;
Operating Temperature: -20—120;
Waterproof Class: IP68;
Load Resistance: less than(U-10)/0.02Ω;
Shell Material: 316L stainless steel;
Explosion-proof Type: Exia II CT6;

Seeing as it was a 4-20mA output, I’d also need a converter, so I ordered one of the following, also from AliExpress.

So this converter needs 24V, so I’d also need a boost converter, as I already have a 5V supply coming into the waterproof box that the current converter and Microcontroller is located. Boost comverter for $1.34, again from AliExpress.

Hooking them up is simple enough:

 

I ran the cable through a newly drilled 20mm diameter hole (!) in the top of the oil tank.

In a previous article, I mounted a box on the wall to house the WeMos D1 Mini, and it was a little sparse:

Now thaat I’ve added a few more components, it’s getting to the stage where I need to do a bit of a tidy up:

The software I’m using on the WeMos is (again) the Sonoff-Tasmota sketch by Theo Arends. I’ve modified it to allow use of the HC-SR04 so that the ultrasonic distance and air quality readings will appear on the web interface, and is also transmitted via MQTT, along with the other telemetry that it typically sends (signal strength, up-time, etc).

I still need to fix an issue where the Analog input is not showing on the web interface, but it’s successfully being sent over MQTT protocol to my Node-Red setup, where I’m logging the value to an EmonCMS database for graphing.

So here’s the graph of the raw reading (green) and the converted value to litres. The depth of the kerosene in the tank is currently only about 24cm, so it’s probably at the edge of the transducers sensitivity, as it’s capable of going to 5 metres depth, so it’s a little noisy.

But when you compare it to the ultrasonic transducer, you can see that the depth sensor is a big improvement (ultrasonic is the light line, depth sensor is dark line)

The spike in the ultrasonic reading at the right side of the graph is typical on warm days, so I’m glad to see that I’m getting none of that with the new level sensor.

Once I add a smoothing algorithm, it’ll be spot on.

 

P.S. Just in case you’re interested in what data I’m collecting with the Air Sensor, here’s a quick snapshot of the last week.

%d bloggers like this: