This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tank level monitoring
#31
Sure, I'll have to dig up the Arduino sketch I used, but it's extremely simple. Let me see if I can put something together for you.

It may not be super quick as my boat just came out of the water and I need to be at the yard to do work on it!

I found the sketch. Basically, for a sensor, you get a piece of plastic rod the depth of your water tank, and put rings of copper on the very bottom, then at three other places farther up the rod (low, med, full...). Those come back to your Arduino (the bottom contact is ground). As the water level rises, each sensor contact is brought low, which activates the associated LED. Also on your arduino, you attach LEDs to indicate levels. In my case, I used Green, Green, Yellow and Red in a descending row in a little box. 

Code:
*
 Level Sense
This is a water level detector for a tank. It uses a plastic rod with contacts up the length

*/

// set pin numbers:
//Below bottom sensor
const int ledPinRed =  13;
//Above bottom sensor
const int ledPinYellow = 12;
//Above middle sensor
const int ledPinGreen1 =  11;
//Above top sensor
const int ledPinGreen2 =  10;

//Sensors
const int sensorPinLow = 9;
const int sensorPinMed = 8;
const int sensorPinHigh = 7;

int sensorTotalValue = 0;
int sensorValueLow = 0;
int sensorValueHigh = 0;
int sensorValueMed = 0;

void setup() {
 pinMode(ledPinRed, OUTPUT);
 pinMode(ledPinYellow, OUTPUT);
 pinMode(ledPinGreen1, OUTPUT);
 pinMode(ledPinGreen2, OUTPUT);
 pinMode(sensorPinLow, INPUT_PULLUP);
 pinMode(sensorPinMed, INPUT_PULLUP);
 pinMode(sensorPinHigh, INPUT_PULLUP);
 
 Serial.begin(9600);
 Serial.println("Welcome to the level sensor");
}

void loop() {
 //Reset the sensors
//  int sensorValueLow = 0;
//  int sensorValueHigh = 0;
//  int sensorValueMed = 0;
 // read the state of the sensor values:
 
 if (digitalRead(sensorPinLow) == HIGH) {
   sensorValueLow = 1;}
   else {
   sensorValueLow = 0;
 }
 if (digitalRead(sensorPinMed) == HIGH) {
   sensorValueMed = 1;}
   else {
   sensorValueMed = 0;
 }
 if (digitalRead(sensorPinHigh) == HIGH) {
   sensorValueHigh = 1;}
   else {
   sensorValueHigh = 0;
 }
 sensorTotalValue = sensorValueHigh + sensorValueMed + sensorValueLow;
 
 Serial.print("Sensor Value: ");
 Serial.println(sensorTotalValue);
 
 // make sure all the lights are out
  digitalWrite(ledPinRed, HIGH);
  digitalWrite(ledPinYellow, LOW);
  digitalWrite(ledPinGreen1, LOW);
  digitalWrite(ledPinGreen2, LOW);
 
 // then turn on the right lights
 switch(sensorTotalValue) {
   case 3:
      //Absolutely low. Flash the red led
     digitalWrite(ledPinRed, LOW);
     delay(500);
     digitalWrite(ledPinRed, HIGH);
     delay(500);
     break;
   case 2:
   //Yellow Light only
     digitalWrite(ledPinYellow, HIGH);
     break;
   case 1:
   //First green light and yellow
     digitalWrite(ledPinYellow, HIGH);
     digitalWrite(ledPinGreen1, HIGH);
     break;
   case 0:
   //Two green lights and yellow
     digitalWrite(ledPinYellow, HIGH);
     digitalWrite(ledPinGreen1, HIGH);
     digitalWrite(ledPinGreen2, HIGH);
     break;    
 }

}
I'm sure this can be made to interconnect with OP, I just never got around to doing it!
Reply
#32
Hi, the project is very much alive. However, I have used most of my time (limited as it is with a job and family life) on the yacht server part of it.
The best part is that we acquired a new boat this fall, an Ovni 395 : https://photos.app.goo.gl/2WGKVTG9KXaUZq7N6

Most of the information is found here: https://sites.google.com/site/olewsaa/ya...el-monitor
and the code : https://github.com/olewsaa/Yacht-compute...alK-v2.ino

This code is just a start. I have planned to install a number of these sensors over the winter to monitor the heads holding tank. If you follow the
project page: https://sites.google.com/site/olewsaa/yacht-server i'll post the progress.

An additional problem showed up, how to measure the kerosene day tank level. The electromagnetic ones do not work with organic fluids.
Will see if some ultrasonic might work, I am not to happy with floats etc.  

