Cheap Electronic Water Bladder Level Meter

A forum for discussing boat or trailer repairs or modifications that you have made or are considering.
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

Re: Cheap Electronic Water Bladder Level Meter

Post by Inquisitor »

RADOM wrote: Sat Mar 06, 2021 6:12 pm And I purchased a 10 pack of the sonic HC-SR04P for $10.86 and $6 shipping from China.
https://www.ebay.ca/itm/10PCS-Ultrasoni ... 2749.l2649
I was double checking your sensor. The title says P but the pictures are a mix of non-P and P versions. Hopefully your vendor knows the difference. If not, he'll be willing to give them to you for free instead of getting a negative review.
Odysseus, expert on the Siren's call
RADOM
Just Enlisted
Posts: 14
Joined: Sat Apr 16, 2005 2:08 pm
Sailboat: MacGregor 26X
Location: Mission, BC, Canada

Re: Cheap Electronic Water Bladder Level Meter

Post by RADOM »

I have the 120L triangular Plastimo water bladder tank that fits perfectly in the bow after removing the styrofoam.

This is my current water system setup.

I installed a water intake at the bow of the boat between the two cleats. I store the "key" in the anchor locker tied to the metal loop so it doesn't go missing.
Image

The inlet hose runs down from the bow....
Image

....into the bladder tank.
Image

You will notice the thin berber carpet I placed underneath. There were lots of sharp fiberglass shards in the area. I carefully sanded them off (too much sanding in this area would lead to a permanently full water tank!! :D ) and then placed the carpet in and the bladder on top of the carpet. This photo is the tank when there is no water in it. The tank is connected to a Jabsco 1.9GPM water pump which is mounted on the "bulk head" between the v-berth and the rear facing dinette seat.
Image


This is the tank when it is full. It expands to just about the top of the space. A lateral cross section of the tank when full would be elliptical.
Image

Waterlines run from the pump to the galley....
Image

....which also is connected to a hot water tank installed under the sink.
Image

A water line also runs to the sink in the head (cold water only).
Image

The electrical wires run to the DC panel.
Image

There should be space between the bladder and the top-side of the storage space to mount the water depth sensor. The outlet connector and hose stick above the bladder so I was thinking of attaching the plastic sensor case just forward of it. The vertical plane of the tank would be somewhat v-shaped. The highest depth of water would actually be about 2/3 of the way back from the front of the tank - just forward of the outlet.
I'll have to check at school what kind of plastic material they use.
I will likely just use my phone as the device to check on the water level. I will wire the sensor to my DC panel so the circuit will be switched. Only 1 problem. As you can see in the photo, my DC panel is full! Likely I will combine the "compass light" with the "depth sounder" which will free up a space for "Water tank level".

I'll let you know when the parts arrive.
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

Re: Cheap Electronic Water Bladder Level Meter

Post by Inquisitor »

Jeeze... that's impressive. Why haven't you been sharing such great work with us? 8) I'm definitely going to have to use your fill method. That just makes perfect sense... especially for trailering. I can stop at a faucet, break out a hose, climb the trailer ladder and BAM... filled up.

Nice! electrical setup.

Maybe, tonight, after I work on the boat on this beautiful day, I'll do a InqWaterLevel 1.1.0 with a Demo mode. That way you can try out the software installation and QC my work. :wink: ... and make suggestions on improvements.

My fixed DC-DC converters say "out for delivery". Looks like I'll have something to do this evening. :D
Odysseus, expert on the Siren's call
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

STEP 4 - Attach the DC-DC Converter

Post by Inquisitor »

