Level and flow from a 500liter oil tank

Hi there!
A friend has one of those plastic tanks out in the field his diesel motor to pump his water irrigation system for his crop.
As he have these tanks out of sight and control, and too many people work in the fields...he needs to monitor both parameters:
1.-Oil flow to the motor (how many liters/hour)
2.-Total oil in the tank.

For the first one, it's important to realize that diesel engines use very little fuel, so the flowmeter should be good with slow floes

For the second one, my first idea would be an ultrasound level module, but it would imply getting this module into the tank and it might eventually get flooded when they top the tank. So I was thinking in a pressure transducer to be installed at the bottom of the tank, but I don't know if this is usual, and if so, what type of them should be used

Any help will be appreciated
Thanks

Have you seen this recent thread - http://forum.arduino.cc/index.php?topic=525176

Yes, actually I had replied to it, but I don't see replies to my questions there.
Thanks

For (2) there are different options, one that is often used is simply measuring the weight of the tanks with loadcells. However this is not always possible due to construction limitations.

A distance meter that is based on sound pulses could work but I gues that the speed of sound through oil damps can be different from standard air.

For (1) one must find a flow meter that can handle oil, diesel is not too aggressive but still. Could be pricey

Electric sender made for the purpose

How often do you need to know the flow rate? If you can measure the tank level go down for an hour then litres per hour is easy to calculate.

My rate.h (below) is more flexible. You can feed it readings as often as you like and then ask for different averages: last-ten-minutes or whatever you want. Note this was intended to run on a Teensy 3.2 which has a lot more memory than a standard Arduino.

/************************************
 * rate.h
 * 
 * Create a class for the tank-usage rate calculations
 * 
 * This will encapsulate the data storage and the functions that manipulate the data
 * 
 * Store up to 300 readings of historical data with timestamps.
 * Discards readings if you feed it too rapidly (sample rate is configurable)
 * Output the rate over time in units per hour
 */
#define NUMRATESAMPLES 300
#define MINRATESAMPLES 2   //don't produce an output until we have this many values stored
#define DEFAULTSAMPLERATE 2000 //milliseconds, minimum gap between samples
class Rate {
  public:
    void begin();
    void store(float V);
    void store(char *S);
    float ratePerHour(int minutes);
    int getSampleRate();
    void setSampleRate(int r);
  private:
    float Value[NUMRATESAMPLES];
    unsigned long Time[NUMRATESAMPLES];
    unsigned long SampleRate = DEFAULTSAMPLERATE;
    int CurrentIndex = 0;
    bool OutputIsValid = false;
};
/****************************
 * rate.c
 * 
 * Implementation of rate class
 * 
 */
void Rate::begin() {
  for(int i=0; i<NUMRATESAMPLES; i++) {
    Value[i] = 0;  
    Time[i] = 0;
  }
  CurrentIndex = 0;
  OutputIsValid = false;
}

void Rate::store(float V) {
  //store a value in the array with the current timestamp
  //Discard readings taken too often (too close to previous sample)
  unsigned long Now = millis();
  if(Now-Time[CurrentIndex] < SampleRate) return;

  //Move current index to the next available slot
  CurrentIndex++;
  if(CurrentIndex >= NUMRATESAMPLES) CurrentIndex = 0;
  
  Value[CurrentIndex] = V;
  Time[CurrentIndex] = Now;
  if(CurrentIndex >= MINRATESAMPLES) OutputIsValid = true;
}

void Rate::store(char *s) {
  //take a string, convert it to float and store it
  store(atof(s));
}

float Rate::ratePerHour(int m) {
  //return the rate over the last m minutes (or as long as we have data for)
  //rate is final-initial, so the tank usage display will flip the sign to show positive
  if(!OutputIsValid) return NAN;

  unsigned long Now = millis();
  unsigned long DurationMillis = m * 60000L;

  //walk backwards down the array until we find a timestamp more than m minutes older than the current one
  //if we hit zero,zero the array is not full yet - just use the earliest value&time
  //if we wrap all the way back to CurrentIndex then our storage array isn't long enough to 
  //show the requested number of minutes. Return NAN in that case.
  int i = CurrentIndex;
  bool Found = false;
  while(!Found) {
    i--;
    if(i<0) i = NUMRATESAMPLES-1; //wrap around the end of the array
    if(i==CurrentIndex) return NAN; //we searched the whole list and didn't find a reading old enough
    if(i==0 && Time[i] == 0) {
      i=1; //not enough values; use the first one
      Found = true;
    } else if(Now-Time[i]>DurationMillis) {
      Found = true;
    } 
  }
  return 60.0*60*1000 * (Value[CurrentIndex]-Value[i]) / (Time[CurrentIndex]-Time[i]);  
}