Ole
Reply
#33
(2018-11-07, 07:10 PM)abarrow Wrote: Sure, I'll have to dig up the Arduino sketch I used, but it's extremely simple. Let me see if I can put something together for you.

It may not be super quick as my boat just came out of the water and I need to be at the yard to do work on it!

I found the sketch. Basically, for a sensor, you get a piece of plastic rod the depth of your water tank, and put rings of copper on the very bottom, then at three other places farther up the rod (low, med, full...). Those come back to your Arduino (the bottom contact is ground). As the water level rises, each sensor contact is brought low, which activates the associated LED. Also on your arduino, you attach LEDs to indicate levels. In my case, I used Green, Green, Yellow and Red in a descending row in a little box. 

Code:
*
 Level Sense
This is a water level detector for a tank. It uses a plastic rod with contacts up the length

*/

// set pin numbers:
//Below bottom sensor
const int ledPinRed =  13;
//Above bottom sensor
const int ledPinYellow = 12;
//Above middle sensor
const int ledPinGreen1 =  11;
//Above top sensor
const int ledPinGreen2 =  10;

//Sensors
const int sensorPinLow = 9;
const int sensorPinMed = 8;
const int sensorPinHigh = 7;

int sensorTotalValue = 0;
int sensorValueLow = 0;
int sensorValueHigh = 0;
int sensorValueMed = 0;

void setup() {
 pinMode(ledPinRed, OUTPUT);
 pinMode(ledPinYellow, OUTPUT);
 pinMode(ledPinGreen1, OUTPUT);
 pinMode(ledPinGreen2, OUTPUT);
 pinMode(sensorPinLow, INPUT_PULLUP);
 pinMode(sensorPinMed, INPUT_PULLUP);
 pinMode(sensorPinHigh, INPUT_PULLUP);
 
 Serial.begin(9600);
 Serial.println("Welcome to the level sensor");
}

void loop() {
 //Reset the sensors
//  int sensorValueLow = 0;
//  int sensorValueHigh = 0;
//  int sensorValueMed = 0;
 // read the state of the sensor values:
 
 if (digitalRead(sensorPinLow) == HIGH) {
   sensorValueLow = 1;}
   else {
   sensorValueLow = 0;
 }
 if (digitalRead(sensorPinMed) == HIGH) {
   sensorValueMed = 1;}
   else {
   sensorValueMed = 0;
 }
 if (digitalRead(sensorPinHigh) == HIGH) {
   sensorValueHigh = 1;}
   else {
   sensorValueHigh = 0;
 }
 sensorTotalValue = sensorValueHigh + sensorValueMed + sensorValueLow;
 
 Serial.print("Sensor Value: ");
 Serial.println(sensorTotalValue);
 
 // make sure all the lights are out
  digitalWrite(ledPinRed, HIGH);
  digitalWrite(ledPinYellow, LOW);
  digitalWrite(ledPinGreen1, LOW);
  digitalWrite(ledPinGreen2, LOW);
 
 // then turn on the right lights
 switch(sensorTotalValue) {
   case 3:
     //Absolutely low. Flash the red led
     digitalWrite(ledPinRed, LOW);
     delay(500);
     digitalWrite(ledPinRed, HIGH);
     delay(500);
     break;
   case 2:
   //Yellow Light only
     digitalWrite(ledPinYellow, HIGH);
     break;
   case 1:
   //First green light and yellow
     digitalWrite(ledPinYellow, HIGH);
     digitalWrite(ledPinGreen1, HIGH);
     break;
   case 0:
   //Two green lights and yellow
     digitalWrite(ledPinYellow, HIGH);
     digitalWrite(ledPinGreen1, HIGH);
     digitalWrite(ledPinGreen2, HIGH);
     break;    
 }

}
I'm sure this can be made to interconnect with OP, I just never got around to doing it!
Thank's alot for the information! It will be perfect to monitor my water tank. I do have a arduino uno that I can use and "millions" of small led lights in different colours. I don't need to know exactly the amount of liters, just something that tells me that it's time to fill it up and when then tank is full when I fill it up.
//Patrik
Reply
#34
I'm using the LevelPro Sentinel Remote tank level monitoring device for a long time without any trouble and also the support team is very helpful. You can also measure the level remotely. So you can check this device from Icon Process Controls website: https://iconprocon.com/product/sentinel-...onitoring/
Reply
#35
I am using various tank level measurements in our industry for a long time with no trouble. The support team is really great to help. If you are interested you can visit this website: https://iconprocon.com/product-category/level-sensors/
Reply
#36
(2017-07-05, 03:17 PM)abarrow Wrote: By the way, I just noticed this product. It's a pre-made capacitance level measuring sensor designed for non-metallic tanks. At only $35, it sounds like a great deal. According to the diagnostic help for the product, it produces between 0-5V depending on liquid level.

