Model Boat Mayhem

Please login or register.

Login with username, password and session length.
Pages: [1]   Go Down

Author Topic: Arduino Bilge Monitor  (Read 862 times)

DJW

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 371
  • Location: London
Arduino Bilge Monitor
« on: February 27, 2021, 10:17:11 am »

Hi All


Aim is to create an Arduino (Pro Mini) based water detection solution, then to push the result via S.Port as a new telemetry sensor to an FrSky Tx. Then an Tx audio warning in the event of water detection.


I have a good idea of what the sensor will look like, just two exposed pins in the right place(s) in the bilge and monitor the resistance with some simple code.


I'm yet to understand the details of how to get the information into the telemetry...


So first question is has anyone done it already..?


Regards to all.
David.

DJW

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 371
  • Location: London
Re: Arduino Bilge Monitor
« Reply #1 on: February 28, 2021, 08:21:23 pm »

Evening All


I think there's an easy way to do this.


Once the Arduino detects a resistance indicating water present it sets a pin high. Thats then sent to the AIN2 pin on the FrSky S.Port, I'm using the R8 Pro Rx. That's already visible on the Tx telemetry screens as A2.


Then in OpenTX set up a detection of A2, if its greater than 0, play a suitable sound file...


Bit of a hack of the analog port, but might just work...





David.

DJW

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 371
  • Location: London
Re: Arduino Bilge Monitor
« Reply #2 on: March 03, 2021, 12:39:24 pm »

Half way there...


I found this on YouTube as a great start point:


https://www.youtube.com/watch?v=YkIiRbI4Plc


These are the original connections:



2 headpins for the probe with 2 wires cable (A1,  +5V).
3 headpins for connections with Arduino. The 22K resistance goes from the probe A1 to the 3th pinhead creating the GND pin for Arduino. For Arduino we get +5v, A1 (or other analog pin) and GND.


Video refers to 'Sketch file in Comments', but I couldn't find it so I recreated it from what I could see on screen.


I've taken that as a start point and tweaked a shade.


I now have the Arduino detecting water.  Its outputting to the Serial Monitor for testing, and setting an output pin high when water is detected.


This is the 'sensor' made from two header pins:





This is the sensor test...





And this is the Serial Monitor output.  Reading of '0' is open sensor, very small reading is my fingers across the sensor, over 100 is sensor dipped in water.





This is the code so far:


Code: [Select]
int probe = A1;                     // Bilge Probe pin
int level = 0;                      // Detected Water Level
int AIN2 = 12;                      // AIN2 Telemetry Trigger pin
int levelT = 10;                    // Set threshold above which triggers AIN2 (Prevent False positives)


void setup()
{
  Serial.begin(9600);               // Include Serial Monitor for Testing
  pinMode(probe, INPUT);            // Set Probe Pin as Bilge Input
  pinMode(AIN2, OUTPUT);            // Set AIN2 Pin to output to Rx S.Port
}
void loop(){
{
  delay(1000);                      // Adds a 1 sec pause for easier monitor visibility
  level = analogRead(probe);        // Detection on probe pin
  Serial.print("Reading Now = ");
  Serial.println(level);
}
  if (level > levelT){              // If water present voltage will increase on probe pin
 
    Serial.println("---- > Water in the Bilge");
    digitalWrite(AIN2, HIGH);       // If Voltage on probe is > 0, set AIN2 pin to 5v
  }


  if (level <= levelT){


    Serial.println("----- > No Water in the Bilge");
    digitalWrite(AIN2, LOW);       // If Voltage on probe is 0, set AIN2 pin to 0v


}
}


I've made changes to Tx Telemetry to detect when AIN2 pin goes high so that's next step to test, there's an option to detect the 'highest' voltage on the AIN2 pin within OpenTX, I'm going to use that as if a small amount of water is in the bilge, it may not always cover the sensor, so once triggered the Tx will keep announcing til a telemetry reset.  Plan is to use the Rx S.Port power supply for the Arduino mainly to avoid ground issues, I'm going to get this connected up, then test the telemetry.


Regards to all
David.

DJW

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 371
  • Location: London
Re: Arduino Bilge Monitor
« Reply #3 on: March 04, 2021, 03:29:32 pm »

Good News.  Its working, and no blue smoke (yet...).  :-))


This is the Arduino Pro Mini in its final state:





And the underside:





Its has a pass through for the S.Port to other devices.


Testing the probe:





So on detection of water by the probe the AIN2 line of the S.Port gets a 5v signal.  In OpenTX I've set up monitoring of the AIN2 port using the AIN2+ telemetry signal, this (+ option) records the highest signal and keeps it til a telemetry reset.  Then I play an audio track, 'Danger' was the most apt I could find in the sound pack...  And it keeps playing every 3 seconds if the AIN2+ figure is more than '0'.  So once triggered it basically plays til the telemetry is manually reset.