void Rate::setSampleRate(int r) {
  //configure the sample rate (discards values stored more often than this)
  SampleRate = r;
}
int Rate::getSampleRate() {
  return SampleRate;
}

If there is an access port at the bottom of the tank, you might use a low range pressure transducer. Can you post a drawing of tank (height mainly), pump, pipe connections, how the tank is filled, etc.

Hi, edugimeno.

Lets explore this a bit more. Does your friend have ONE engine or more than one? How will your friend know what the fuel flow and the remaining fuel amount are if he is away from the engine? What happens if the engine runs out of fuel? On my Kubota, it is a real bother to bleed the air from the system before the engine will start.

IF this was my irrigation operation, I would just check and replenish the fuel at specific times. Then the only problem is to know if there was a failure of some type to stop the irrigation from working.

Paul

Perhaps the "too many people" are stealing fuel? Then a usage-rate alert would be useful and it won't show up on the flowmeter going to the pump.

Plus make the monitoring unit ping home every 10 minutes in case it gets stolen too.

MorganS:
How often do you need to know the flow rate? If you can measure the tank level go down for an hour then litres per hour is easy to calculate.

...

My issue in this case is not about programming but about choosing the right sensors, thanks

outsider:
If there is an access port at the bottom of the tank, you might use a low range pressure transducer. Can you post a drawing of tank (height mainly), pump, pipe connections, how the tank is filled, etc.

I don't have any picture here but it is mainly a squared block of about 1m x 1m x 1m (so maybe it's 1000 liters, not 500).
The fuel pipe is attached to the bottom (expectable :slight_smile: ) so I guess I can attach a pressure transducer at this point, and it will have the same pressure as anything that's at "bottom height", but I need to find a transducer with such a sensible range to detect changes in a total range of 1m. This one may be easy, but the flow meter for such a slow flow is going to be harder...
The tank is filled from the top, thru a large cap. I can't use ulstraound sensors on the top as they would get flooded when they top the tanks, I can't expect the workers to stop filling right before the oil touches the sensors..

Paul_KD7HB:
Hi, edugimeno.

Lets explore this a bit more. Does your friend have ONE engine or more than one? How will your friend know what the fuel flow and the remaining fuel amount are if he is away from the engine? What happens if the engine runs out of fuel? On my Kubota, it is a real bother to bleed the air from the system before the engine will start.

IF this was my irrigation operation, I would just check and replenish the fuel at specific times. Then the only problem is to know if there was a failure of some type to stop the irrigation from working.

Paul

He has ONE engine at each dieles tank. My solution will measure the level and instant flow and report it to the cloud using Sigfox.
I don't need my solution to find out if it runs out of fuel, there's always an operator by the engine who is in charge of the whole irrigation system, changing valves, etc...
This guy has too many workers in charge of these systems and he can't really trust them all, sometimes the fuel...seems to disappear too quickly, too much for those engines, so maybe the operators cars are getting some free fills...you know

MorganS:
Perhaps the "too many people" are stealing fuel? Then a usage-rate alert would be useful and it won't show up on the flowmeter going to the pump.

Plus make the monitoring unit ping home every 10 minutes in case it gets stolen too.

Well actually you nailed it. The operators get there every morning, start the engine, move the valves to start watering every zone, and when the tank runs low, they, themselves, call the truck to get the tanks refilled, they pay the oil and get to the office to get their ticket reimbursed. And this, time 15, as this guy has several fields with different people working on them all, and he can't trust them all.
He needs to see by himself the actual level in all the tanks, and he needs to see if there's "suddenly" and instant drop in the level, not correlated to actual consumption from the engine