Next, we want to attach the DC to DC converter. This converts any voltage between 4.5 volts and 28 volts to a constant 5 volts. This way we can use it with any 12 or 24 volt systems, even when a 12 volt battery is nearly drained.
  1. Take the DC-DC converter and flip it over. Note all the hole designations are on the back side. I've never seen a board that has optional holes, but there are four pairs of holes. You can use any one of each pair. It doesn't matter. Now, take a red wire and a black wire. You can't use any other colors... the electrons won't flow in the right direction if you have any other color... especially a Blue wire... they're slower.* Solder the red wire to one of the pair marked IN+ and the black wire to one of the pair marked IN-.
    Image
  2. Your WeMos should have come with some pin headers. Cut one of the pins away.
    Image
  3. You'll also need a small piece of wire. Cut a length such that you have both ends stripped, but the insulation is approximately 7mm long in between. Note the picture below showing both the pin and wire soldered to the WeMos processor board. Note:
    • The pin goes in the hole labeled 5V... soldered from the back.
    • One end of the wire goes in the hole labeled G... also soldered from the back.
    • The wire is bent over and then up to match the spacing on DC-DC converter.
    • Make sure the wire does not make contact with any other hole or components on the WeMos board.
    Image
  4. Find a piece of plastic... something like an old credit card will do. Cut a rectangle about the size of the DC-DC converter. We want to glue this to the top of the WeMos aluminum shield. One dab of Super Glue or Epoxy will work fine. This is to make sure none of the connectors on the back of the DC-DC converter get shorted.
    Image
  5. With the DC-DC convert positioned as shown (with chips facing you and wires draped between the speaker cones) the proper pin/wire will match up with the correct polarity of pin holes on the converter. BUT... you'll want to double check it.
    Image

    Also shown in the image above, you'll note both the USB cable and the power leads are attached. It will not hurt the device to run from either or both power sources. But... remove the USB cable to confirm that you are powered from your 12 volt source through the DC to DC converter. If you successfully did STEP 2, you should be greeted with a slowly blinking blue light. Note how slow blue things are. :D
* Complete and utter B.S. Use any color you want, but a couple years down the road, you'll wish you used red and black. :D
Odysseus, expert on the Siren's call
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

STEP 5 - 3D Printed Case (Optional)

Post by Inquisitor »

It might be a good idea to protect the circuit boards. You can make any case you would like, but here is a 3D Printer model made for this project. The link below is on Thingiverse.com. If you are not familiar with 3D printing, this is like YouTube where the whole world uploads models of... well... everything. You can find Venus de Milo, a chess set of Minion characters or just about anything else you can imagine. There are almost 5 million models available.

The link will show you a picture of the model and even allows you to rotate around it. It also provides recommended settings for the printer. Anyone familiar with 3D printing should be able to print the case in less than an hour.
https://www.thingiverse.com/thing:4788142

Image


Image

WARNING: If you make your own case... make sure you allow the speaker cones to extend past the front face. As described above viewtopic.php?f=8&t=28178#p348511 there was some kind of acoustic anomaly that occurred if the cones fronts were flush with the front face of the case.
Odysseus, expert on the Siren's call
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

STEP 6 - Overview of the Software

Post by Inquisitor »

It still amazes me how much this little computer can do. Think of InqWaterLevel as a dynamic website say... like Yahoo or Google Finance where a page can get continuously updated with data just like a native application.

For the geeks in the audience familiar with how the Internet works, this computer has a condensed version of an operating system with a small flash memory hard disk and is running a web server like Apache on Linux or IIS on Windows... albeit greatly abbreviated. It also includes the hardware to act like a WiFi router so that you can connect directly to the WeMos server OR you can have the WeMos connect to a WiFi router which allows you to connect from any computer, tablet or phone on your local network. With correct settings on your WiFi router, you can share it across the Internet.

As it is simply a web server, it can host about anything (as long as it fits) you see on the Internet. As you might know... sometimes web pages don't seem to look right on your browser. This is usually because of new standards and/or old or different browser. What looks fine on Google Chrome, may look Waco on Internet Explorer... or vice versa. Its all depends on how generic a developer wrote the web pages or how flexible they made the web page adapt to a specific browser. For InqWaterLevel, I have checked it on Chrome running on Windows and about five different Android phones and tablets. It runs fine. I have also checked it on Microsoft Edge running on Windows. It too works fine. Another project, some time ago, I tried it on Internet Explorer. Crash and Burn! I don't have access to any Apples, so I cannot advice you on those. Although, if you use Chrome on an Apple, it should run just fine.
Last edited by Inquisitor on Tue Mar 09, 2021 5:10 pm, edited 1 time in total.
Odysseus, expert on the Siren's call
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