Now I'll incorporate a few sensors in the vulnerable bilge areas around the rudder tube and prop shaft seals.


I did change some of the pins in order to get the connectors in the right place on the board, so the top of the Sketch now looks like this:


Code: [Select]
int probe = A2;                     // Bilge Probe pin
int level = 0;                      // Detected Water Level
int AIN2 = 3;                       // AIN2 Telemetry Trigger pin
int levelT = 10;                    // Set threshold above which triggers AIN2 (Prevent False positives)


Not sure if this is a sledgehammer to crack a walnut thing...  But I wanted another Arduino project so am happy with the result.


Video showing the end to end telemetry system working is here:  [size=78%]https://www.youtube.com/watch?v=9S9OKOHVceM[/size]


If I've omitted any details that anyone wants to know, just ask.


Best regards to all.
David.

DJW

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 371
  • Location: London
Re: Arduino Bilge Monitor
« Reply #4 on: March 04, 2021, 03:51:56 pm »

Meant to add to earlier post...


This is on the Tx end to set up the monitoring (shown in OpenTX companion):



So L02 is activated if A2+ is greater than zero, i.e. if there's a detection signal from the Arduino.
And L03 is active if A2+ is zero, no detection of water.





And then if L02 is activated a sound ('Danger') is played every 3 seconds til telemetry reset.
If L03 is active, which is the usual state, a different sound ('Normal') is played, just once at startup.


Best regards
David.

Umi_Ryuzuki

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,194
  • Location: PDX, OR USA
    • Models and Miniatures
Re: Arduino Bilge Monitor
« Reply #5 on: March 04, 2021, 06:49:26 pm »

We used to just do this...  ok2

DJW

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 371
  • Location: London
Re: Arduino Bilge Monitor
« Reply #6 on: March 04, 2021, 10:09:53 pm »

Hi Umi


Same principle, but updated to the era of the Internet connected video doorbell...  %)


Best regards
David.

derekwarner

  • Full Mayhemer
  • *****
  • Online Online
  • Posts: 8,691
  • Location: Wollongong Australia
Re: Arduino Bilge Monitor
« Reply #7 on: March 04, 2021, 10:23:04 pm »

David......


1. Most bilge water sensing systems have a low to high level 'conditions'  which are important elements of the system, in one important case, to eliminate the pump stop/start with a high frequency


2. Having a flooded suction for the pump on startup is also another consideration, which apart from positive flow, eliminates the shaft seal from running dry


3. Hawing little electrical knowledge, does the salinity of the water have a varying resistance within the circuit water probes?


I watch the twin minature peristaltic pump units of the 'Plasma separation machine' at the Blood Bank on each donation. these have the ability to run dry, and have positive suction. The load cells and circuitry of these machines is also intriguing  :o 

Derek
Logged
Derek Warner

Honorary Secretary [Retired]
Illawarra Live Steamers Co-op
Australia
www.ils.org.au

malcolmfrary

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 5,882
  • Location: Blackpool, Lancs, UK
Re: Arduino Bilge Monitor
« Reply #8 on: March 05, 2021, 09:09:00 am »

Sensing water and just reporting it is one thing.  Two sensors does a good job.  If a pump is involved, it needs its own control to be operated from the transmitter.
Automatic pumping is another question again.  For that to be effective it needs a ground common, a low level sensor and a high level sensor.  The high level is the one that starts the pump, when there should be enough depth for the pump to prime.  The low level keeps the pump running until the level drops to the point where the pump cant scavenge.
The drawback of the simple Darlington transistor is that the pump will tend to stutter - as soon as water is detected, the pump runs, drops the level a fraction, and stops.  Depending on how fast the water is coming in, it repeats without dropping the unwanted water significantly.
Putting a CD4001 quad 2 input NOR gate chip, suitably wired, between the TIP120 and the probes sorts out the logic for about 50P pus postage.  There was a discussion about this about 10 years ago.  I did a drawing which was built and worked, but have since lost it.  The version using a CD4066 worked, as well.  Using an existing Arduino makes sense, its mostly just programming.
It is preferable that the probes either can't corrode or can be easily accessed for cleaning.  Stainless is a good option.  One bilge pump control maker way, way, back biased his probes with AC to try to eliminate the perceived problem.  I suspect that the currents involved with CMOS inputs are low enough for this to be ignored given the operating life span of most models.

Logged
"With the right tool, you can break anything" - Garfield

DJW

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 371
  • Location: London
Re: Arduino Bilge Monitor
« Reply #9 on: March 05, 2021, 09:38:03 am »

