I have this odd hobby involving radio-controlled submarines. In fact, it was this hobby that got me started in electronics on the first place (I'm an aerospace engineer by trade), but that's a story for another day. In this column, I just wanted to go through one element of the overall system design for these particular devices. In particular, I will be discussing the ballast system and how to measure how much water is being displaced. Let's start with a brief tutorial on how submarines work. A submarine, large or small, takes in water to make its average mass the same as the water around it. Once an average mass is achieved, the sub is akin to being a giant water molecule. This does not mean, however, that by adding a certain amount of water that you will achieve a specific depth (if only it were that easy). It only means that there is no buoyancy force to cause the boat to return the surface, and that other forces are now able to act upon the boat. While the boat is moving, the hydrodynamic control surfaces allow the boat to change depths as desired, but if the boat gets too slow, these surfaces become ineffective as they no longer generate sufficient force.

General diagram of submarine with internal ballast tank and movable control surfaces (Source: Adam Carlson)

If we were to take on even more water, the boat would begin to accelerate in the downward direction. Similarly, if we were to expel some of that water from the boat, it would begin to accelerate towards the surface. This allows the boat to be controlled in depth, even when the hydrodynamic surfaces are no longer able to do so. While there are many methods to control ballast in a radio-controlled submarine, I have chosen what is referred to as a piston tank. This is effectively a syringe that is equipped with a motor that moves the plunger in and out. For the particular boat that I am currently building, the piston travels under 1.5" (~38mm). Once again, this is not the only method of controlling ballast, but it is the most effective way for small boats to have the combination of a compact package and precision control.

Basic piston tank with no control elements (Source: Adam Carlson)

There are a couple of ways to add precision to the ballast tank. One technique that has been employed in the past is to use limit switches and a hall-effect sensor to detect both the end limits of the tank as well as count the number of turns the motor or drive nut makes. This is a simple setup that is similar to using a stepper motor. One challenge comes in the fact that one must start at a known position/state before counting turns can take effect. Another challenge is that the plunger is only held rotationally by the friction of the O-ring and can slip from time to time. And yet another challenge in the case of very small boats (such as the ones I like to work with) is that all these limit switches take up space that could be used for batteries or other components. One reason to not go down this path is that everyone does it (I like to challenge the norm). Sometimes designs converge on an optimal solution and there is no room to improve, but this rests upon the assumption that nothing has changed in underlying technology since the design converged. Since this traditional design converged, for example, cell phones have evolved from bricks that could barely fit into a briefcase to a supercomputer loaded with sensors that fits nicely into your pocket. Some of the sensing mechanisms that have come along for the ride are optical proximity sensors, capacitive sensing, inductive sensors, and time of flight sensors (yes still optical, but not in the traditional sense that has been used in cell phones up till a few years ago). Each of these technologies has its own plusses and minuses for this particular application; let's explore some of them... Since I only need to measure a small distance, an optical proximity sensor could fit the bill nicely. Vishay has a series of nice packages that include both an LED and the sensing element, all measuring under 2.5mm x 5mm. These devices work by emitting a beam of light, and then measuring the strength of the reflected signal. In particular, the Vishay devices have 16bit resolution and controllable output intensity. There is, however, a downside to these devices for this application. The issue is that they have a very non-linear resolution. This is due to the fact that the light is emitted in a cone and the intensity of the light hitting the target is proportional to the inverse of the distance squared from the target (it may be the inverse of the distance cubed; I need to go back and check a few application notes). This means that when the target to be measured is close to the sensor, the resolution is ultra-fine, but as the target travels further away, the resolution drops of in the previously-described non-linear fashion. A workaround could be to linearise the output via a lookup table so as to translate it into an actual displaced distance. The advantage of this system is that it is very small and easy to implement as a PCB with all the electronics required to drive the motor and measure the plunger displacement. This may make it a winner in this case.

Integrated PCB endcap with mounted optical proximity sensor (Source: Adam Carlson)

Another concept I've looked at is capacitive sensing, but not using the traditional method. Typically, we see capacitive sensing in a non-moving element that detects changes in capacitance due to objects which come close enough to cause a local change in capacitance. In my case, I am thinking of using the plunger and one of the endcaps as a set of parallel plates and measuring the change in capacitance based upon the change in distance. You might think that I am completely off my rocker, but performing a quick back-of-the-envelope calculation shows that this setup would have a nominal capacitance of ~0.1 pF in the most extended position, and ~1.0 pF in the closed position. Once again, however, this approach is not linear as the capacitance is inversely proportional to the distance between the two plates. I also believe that this implementation would be subject to noise as I would have to connect the plunger to an electrode via the drive nut or the wall of the device.

Parallel plate capacitor method (Source: Adam Carlson)

This lead me to think about inductive sensing, which really encompasses two approaches. The first is to use an inductive gear tooth counter to physically count the "teeth" of the lead screw. Unfortunately, my leadscrew is made out of 303 stainless steel and will not work with typical gear tooth counters. There is a nice little unit made by POSIC out of Switzerland. This would allow for an advancement on the current state-of-the-art by actually sensing the displacement of the leadscrew (integrated indexes could be fabricated into the leadscrew to indicate the end-point travel locations). This would significantly miniaturise the current state of the art and it still could be an option, although the devices are a little costly at the time of this writing.

Inductive gear tooth sensor being used to count the threads of the leadscrew as if they were gear teeth (Source: Adam Carlson)

The second inductive approach is to actually create an inductive proximity sensor using the relatively new inductance-to digital converter product line from Texas Instruments. This series of devices uses coils that are etched onto a PCB to detect a target. Using this approach, I would make one of the endcaps of the piston tank out of a PCB with the coils already designed in. This would also allow for the mounting of the mechanical hardware onto the same PCB. I pulled up the TI WEBENCH Designer to take a look at how this might work. Sadly, once again, the result is non-linear; even worse, it has vastly different responses over certain ranges (admittedly, I am trying to use it in a fashion for which it was not intended). This would be fun to make work, but I do not think that it will fit the bill for this particular project.

*Inductive sensing with the endcap being made of a PCB with integral sensing coils (Source: Adam Carlson) * There are a few other approaches I can think of, including capacitive liquid level sensing, ultrasonic distance measuring, radar (such as those really cool chips Google is working with in their new watch concepts), but all of these have drawbacks, such as the fact that they vary significantly depending on the environment in which they will be working or that are not currently available to the public. Other methods, like the technique used in inductive calipers, could work, though the actual cylinder of the piston is made of aluminium, and this would cause issues with this approach.

Overall view of how the watertight compartment and its components fit inside the RC submarine (Source: Adam Carlson)

I am, of course, open to other ideas. Above we see a general diagram of the watertight compartment that is used for this project. Observe that—in this particular implementation—there is water in the submarine surrounding the watertight compartment.