STEP 7 - First Access

Post by Inquisitor »

For the first connection, we will take the option of connecting directly to the device. This would likely be the most common way it'd be used on a boat.
  1. Power up your InqWaterLevel. Remember - you can use anywhere between 4.5 volts and 28 volts on that red and black wires. Just make sure you get the right polarity or the smoke will escape and you return to STEP 1. :cry: If you haven't put it in the case yet, you can still hook up a trivial USB charger.
  2. Note that the blue LED should be slowly blinking - 1 second on, 1 second off.
  3. With any WiFi capable device, open its WiFi connection screen... on Android, it looks something like this:
    Image
  4. Pick the InqWaterLevel access point.
  5. Open up Chrome on Android, Chrome or Edge on Windows or anything else at your own peril and type the IP address 10.10.10.10 in the address bar. You should get this.
    Image
This will be the water level page you come to whenever you want to check your water quantity. On Android, you can "Add to Home screen" so you don't have to dink with the IP address again.
Last edited by Inquisitor on Tue Mar 09, 2021 5:13 pm, edited 1 time in total.
Odysseus, expert on the Siren's call
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

STEP 8 - Calibration

Post by Inquisitor »

Calibration involves creating a table of data points representing the quantity of water in the bladder when the ultrasonic sensor measures the distance to the surface. At the bare minimum, you must have two data points - one when full and one when empty. We are assuming that the sensor case is mounted just above the bladder. When full there will be little to no clearance. The reading is the number of microseconds it takes for the sound wave to travel to the bladder and return. When empty, the bag is at the bottom and the clearance is far larger. The reading will be much larger also. Once the reading has settled down (sloshing has stopped) you can enter the quantity of water in the bladder in gallons or liters and save the reading. Do this for both the full state and empty state. To start:
  1. Press the applications menu button (not the Browser's) and select Calibration...
    Image
  2. You'll come to the Calibration page. It will be empty the first time, but if you ever need to re-calibrate it, you'll have your last setting in here. It also gives a simplified version of the instructions, in case you forgot how. :)
    Image
  3. To add a data point, first get the bladder to either the full or empty state. It should have no air pockets as the sound waves bounce off the surface, not the water. For illustration, I'll assume you have it empty. Press the menu button again, and select Add datapoint...
    Image
  4. A small window and the number entry keyboard will pop-up. Enter the quantity of water. In this example, 0 gallons. Note the second Reading box is showing you the current reading. For this example, my hand was about 10 inches away from the speakers and I got 1575.
    Image
  5. Press the Commit button and it's now stored on the server.
    Image
  6. Fill the bladder and press the menu button, and select Add datapoint... again. This time enter the filled quantity and note the reading should be far smaller. In this example, I've entered 30 gallons and placed my hand about 2 inches away from the speakers.
    Image
  7. Press the Commit button and you are now fully configured with two datapoints.
    Image
  8. Press the Back button and you will be returned to your primary water capacity screen. Instead of the message Calibration Required you will be presented with a bar chart of the amount of water you have... if you're using your hand (as I was) you obviously have to have your hand somewhere within the calibration range you set. In this case 2 to 10 inches.
    Image
Odysseus, expert on the Siren's call
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

STEP 9 - Advanced Calibration (TOTALLY OPTIONAL)

Post by Inquisitor »

Now if you consider, you're only wanting something a little more informative than this silly thing...
Image
... you're good to go with the basic calibration. That basic calibration assumes that the volume is linear with respect to bladder height. Considering these water bladders take on an elliptical cross sectional shape, this is probably not an accurate assumption. The other case is when the bladder is in the V of the keel.
Image
Obviously, there is far more water in the top two inches than their is in the bottom two inches. With a little more calibration, you can handle either of these two cases.

Using the same method of adding datapoints above, you can add up to 64 datapoints. You can also delete and modify datapoints.
  • To modify, simply press Add datapoint... type in the quantity of an existing one. Pressing Commit will overwrite the value with the current reading.
  • To delete, right-click on a Windows laptop or long press on a mobile device will give you the option to delete.