https://tankedge.com/accessories.html

abarrow, 

This seems like it'd be very simple, yet accurate, way to monitor a holding tank. Drop an esp32 nearby with wifi and then what? Connect red to 3.3v, black to GND and blue to whichever pin reads the differential and set up a program? That seems simple enough. I have to be missing something....
Reply
#37
I don't know what output would be like from this device, so it's hard to tell what you would need to do to use it.

Myself, I wrote a program to work with a resistance-style tank level monitor with a sliding float. I haven't fully implemented it yet, but the coding is all done as part of a panel meter that I did a while back.

This one is just for an M5Stick and only does tank level. https://github.com/andyrbarrow/TankLevel

This is a full panel display that uses an epaper display, and shows both battery level and tank level, using the ESP32 capacitive touch to switch displays. https://github.com/andyrbarrow/TankLevel

Both of these connect to OpenPlotter using Wifi, and output the appropriate SignalK strings.
Reply
#38
(2017-06-25, 05:56 PM)olewsaa Wrote: I am working with induction water sensors to monitor the water (not clear if these sensors works for hydrocarbons, most probably not) level in tanks.
For background see my project page about Tank levels. The sensors produce a simple on/off signal, e.g. they fire when they sense water behind the pipe or tank wall, glass of metal works ok. A set of sensors are needed, using 4 one could have 0.0, 0.25, 0.5, 0.75 and 1.0. The exact numbers would depend on where the sensors are places. With clever measurement and math one might even manage to get correct numbers for a irregular shaped tank. Either by placing the sensors at the precalculated heights of via some math in the function. The latter is a bit hard as it might be that 3 of 4  sensors would fire at only 1/2 full tank. It should be best to place the sensors smart. 

As there are a limited set of on/off IO pins on the Pi itself I propose to use some external IO boards over the I2C bus which can bring the possible on/off IO pins up to 128. How this is done is documented on my project page. It's actually quite simple. 

Using a set of these sensors I plan to write a function that return a float number from 0.0 to 1.0 which correspond to a meter type widget in the Signal K web page. Hence the tank level would be mapped and displayed quite nicely. The only part I'm not really certain about is how to generate new Signal K names and exactly how I should integrate this function into the OpenPlotter structure, some help and cooperation with this would be nice.
Reply
#39
(2021-07-21, 06:10 PM)abarrow Wrote: I don't know what output would be like from this device, so it's hard to tell what you would need to do to use it.

Myself, I wrote a program to work with a resistance-style tank level monitor with a sliding float. I haven't fully implemented it yet, but the coding is all done as part of a panel meter that I did a while back.

This one is just for an M5Stick and only does tank level. https://github.com/andyrbarrow/TankLevel

This is a full panel display that uses an epaper display, and shows both battery level and tank level, using the ESP32 capacitive touch to switch displays. https://github.com/andyrbarrow/TankLevel

Both of these connect to OpenPlotter using Wifi, and output the appropriate SignalK strings.

In the end, I used the TankEdge Moda sensor, a voltage divider, and an ESP32 with SensESP. For me the learning curve was the hardest part - having had programmed in the distant past, I needed to get out of my own way. Now I can see it is so simple! It's been working great for months now.
Reply
#40
I have been working on tank level monitors for my black water tank. 

First try was a Maretron TL100 ultra-sonic. Is a through a sensor hole in the top style. It worked at first but after the face of the transducer gets covered in shit, it stops working. It also suffers from the problem that all sensors of this type have, they cannot measure close to the transducer face.

Tried various float switch sensors, they gum up. I have not tried any of the in tank capacitance sensors yet, but am concerned that coating on sensor would mess up the readings.

I cannot use any sensors that are external to the tank because the sides and bottom are not accessible. 

The latest effort is a drop in level sensor: Oumefar TL-136 Liquid Level Transmitter Signal Output Detector 4-20mA Water Level Sensor for Signal Detection (Range 0-1 Meter) from Amazon. 

I put a condom like cover over the sensing part of the transducer because the very thin foil like diaphragm in the end of the transducer is not made for the corrosive stuff in a black water tank. The inside of the condom was filled with fresh water to transfer the pressure to the internal sensor.

It failed after about two weeks. It may have been because the pump out system in my marina is very powerful and the sensor could not deal with the vacuum, really not sure why though.

Today I installed a 0-2 meter sensor, this time with a better condom arrangement, and I plan to go easier on the pump out. 

I live aboard so it gets a good workout.

Boy am I glad I lost my sense of smell several years ago.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)