Water Level Gauge - Part I
Monitoring water use with a high-tech water sensor

by Rick
November 10, 2007



During our second year cruising on our trawler Sea Gator we managed to run out of fresh water twice.

The first event occurred after a previous owner's repair to the copper water line - using un-reinforced plastic hose - burst (see Travelogue January 7, 2007) and I had to repair it with materials on hand. Fortunately, I at least had some reinforced hose, right. We weren't sure how much water we lost but we ran out far sooner than our three week norm.

We later decided that although we lost some water during the leak event, the tanks were probably not even completely filled at our last fillup. Ordinarily, when we fill the tanks with a hose under city water pressure we can tell the tanks are full when water spills out both the horizontal fill tube and the vent fitting. At some point we decided that, to avoid wasting water, we wouldn't spew it out the vent. So, the tanks may not have been topped off completely in any case.

Our second empty water tank event occurred during a rough crossing (see Travelogue May 15, 2007). Galley debris flying from cabinets knocked one of the galley sink faucets open and the tanks ran dry before the problem was caught. Although we normally have the water pressure pump turned off while underway, apparently someone (I know who but that's not important here) neglected to turn it off again after hand washing during a trip to the galley.

Following each of these events we wished (sigh) that Sea Gator's water tanks had some form of level gauge so that we weren't required to guess, to tap on the tank sides or use some crude calculation to estimate how much water we might have remaining. So I added one more item to my list and began the search for a solution.

Preliminary Options that Didn't Make the Cut

Sight Gauge: Adding a simple sight gauge to the water tank using clear vinyl tube is an obvious solution (right). But there are a couple of problems with it. Sea Gator's water tanks are below the queen bed in the master stateroom. Sliding the mattress aside then lifting several support planks just to view the sight gauge would be cumbersome. Any viable solution should allow us to view the water level conveniently at any time without disassembling furniture. I'm also not thrilled with drilling holes and adding more fittings susceptible to future leaks.

Float Gauge: Various forms of float gauges are available. Mechanical versions include a float that spins a rod directly connected to a level gauge like those used in old snowmobile and motorcycle gas tanks. On Sea Gator, such a gauge presents the same problem as a sight gauge: we'd have to disassemble the bed to view the gauge on the tank. Electromechanical versions, like those used in a car's gas tank, include the float gauge in the tank electrically connected to a gauge mounted elsewhere. I abandoned this option because I thought it would be difficult to find an affordable gauge suitable for use in potable water, and that could also withstand the abuse of sloshing water.

Pressure Sensor: I had seen ads for commercial tank level gauges that use air pressure to detect the level of water, holding, and fuel tanks by equating air pressure in a tube with the liquid pressure at the bottom of the tank. It took only a brief online search of advertised products to eliminate this option: its cost was prohibitive.

The Search for a Solution

Of course, the options above are just a few of the many solutions to this problem. I also had to decide whether to buy or build. My recent dabbling in basic electronics and microcontrollers tipped the scale in favor of building a solution, which would be far more fun than buying something off the shelf and wading through pages of installation instructions. With that decision out of the way I listed my requirements for my do-it-yourself project:

I began the search for ideas by exploring several electronic hobbyist forums.

Ultrasonic Sensor: I was particularly intrigued by ultrasonic sensors that measure the distance between the sensor and an object. Using a microcontroller and an ultrasonic sensor I could determine the distance between the top of the tank and the water surface. I had to abandon this idea because the affordable sensors are not waterproof. Although this would be a good solution for a stationary tank on land, it would not work on a boat.

Pressure Transducer with Microcontroller: Alternatively, I could use a pressure transducer that generates a linear 4-20 mA analog signal along with a microcontroller and its analog-to-digital converter and custom code to convert the signal to water depth. Seriously. However, I could not find an affordable transducer suitable for potable water.

Float Switches and More: Other ideas I considered included float switches (photo, right), floating a magnet around reed switches in a tube, and measuring capacitance between two conductors where the water is the dielectric. I dismissed anything that required floating because of the moving parts and the adverse affects of violent sloshing. The capacitance idea appeared a bit too complex for the problem.

The Chosen Concept: Moisture Detector

I found an idea I could pursue when I saw this circuit, right. This is an example of a simple moisture detector. Although water is a poor conductor, it will conduct enough electricity to be detected and amplified by a simple transistor. The example circuit includes three probes each lighting an LED when moisture is detected. I want to detect more than three levels but this circuit offered a good solution.

Building a Prototype

O.K. Where to begin? I could envision the required components of the system. But before I went any further I wanted to test the water-conducting circuit. This was my first project using transistors so I did not have any lurking in my bottomless spare-part bins. I did more research and learned that any simple NPN type transistor would work - and I added a base to ground resistor to keep the transistor off when the input is floating.

On my next trip to town I picked up several 2N2222, 2N3904, and 2N4401 transistors in TO-92 packages from Radio Shack.

I then built my circuit on a breadboard (see photo, right) to experiment. A breadboard is a reusable solderless prototyping board used to build and test circuits. By plugging in components and jumper wires, you can create and test the circuit before committing it to a more permanent form such as a printed circuit board (PCB).

I created the test sensor by simply attaching the common lead (+9V) and the three level sensor wires to a piece of plastic with ring terminals and stainless steel screws. I used a 9-volt battery for my power source, which is what I expect to use for the finished product. I added a switch and a green power LED and then tested my circuit by dipping the sensor in a jar of water (left). It worked! You can see that two of the yellow LEDs are lit. The screw for the high water sensor is still above the waterline so its LED remains dark.

The complete breadboard prototype above identifies the components I will have to build for the finished product. I will need a remote display unit, which will house the circuit board, on/off switch, battery, and LED display. I will also need a sensor unit for the water tank, and cabling to connect the sensors to the remote display. I will use stainless steel for the sensor probes but I'm not sure how the probes will survive continuous immersion. Since DC current will only be running to the sensor probes when the remote display is turned on to view the water level, current corrosion should not be a serious problem. If we needed automated continuous monitoring, probe longevity would be more of a concern. I expect to inspect and clean the sensor probes annually.

With the proof of concept completed, this project is beginning to take shape. I think six equally spaced sensors are sufficient for our needs. Why six? Well, I wanted to keep cabling between the sensor and remote display simple. Category 5 (Cat5) Ethernet networking cable is perfect. Cat5 cables have eight conductors, they are readily available in many lengths, and they use RJ-45 jacks that are small and will be easy to incorporate in the sensor and remote display. Since I need one wire for each sensor and one common wire I could use seven sensors. But seven is a bad choice. I don't want to say the tank is three-sevenths or five-sevenths full. Six is a better choice because the fractions are easily reduced to more meaningful values of one-third, one-half, and two-thirds. So six sensors it is. With six lit LEDs we know the tanks are full, three lit LEDs and we're half full, and with only one lit LED we need to find fresh water quickly or forget about taking showers.

Designing the Printed Circuit Board

There are a number of ways an electronics hobbyist can build a permanent circuit to implement the breadboard's prototype. Using stripboard and wire-wrapping with perfboard are two examples. Since I have used neither, I set my sights on creating a more professional looking printed circuit board (PCB) that would help minimize the size of the remote display. Remember, one of my design goals was to learn something new. Creating my own PCB would certainly fit the bill.

I had read that many enthusiasts were creating their own PCBs so I scoured the Internet for instructions. Making Printed Circuit Boards provided a good tutorial and Easy Printed Circuit Board Fabrication included a wealth of information for the toner transfer method. I did not want to hand draw the PCB traces so I downloaded the free Light Edition of the EAGLE Layout Editor. Cadsoft's Eagle is a software tool to create electronic schematics and design printed circuit boards. Free Eagle Light limits the size of boards to 3.9" by 3.1" (100 x 80 mm) but that is sufficient for this project and I can always upgrade to their Standard or Professional versions if necessary. But free is a good place to start.

I created my schematic for my circuit in Eagle's schematic editor. I included an on/off switch, a power LED, an RJ-45 jack and resistors, transistors, and LEDs for the six sensors. After the schematic was complete I used Eagle's board editor to layout all of the components. I used the auto routing feature to create the electrical traces that connect the components according to my schematic. Eagle's auto router is a very cool feature that does most of the hard work. The auto router follows the design rules I established specifically for the toner transfer method with minimum component pad distance and trace widths. Professional board manufacturing allows much tighter tolerances.

I quickly learned that the traces from my onboard RJ-45 jack could not be routed on such a small single-sided board following my design rules. I replaced the RJ-45 connector with a straight 8-pin female header seen on the left of the board, photo right. I'll mount the RJ-45 jack in the box and use jumpers to connect it to the header.

Here is the finished board layout for my PCB. The blue lines and green component pads are the copper on the underside of the board. The component outlines, values, and labels are on the top of the board.

Making the Printed Circuit Board

Now the fun really begins. It's time to make my first printed circuit board. I could email my board design to any number of shops that will create and return a high-quality board. But the cost for this service for a single board is expensive so I will make my own PCB. First, I cut a 2.125" by 3.625" (54 by 92 mm) piece from 1/32" (0.79 mm) single-sided copper clad board. I wet sanded the copper with 1200 grit paper then cleaned it with acetone. I printed the bottom board layout on a LaserJet printer using Staples' glossy photo basic paper and transferred the toner to the board with a hot flat iron. It worked! Well, mostly. I followed all of the instructions to soak the board and paper but small amounts of toner still did not completely transfer to the copper. I used a resist ink (Sharpie) pen to draw the areas that did not completely transfer. The LaserJet toner and the Sharpie resist the chemical PCB etchant so the copper will remain wherever these exist on the board.

Next, I added the board to a small plastic tray and covered it with the ferric chloride etchant. I floated the tray in warm water and after about twenty minutes the etchant had removed all of the unwanted copper. I used acetone to remove the toner and resist ink for a completed board bottom (photo, above right).

I repeated the toner transfer method to transfer the component outlines, values, and names to the top of the board. There is no etching required and while this step is not really necessary, it's does make the board look good. Again, the transfer was not perfect but it was not bad for my first attempt. Perhaps I will get better with experience. Here's the top of the board ready to be populated (photo, above left).

I then drilled all of the board's component holes using a rotary tool and a tiny #66 (0.033" or 0.838mm) drill bit. I also drilled four holes to mount the board to the standoffs in the project box I selected to house the remote display. Next, I soldered all of the components to the board. When soldering the six blue LEDs (blue for water, you see) I installed a cardboard spacer between the leads so that all would be at the proper height to protrude through the holes I drilled in the project box cover. The cardboard also prevents the LED leads from bending when the cover is installed. I suppose I could have used an N-segment LED display but this was simple enough. Here's the completed PCB, right.

It looks good. But will it work?

Building the Remote Display Enclosure

With my PCB finished, I can now assemble the remote display.

I chose a 5" x 2.5" x 2" plastic project box from Radio Shack, which has enough room for the on/off switch, RJ-45 jack, PCB, and 9-volt battery. I began by cutting an opening for the RJ-45 jack. I soldered seven jumper wires from the jack to an 8-pin male header. Next, I cut a slot for the snap in illuminated toggle switch and soldered the battery and PCB connectors. I used 5 minute epoxy to install the RJ-45 jack and to secure four nylon standoffs to the bottom of the box.

I fastened the PCB to the standoffs, connected the RJ-45 jack and power supply jumpers and installed the 9-volt battery. The height of the battery fits perfectly in this box, left. The box cover secures the battery snugly between the top and bottom and I added some foam to prevent any horizontal movement.

Finally, I printed a label for the top and attached the cover. Right is the finished remote display.

Testing the Remote Display

The quickest way to test the remote display is to simply connect a Cat5 cable and insert the other end of the cable into a container of water. All six LEDs should light.

To test individual lights, I used the ammeter on my digital multimeter and connected its leads between pins eight and one, eight and two, etc. on the Cat5 cable's RJ-45 connector to test all six LEDs.

I realized it would be useful to have a simple tester readily available to test the remote display any time I suspected a problem with the sensors in the water tank. I created the submersible test sensor shown in use, left, from a plastic watch band case. The RJ-45 connector and wire leads will be conveniently stored inside the closed case when not in use. In the photo, left, the tester's first four sensors are submerged.

Installation and Field Testing

All of the work described above was accomplished at my desk in Wyoming.

See the final assembly and installation on Sea Gator in Part II.

Back to top

Ship's Manifest