Now... you can add as many datapoints as you like... Depending on how accurate you want your results, you could go so far as to start with an empty bladder, add a zero datapoint, then add ONE gallon of water (say a milk jug's worth) and you now can take a 1 gallon datapoint. So-forth and so-on you could do that for every one gallon increment. They don't have to be consistent... you could do 1 gallon increments in the bottom 5 gallons and 5 gallon increments the rest of the way to filled. In use, the server will use your datapoints and interpolate between the two closest datapoint to give you values in-between your datapoints.
Odysseus, expert on the Siren's call
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

STEP 10 - You want to network (TOTALLY OPTIONAL)

Post by Inquisitor »

Let's say you've really geeked-out your boat. You have a central router hooked up to a Starlink antenna and are catching weather maps, Face-Timing with relatives and Netflixing in remote parts of the world. You're able to do telework and teleconference with the office and research the Internet on a daily basis. You are a YouTube sensation and need to upload videos on a daily basis. You have a big screen TV (well... as big as can fit on a Mac) and a media server with ten terabytes of your favorite movies and episodes of Seinfeld. You and your guests connect all your tablets, phones and laptops to this router so you can research with Google while lounging on the beach.

It is real inconvenient :( to have to disconnect your phone from the router to connect to the InqWaterLevel WiFi connection just to measure your water level. There is a solution to this first-world problem...
  1. Connect to the InqWaterLevel WiFi connection.
  2. On your Browser, go to the address: 10.10.10.10/admin.html You'll get the following screen.
    Image
  3. In the fields Client SSID and Client Password, add your router's login information. The password is not hidden... so make sure someone isn't watching over your shoulder. :o
  4. Press the Update button.
  5. After several seconds of logging into your WiFi router, you'll get an address in the Client Server Address field.
    Image
  6. Jot this address down to give all your devices that you want to have access to the water level.
  7. Disconnect from the InqWaterLevel WiFi and re-connect to the router you just configured.
  8. Now, you and any other device on your network will be able to use this new address in their browsers to get the water level! You could even dedicate one of your old cell phones, mount it above your galley and with a single touch, bring up the water level while you do the dishes. :D
EXTRA CREDIT
ONCE you've seen it work correctly on the new designated address, you can go into the Admin screen again (even from the new address) and change the name of the default InqWaterLevel if you don't like the name. You can add a password... in the Host Password field, which is a good idea! You can also clear it and NO direct access will be available. But if you do this and forget the address on your router OR for any other reason, you will not have a fall-back to get to your InqWaterLevel. You will have to use the utility in STEP 2 and manually clear the memory, reload the software and re-calibrate it. There is not a hardware reset button. Be careful!
Odysseus, expert on the Siren's call
RADOM
Just Enlisted
Posts: 14
Joined: Sat Apr 16, 2005 2:08 pm
Sailboat: MacGregor 26X
Location: Mission, BC, Canada

Re: Cheap Electronic Water Bladder Level Meter

Post by RADOM »

I think I got the idea for the filling port from this discussion board so I can't take credit for that but it sure is a handy set-up. The hot water is also nice when you are plugged into shore power. The admiral really appreciated that (not all that sure why.....since I usually end up getting stuck with the dishes anyways! :D )

Thanks for all of the helpful info! That took a lot of time to type that all up and include the photos! Hopefully there will be others who will benefit besides myself. Definitely looking forward to the build once the parts arrive. Being a math teacher, it might be interesting to try and model a function of depth vs volume that more accurately reflects the true depth of water than a linear model. Gotta get my geek on!

Spring break is next week for me, so looking forward to a 1 week cruise in the Gulf Islands (a group of islands between Vancouver and Vancouver Island BC). A diesel heater keeps the cabin nice and toasty.
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

Re: Cheap Electronic Water Bladder Level Meter

Post by Inquisitor »

RADOM wrote: Tue Mar 09, 2021 7:58 pm I think I got the idea for the filling port from this discussion board so I can't take credit for that but it sure is a handy set-up. The hot water is also nice when you are plugged into shore power. The admiral really appreciated that (not all that sure why.....since I usually end up getting stuck with the dishes anyways! :D )

Thanks for all of the helpful info! That took a lot of time to type that all up and include the photos! Hopefully there will be others who will benefit besides myself. Definitely looking forward to the build once the parts arrive. Being a math teacher, it might be interesting to try and model a function of depth vs volume that more accurately reflects the true depth of water than a linear model. Gotta get my geek on!

Spring break is next week for me, so looking forward to a 1 week cruise in the Gulf Islands (a group of islands between Vancouver and Vancouver Island BC). A diesel heater keeps the cabin nice and toasty.
This tutorial - You're welcome. I like adapting things I've learned/know to sailing. I imagine, if I make it look easy enough and you have success also, there might be others that take a stab at it. I wouldn't even consider calling this a project, more like a single evenings diversion. It'll take someone far more time to read this, than to actually do it.

Water heater - 8) Yeah, I saw your water heater. We almost never have access to shore power. I'm trying to work on a passive solar design. I'll need A/C long before I'll need a heater, but a warm shower definitely improves mine and the Admiral's disposition.

Math - If you do, I'll be glad to incorporated it into program for you. Between the differences of the bladders that people might have, I figured a linear interpolation approximation would be close-enough :wink: With multiple data points, it can be refined as much as someone has patience to calibrate.
Last edited by Inquisitor on Wed Mar 10, 2021 7:37 am, edited 1 time in total.
Odysseus, expert on the Siren's call
adudinsk
First Officer
Posts: 471
Joined: Tue Aug 27, 2019 12:53 pm
Sailboat: MacGregor 26M
Location: Belle River Ontario

Re: Cheap Electronic Water Bladder Level Meter

Post by adudinsk »

Thanks for the feedback.
I did order in a few fuel safe flow sensors, but what they were rated for, and how they performed was VERY different.
If I had an engine controller on my OB, I would read from that port.

Pressure/vacuum.. Good idea .. will look into that.
(looking for some fun "covid lockdown " projects... )

Thanks!
Andrew
User avatar
Inquisitor
Captain
Posts: 924
Joined: Mon Apr 23, 2007 5:24 pm
Sailboat: MacGregor 26M
Location: North Carolina Mountains

Re: Cheap Electronic Water Bladder Level Meter

Post by Inquisitor »

adudinsk wrote: Wed Mar 10, 2021 5:15 am Thanks for the feedback.
I did order in a few fuel safe flow sensors, but what they were rated for, and how they performed was VERY different.
If I had an engine controller on my OB, I would read from that port.

Pressure/vacuum.. Good idea .. will look into that.
(looking for some fun "covid lockdown " projects... )

Thanks!
Andrew
I think I know exactly what you're going after. I started getting a false impression of how efficient my 4-stroke was... over many years... until I ran out of fuel with no backup. Fortunately, I was with a group and someone gave me a splash. My gauge on the tank kept telling me it was full and I trusted it... I didn't use a stick. I recently got this viewtopic.php?f=9&t=27999. IF (AND I NEED TO LEARN) to be diligent about resetting after filling up, but it will do a running tally and tell me how much fuel and range I have left. I imagine you're going after the same thing! :)
Odysseus, expert on the Siren's call
adudinsk
First Officer
Posts: 471
Joined: Tue Aug 27, 2019 12:53 pm
Sailboat: MacGregor 26M
Location: Belle River Ontario

Re: Cheap Electronic Water Bladder Level Meter

Post by adudinsk »

Yes in a nut shell.

1) Want to monitor fuel consumption / mpg so I can monitor my range.
2) There was a product called FloScan 7000 that would work.. but you need the display/sensor/wire harness.. and it adds up quick
3) Love toying with microcontrollers (Arduino Teeny's Pi's etc). Thought it would be a good time to start another project.

I ordered and received a OF05ZAT flow sensor...
Have GPS boards...
Will build a simple inductive tach..
Want to display Fuel consumption/RPM's/ Speed over land. (possibly predict range.. would have to know tank starting levels though)
This way I can find the sweet spot for range/etc.

The OF05ZAT was not accurate when interfaced as per the instructions.. but reading.. its Open collector.. will make some changes to the output and put it on an analyzer to verify it all (prob this weekend)

Thought it would be fun.. with being locked up in Covid times..

AD
Post Reply