Perhaps we are overly complicating the problem. The Diesel engines running irrigation pumps are either not running or are running at a constant speed.

If we determine the fuel usage of the engine per hour or minute and can measure the time it is running, we have come pretty close to the fuel usage for that time.

IF all the engines and pumps are the same, then the rest is pretty simple and can be duplicated for each engine. If not the same, then fuel usage per hour must be computed once per site.

Most of your engines will have an electrical system for starting and will have an hour meter for timing of needed maintenance. Are you able to determine engine operation for the hour meter or battery charging system? You have not mentioned how you would power the remote fuel level device. Now is the time.

This scheme requires a way to know if the engine is running or not.

Paul

edugimeno:
My issue in this case is not about programming but about choosing the right sensors, thanks

That is the point. With a good specification you can select the right sensors. From what you have said so far I think there is no need for a flow sensor.

An ultrasound sensor can be installed inside an inverted cup so it always traps a bubble of air and the sensor is not drowned in fuel. The cup may even be below the "full" level of the tank.

MorganS:
An ultrasound sensor can be installed inside an inverted cup so it always traps a bubble of air and the sensor is not drowned in fuel. The cup may even be below the "full" level of the tank.

Yes but this means we totally modify the tank. I don't need to alter the tanks and I don't want to run the risk of being blamed for leaks next year. A solution that measures the pressure at the out take seems very safe to me as all I need to do is screw a section of pipe to the tap at the bottom. This pipe would contain the pressure sensor and another tap. The the first tap would be left open all the time (so the sensor always see the pressure) and everything should be done at the second tap

Paul_KD7HB:
Most of your engines will have an electrical system for starting and will have an hour meter for timing of needed maintenance. Are you able to determine engine operation for the hour meter or battery charging system? You have not mentioned how you would power the remote fuel level device. Now is the time.

These engines are the simplest devices in the world..They are diesel, you know that means. They are totally mechanic->autonomous. They don't rely on electricity except for starting up (12V starter motor). They don't have any electric panel of any sort, just an ignition key
I'm planning on using this 12V battery that's sitting by the engine to power my device. It's being charged by al anternator all the time the engine is running.
I may have to check if the alternator has this "exciter" cable that some of them have (like the one that used in old cars to light up the "no alternator" warning sign on the dashboard). This one may be used to monitor the hours that the ingine is running.
Then the level of the tank would be monitored by the pressure at the tank tap. I need to find a pressure transduce that fits this range (0->0.8 bar Relative pressure)

edugimeno:
1.-Oil flow to the motor (how many liters/hour)
2.-Total oil in the tank.

Fuel flow:
There are fuel flow sensors / ‘senders’ for aircraft and boats; I did look, but you really don’t want to know how much the aircraft ones are :o

I’d look for a Capacitive level sensor:
I can’t for the life of me find the one I know of (used in some Gyroplane fuel tanks)
This is like it, but only 2ft long:MGL CAPACITANCE FUEL LEVEL SENDER

While googling also found: ( some are ‘Industrial’ == ‘Expensive’ ):

Paramotor-Fuel-Sensor-and-Gauge Make your own !

fuel-level-sensor

tll-capacitive-level-sensor

or non-capacitive:
400mm Fuel-Oil-Sensor

Yours,
TonyWilk

Ok, so cut down the parts cost as much as possible, I've kept investigating and this is the solution I've come to:

  1. To sense the current diesel level in the tank: SENSOR This sensor has a total range of 5 PSI, 1m column of diesel in the tank would generate a pressure at the bottom of 1.18 PSI, which is pretty good for the range (4 times the total range is not a bad precision loss)

  2. To calculate the fuel flow, I will ask my friend if we can just detect the engine running state. I will see if the alternator has the excitation wire (puts out 12v when running, used to activate the dashboard light when alternator is not generating), and we will just measure this voltage and send it along with the main battery voltage, which is good for them also to prevent running out of batteries if they ever leave a motor not running for a long time or a battery is close to its end of life

How do you guys see it?

Thanks all!

Hi,

there are several possibilities available. The Company I'm working for is producing them + Software+ Hardware +plus Monitoring System. Exactly what you need. Drop me message and I can send you some detailed information