Hi Chaps


Interesting points raised. I did look at the 'depth sensors as they're the first result when water detection is googled.
Seems they're just a row of sensor pairs, so one will trigger, then the next, and you can work out depth.

This would be quite straightforward to build and adapt to arduino, different levels triggering different input pins, then do something. Could be pump, indicate or whatever.

I do like those peristaltic pumps too, mainly as they don't need priming but also the pulsed delivery. If I get past this build and onto a larger version I'll be using one for the water to exhaust rather than the current conventional pump.

In this case my aim for the Bilge water detection is not to pump water out at all as I don't want any water in the hull, at all. And definitely not to keep running with water on board. So its enough for me to just detect water presence, and immediately warn via telemetry on the transmitter. Then I just make a beeline for the dock and investigate.

 I've made up my own rudder and prop shafts and have used seals, but in the event of a failure of one of these seals, the results would be unthinkable. The prop shaft is of main concern, as I'm running exposed shafts the prop tubes are quite short, so there's not much volume for lube in the shafts. So a failure of the seals would go bad quite fast, I think.

With hindsight I could have used larger diameter tube for the prop tubes. They're not causing any drag as they're not exposed, so I could have made them more robust...

There's always next time...
Best regards
David.

JohnG

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 52
  • enjoying the learning
  • Location: Dorset
Re: Arduino Bilge Monitor
« Reply #10 on: March 09, 2021, 10:52:45 am »

hi david,
i wondered if a cheap water level sensor might be useful - like this:-
https://create.arduino.cc/projecthub/NewMC/water-level-monitor-b42be9
 
there's a description of how it works in the link. they're on ebay for 2-3  - searching for 'arduino water level' finds lots.
 
i'm  using one hooked to  a raspberry pi to monitor the water level in my smoke generator.   for the arduino it would be simpler because it can read an analog signal. for the pi i have to use an analog to digital chip. 
 
i've got as far as seeing it working in the unit with a signal that i read on the boat's 'web page'....  even having cut  the sensor shorter to fit the smoke gen housing.  can't yet speak for it's longevity/consistency.
 
hope this assists.


John G
 
Logged

DJW

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 371
  • Location: London
Re: Arduino Bilge Monitor
« Reply #11 on: March 09, 2021, 11:45:22 am »

Hi John


Thanks for this, I did see those sensors but decided that I just need a single pair (of contacts) to indicate water presence rather than multiple pairs that would give me depth. Basically I don't want any water in the hull if I can help it.


I'd be very interested to see what you've build as a steam generator.  I've created a basic version around a 20mm ultrasonic 'misting unit' that uses a flow of water through a small reservoir at the back of the disc rather than a tank as such.  I'm leaving that til later in my build to see if I have space for it and the required plumbing...














Best regards
David.

JohnG

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 52
  • enjoying the learning
  • Location: Dorset
Re: Arduino Bilge Monitor
« Reply #12 on: March 09, 2021, 12:30:21 pm »

Hi david,
I experimented with the same disk vaporisers, but eventually fixed on a bigger 24v unit. I created a mini-reservoir around the top with hot glue, and the use a mini pump to supply it. I 3dprinted the housing. Total unit is 85mm long*40w*50h.



Logged

JohnG

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 52
  • enjoying the learning
  • Location: Dorset
Re: Arduino Bilge Monitor
« Reply #13 on: March 09, 2021, 12:48:54 pm »

the 24v unit (next to an earlier version of the housing) and smoke being generated
Logged

DJW

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 371
  • Location: London
Re: Arduino Bilge Monitor
« Reply #14 on: March 09, 2021, 03:22:07 pm »

Hi John


That looks to be working very nicely. I'm bit tight on internal space so have but the mist maker at the end of the list for this build.


I'll update the thread when I have the bilge monitoring integrated into the build.


And I'm now feeling the need for a 3D printer...  %)


Best regards
David.

JohnG

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 52
  • enjoying the learning
  • Location: Dorset
Re: Arduino Bilge Monitor
« Reply #15 on: March 09, 2021, 06:32:24 pm »


wish you well with it. and having had a look at your main build page, am rather in awe of the woodworking  :-))   well done!

for the electric 'toys' i've gone down the route of using a pi rather than arduino to control it all. so far got sound (mp3's rather than revs related) and smoke controlled, and indicators for batt volts, water in smoke gen, and a bridge camera working.    i'd used pi's before, and found it more flexible.

Be warned - 3d printing in a whole new hobby/rabbit hole! with another one for the 3d cad....   fun to do -  but not quick!!

i posted some bits under 'hms broke' that might be of interest over in the naval section. need to bring it up to date sometime...

kind rgds

John

Logged
Pages: [1]   Go Up