Passive (enough) and solid-state liquid conact sensor

I found these little guys last night, and I thought the operating principle was just too fascinating not to share! They’re passive(ish), sealed, solid state liquid contact sensors:

It’s an IR LED and photo-transistor pair in a plastic housing. The emitter and detector are positioned with respect to the lens such that total internal reflection occurs, and the photo-transistor is normally on.

Side note: Total internal reflection is awesome! Remember from junior high science class, light travels at different speeds in different media, in this case light travels slower in the plastic housing of the sensor than in air. When light crosses a boundary between two materials, it immediately speeds up, or slows down depending. When a beam of light hits this boundary at an angle, this speed change results in a sharp bend in the beam at the boundary. When the light is traveling from a slower medium to a faster medium, it bends back towards the boundary, and past some critical angle (depending on the difference between the refractive indices of the two media) the light is actually bent back around to the starting side of the boundary:

If you have a flat-sided fish tank around, you can look straight through it and see what’s on the other side. If you look in one side and out one perpendicular to it, you should be able to move your head side to side and see a reflection of the inside of the tank forming and disappearing. That’s total internal reflection.

Diamonds have a very high refractive index, and total internal reflection is what gives them their distinctive sparkle (and one way a trained jeweler can tell a cubic zirconia by looking at it). Total internal reflection is also why fiber-optics works, as well as the cool experiment of bending a laser (or even just a flashlight beam) in a curved stream of water:

Anyway, this is super cool because you can have this sensor out in the air or probably even touch it with your finger, or pack it in dirt for that matter (mine is still in the mail, so I’m not 100% sure of this) and the detector will still be triggered by the internally reflected light from the emitter. But any liquid will have a refractive index closer to that of the plastic housing than the index of air. Let a liquid touch the lens, and suddenly the light passes out of the lens instead of being internally reflected. The output drops low, and you have detected liquid contact!

A few months ago I built a little microcontroller rig to check if water was touching a stainless steel probe in a bioreactor in my wife’s lab, using the water to conduct a tiny current. This worked very reliably, but wreaked total havoc with the pH meter in the reactor (electronic pH meters measure the minuscule voltage produced by hydrogen ions in an acidic/basic solution, so ANY charge whatsoever in the solution totally messes them up). The company that made the reactor (and the probe) offered to sell her like a $10,000 complete reactor monitoring system, that did 500 other unnecessary things in addition to monitoring contact with the level probe. When she didn’t want to buy that, they told her to go get a level sensor controller chip that has been out of production for like a decade!

Float sensors are out of the question, since space in the reactor is tight (think 6 liter, $20,000 pickle jar), and it has to be kept sealed and oxygen free. Plus ideally this should be operating for years at a time, so mechanical linkages are undesirable. Conductive sensors are no good for obvious reasons, and capacitive (non-contact) sensors probably wouldn’t be precise enough, and certainly wouldn’t work through the water jacket, an outer jar of circulated water surrounding the reactor to maintain its temperature. I was just on my way to radio shack for some op-amps (which I’m not sure would do the trick anyway, although I’m assuming it’s how the professional reactor monitoring system does it) when I spotted these little guys!

They’re perfect for this laboratory application, passive (enough), sealed, and solid-state! They come in a small variety of sizes, most are available from Digikey, and run $20-$30. They’ve got an internal voltage regulator and all the necessary resistors, so you just feed them 5V to 12V, and watch the TTL output wire!

I’ve got one in the mail for my wife’s lab, but if it works as well as I think it will, I can totally see it in more of my robotics applications in the future. Right now I’m imagining a diving/surfacing AUV (Tom) studded with a couple of these to tell when it has reached the surface.

Anyway, hopefully this will arrive on Monday or Tuesday, and I’ll post with some idea of how well they actually work. Science is awesome!


1 Like

Hi Adam,
I’d like to hear more about this bioreactor. Six liters of fermentation running for years at a time at a constant temperature with lots of probes to measure what’s happening? Sounds like something exciting is going on in that pickle jar.

The sensor came today, and like most things I get way too excited about, it’s not perfect, but it’s still very cool.

It does sense liquid in contact with the lens immediately and repeatedly, but if you dunk it quickly in water, sometimes a drop will stick to the lens that is just large enough to continue triggering the sensor until it falls off. Slowly raising the sensor out of water avoids this problem, which makes sense, since its meant to sense the gradual change in fluid level in a tank. Holding the sensor facing sideways or up, a drop can’t form, so it would still be great for an AUV surface sensor.

The other potential problem is that enough ambient near-IR light shining directly into the lens will make it think it’s in air while it’s still in water. The light has to be extreme though, I had to hold my 60 Lumen incandescent flashlight pointing directly at the submerged sensor lens, and bring it to about three inches away before it erroneously reported it was out in open air. I doubt that even direct overhead sunlight would set it off, but I wasn’t able to test this as today wasn’t a particularly sunny day in Michigan (and by the time the weather improves this guy will be in the bioreactor!).

