# Public Lab Research note

by donblair | 14 Apr 17:52

Some quick updates on some RIFFLE prototyping we've been doing ...

After some great conversations with the CREATE lab at CMU about their - CATTFish water quality sensor prototype, we decided to simply our conductivity measurement electronics, basing our design on theirs. A description follows.

First, we were testing out our process for 'potting' the RIFFLE sensor electronics -- i.e., gooping it all up with adhesive to protect it from the surrounding water. We're using a special, optically-clear adhesive, and the hope is that this particular material will not only protect the electronics from water, it'll allow us to shine LEDs through the adhesive into the water (thus the 'special, optically clear' part) and measure the amount of light that is reflected back -- a way of assessing optical water properties like turbidity (potentially related to the amount of 'undesirable stuff' in the water).

Some initial 'potting' tests are depicted here:

We're still nailing down the best way of doing this -- some ways of preparing the adhesive seem to leave little bubbles that obscure the optics -- but a few of our trials have produced really nice results. You can't see it so well in the dim picture, but the adhesive in the one on the right has formed a nicely-clear adhesive window. More updates on optimizing that process, anon.

One thing we did nail down at this point was: our two-wire conductivity design is a royal pain to assemble. We got to thinking about alternatives, and came up with the idea of using stainless steel (stainless in order to avoid corrosion) screws, instead of parallel wires, for our conductivity measurement.

So Ben quickly removed the 'grooves' that had held the nichrome wires, and added some holes to accommodate some screws. The two holes closest to the 'camera' in the 3D mockup below are the screw holes -- the idea being that the top screw 'pads' are exposed to water, and the bottom shaft of the screws are inside the adhesive, where they are connected electrically to the remote board:

We're calling this the 'Deranged Piglet Edition'. If you'd like to play with the design using openscad, here's the design file: water-quality.scad

Okay, so now if you imagine looking at that cap from above, with the screws on the left, that'll allow for a discussion of the new conductivity circuit. Note that we have a Public Lab logo on the very top of the 3D Riffle cap, so that's why you're seeing boots in the diagram:

(You should also imagine that the electronics depicted is all contained inside the yellow cap. Maybe this was a silly way to draw it.) Here's the idea ...

• First focus on the part of the circuit that begins at the "IN" (at the top), connects to a resistor, R, and then to a screw (The white circle with a has across it). Up until that screw, all of the electronics is inside the waterproof cap, and we connect to the bottom part of the screw inside the cap; the top part of the screw, however, is sitting the water.
• The "IN" pin is connected to the RIFFLE electronics hardware, and we can control the voltage on that pin: we can program it to be at e.g. 0 Volts, or 3.3 Volts, etc.
• The other screw (the lower one in the diagram) also has its head in the water, and sits close to that the first screw.
• Inside the waterproof cap, we connect that lower screw to some other electronics. For now, focus on the capacitor, C.

Let's say we start out with "IN" at 0 Volts, and the capacitor "uncharged". What happens if we suddenly program "IN" to be at 3.3 Volts?

• Applying 3.3 Volts on "IN" means that we'll charge the capacitor, C: charge flows from "IN", through R, and to one of the screws outside the cap, sitting in the water. Then it jumps through the water, across to the other screw that's sitting in the water -- and the down the wire to the capacitor C, charging C up.

The rate at which the capacitor charges, though, depends on the rate at which current can flow through this circuit. And that rate is determined by the resistance, which is a combination of the resistance we put in the circuit (R) and the electrical resistance of the water between the screws. Whee!

So, if we can measure the time it takes for the capacitor C to charge up, we're essentially measuring how easy it is to pass current through the water. And this is (with some additional, unexciting math) what we're looking for when we're trying to measure the 'conductivity' of the water. This electrical property tells us something about how much 'stuff' is dissolved in the water -- bits of various materials, salt, etc -- and this is one way of getting a basic picture of the 'quality' of the water.

And so the rest of the circuit is just some added electronics for measuring the rate of charging the Capacitor, C. We pick a reference voltage, Vref, and we compare the voltage across the capacitor (Vout) to Vref (using a 'comparator' -- the triangle device in the circuit). When Vref >= Vout (which will happen at some point as the capacitor is charging), we get a signal at "OUT" telling us that we've charged the capacitor C to a certain point. The time it takes for Vout to equal Vref is then our basic measurement of the 'charging time' of the Capacitor, and thus (through some other math) the 'conductivity' of the water.

(Note: in reality, we need to 'charge' and 'discharge' the capacitor repeatedly, measuring the charging time over and over again, in order to have current flow both ways between the screws, and not 'polarize' the system -- which would affect our readings, and would tend to corrode the screws. More on this in a later note.)

Okay, so with this approach in mind, let's test it out! To avoid having to print out the entire 3D RIFFLE cap each time, we designed a smaller version of the cap, just big enough to hold the two screws:

(And here's the design file to play with: conductivity-jig.scad)

Ben printed out his design, attached the screws to some wire probes, and here's what it looked like:

Then he tested it out!

And ... huh? We got some really weird results, which we don't yet understand:

More on this soon, but suffice to say that the lower part of that graph is what we'd been interpreting as something like the 'conductivity vs time', and this data is sampled once per minute, starting last night at around 9 pm, and ending this morning around 10 AM. Rather than staying at a steady value, it was always drifting upwards ... until it seemed to plateau after being allowed to sit overnight. Weird. We've been thinking: maybe it's an effect of temperature? Maybe it's something to do with the material of the screws (we were just using some non-stainless screws, which had been sitting around ...)

So today, as an experiment, Ben decided to use some stainless steel wire he had on hand, and make an alternative rig:

He tested it out quickly this morning, and it yielded a much nicer, stable signal (it may look noisy, until you realize that the noise is at the same level as the 'noise' in the previous plot -- we've zoomed in considerably ... i.e., this would appear like a flat line on that earlier plot):

Is this because we switched back to a 'two wire' geometry? Is this because the screws we used had some weird stuff / residue on them? We've got two stainless steel screws coming in the mail on Wednesday ... more tests then!

## UPDATE

Check out our new results in this research note!

Great progress!

I would bet that the screws you used before were transferring ions to the water, and that the stainless corrodes more slowly. Looking at the image, it looks like the earlier screws were light steel or stainless though-- I would expect to see some degradation of light steel or galvanized.

as for potting, are you using an epoxy, or an air-drying medium? If you can let the adhesive settle out for a few hours, the bubbles will go away. A quick, zig-zag pour with no overlapping trails of glue will minimize the bubbles.

If its an epoxy and you have to get rid of the bubbles fast, use a vibrator. I found a vibrating foot massager at a yard sale that worked really great, also, you can tape a random orbital sander in place on a table.

Is this a question? Click here to post it to the Questions page.

Thanks, Mat!

Great point re: the type of metal being used. The earlier screws weren't stainless, I don't think, (I think Ben just found them lying about his apartment :)) and the stainless steel wire he used this morning was "316", i think -- which apparently is much better for these purposes. Another cheap source of small bits of perhaps-appropriate metal we found on Ebay the other day: nose rings! But looks like little screws will be easier to manage. Hopefully this was the main issue.

Going forward, though -- I just came across some 'four electrode' designs, in which one energies two outer electrodes, but measures the potential difference across two inner electrodes -- a way of reducing electroplating / corrosion. If better steel helps our measurements, but we still see corrosion over time, maybe this is an approach to consider ... ?

Re: potting, we're using some advanced PDMS (I'll dig up the reference) material that requires initial mixing and then cures in the air. To speed up the curing process (heavily affected by temperature, and Ben's heat was broken last week), we placed the caps in a toaster oven for a bit. The bubbles we witnessed in some of them might. we're thinking, a) be because we didn't let the bubbles percolate out sufficiently before popping them in the over -- as per your suggestion -- and / or b) because we'd also used some standard silicone underneath and around the PDMS, and this might've created the bubbles.

Nice info on the quick zig-zag pour, and GREAT info on the vibrating foot massager! That's brilliant. Will look around for one ...

Thanks!

Is this a question? Click here to post it to the Questions page.

That "four electrode" system gave me an idea-- what about just using a 1/8" mini jack, one of the "three band" ones with a mic line too, as is now standard on phone headsets? its a standard part, its coated in nickel (and some of them even in 14k gold!) and it has four electrodes with a standardized spacing, and it comes pre-wired. If it was waterproof enough, it seems like it would be a perfect part. There's a nickel-plated one on digikey-- I think it might be possible to screw it through a waterproof housing too: item CP-35401SP-ND.

Now I'm imagining someone walking into your kitchen to find a toaster oven shaking violently. "uh, this is for science!" On Amazon, there are a series of $10-20 vibrating, and sometimes heating, lumbar pillows that might be the perfect thing. just strip of the soft part. Is this a question? Click here to post it to the Questions page. Reply to this comment... what about just using a 1/8" mini jack, one of the "three band" ones with a mic line too, as is now standard on phone headsets? Brilliant idea! Standardized spacing, and pre-wired, FTW! And revisiting the four electrode idea led to some great discussions this evening with Ben. Going to dig into this. Now I feel we must find a way to vibrate our toaster oven with stripped-down, electric lumbar pillows. Oh wait -- and maybe we can even gently cure our adhesive with the ones that promise heating action? And ... sponsorship! "Do you have persistent back pain?" "Do you also have water quality issues in your home, or at your workplace?" "NOW, for only FOUR INSTALLMENTS of$19.95 ..." [blinking text]

Is this a question? Click here to post it to the Questions page.

Tired of water quality sensors that leave your back aching? Try Riffle!

With Riffle you just set it and forget it, no more painful backbends to sample streams! Just sit in our special Riffle Science Chair with massaging action and let Riffle do the science for you!

ORDER NOW

Is this a question? Click here to post it to the Questions page.

Is this a question? Click here to post it to the Questions page.

I would love to beta test this... I am working on something like this... FYI go to your local welding shop and buy stainless steel welding rods... they sell via the pound and are easy to cut with a chop saw... Bend a loop in them and attach with large head lath screws...

See the website for more info on SS rods... If you are in the US Airgas is all over... http://www.airgas.com/browse/product_list.aspx?catID=144&WT.svl=144

Is this a question? Click here to post it to the Questions page.

Hi unmanaged -- it'd be great to have you as a beta tester! We're going to be ordering a new round of prototypes very soon, and we're hoping to have some in during the next few weeks. And: we'd love to see what you're up to, if you have some time to share your own work (photos, diagrams) on publiclab.org as well -- it'd certainly be helpful to see your approach.

Great suggestions on the stainless steel welding rods. We've got some stainless steel screws coming in from McMaster-Carr tomorrow, and we're hoping that these will will make for some nice, cheap electrodes ... Stay in touch!