Speaking of which, Paul, my wife’s PHD research is characterizing an anaerobic membrane bioreactor (AnMBr) for treating domestic waste water (i.e. toilet, sink, shower, storm runoff). Basically she’s running a little bench-scale sewage treatment plant (with SYNTHETIC wastewater before you ask). She just finished a ~8 month trial run to identify and address all the problems with the system and procedures (I think the level sensor pH meter conflict is the last one) and she’s gearing up to run the reactor continuously for the next couple of years!

Here’s the deal:

Synthetic wastewater concentrate is stored in stirred, refrigerated container, and pumped through a mixing tube where it is combined with dilution water and trace chemicals to make fresh fake toilet-water. This ‘influent’ water goes into the main bioreactor, a many-thousand-dollar glass jar within a glass jar.

The outer jar acts as a ‘water jacket,’ and has temperature controlled water (heated or cooled and pumped by this great little external heater/refrigerator box) circulated through it to maintain the reactor temperature. The inner jar holds 5 liters of wastewater with 1 liter of gas space, and granular anaerobic biosludge (kindly donated by an Anheuser Busch brewery’s treatment plant). The reactor vessel is sealed gas-tight, with a rubber gasket and stainless steel headplate with ports for a barrage of sensors.

The water in the reactor has a temperature probe, a pH probe, a pressure monitor, and a level sensor (which will soon not interfere with the pH monitor). The water can be stirred periodically by an impeller driven by a stepper motor. To maintain the seal, the impeller is magnetically coupled to the motor though the headplate! Methane gas produced by the microbes out through a bubble chamber, and through a gas-flow volume meter (and into a fume hood so as not to make the room flammable).

Wastewater is pumped into the reactor at a constant rate, and whenever the water in the reactor is above the preset level, a second pump draws ‘effluent’ water out of the reactor, into a circulation loop. A pressure regulator allows water from the circulation loop back into the reactor to maintain the loop pressure at I think 80 PSI. A third pump keeps water circulating around the loop, and across an ultra-filtration membrane, with pores small enough that they catch microbes! The water that makes it across the membrane is either safe to release into the environment, or needs slight chemical “polishing.”

Using microbes to digest chemicals in wastewater can be a lot more cost effective and environmentally friendly than plain chemical treatment, as most of the bad chemicals are trapped in the biomass (microbe poop and dead cells) which can be mechanically separated. Anaerobic microbes grow more slowly, but as a result produce less biomass, and as an added bonus produce methane gas, which can be used to heat the reactor, bubble-scour the membrane, and generate energy to run the plant (and maybe even sell back to the grid! Imagine a public utility becoming a profitable industry! They would pay you for your toilet water! Well, probably not).

Finishing with an ultra-filtration membrane catches any potentially harmful bacteria, so you don’t have to use sterilizing chemicals or treatments on your effluent water. Of course, clogging membranes are a huge problem, which is what my wife’s research is focusing on right now, and partially why no one has made an AnMBr based treatment plant yet. It’s not that it can’t be done, just that the technology is relatively new, and hasn’t been completely studied yet.

Anyway, it’s been extremely fun for me having none of the stress of that project hanging over my head, and not having to do any of the chemistry or biology, while getting to help from time to time with the design of the system control hardware and software. The waterproof epoxy is drying on the new level sensor probe right now!


I still think these little guys are very cool, but they only really work if the lens is kept clean. They’d probably be fine for monitoring levels of sterile chemicals, or even water in an opaque tank, but once something starts growing on the lens, well, that’s it. If something like algae or mold grows over the lens it will absorb the infrared light and the sensor will think liquid is covering it all the time.

Now, to be fair, I was probably asking way to much of these little guys. My use for them was monitoring the level of warm synthetic sewage in a bioreactor treatment vessel, teeming with methanogenic microbes! After about a month the sensor starts needing to be wiped off weekly, and after a couple of months whatever has colonized it grows back in a thin black film about every day, and you need to scrape it off with a fingernail. I just put in a third new sensor, so I think it’s time to look for a replacement.

In terms of robotics applications, I still think these would make great “I’m at the surface” detectors for AUVs, but probably more for the chlorinated swimming pool type bots, or even wild day-trip swimmers (although coming up under a wad of seaweed might cause the same problem, especially that translucent green sheet stuff). I would be worried about using these on longer haul, crossing the ocean and satellite-phoning back GPS position type AUVs. I threw one in my freshwater fish tank for a month and it grew a nice algae film right over it.

Back to the search for a robust passive level sensor!