Katie explaining how the 555-based audio conductivity meter works. The sensor she built was able to distinguish, via audible tones, between "groundwater runoff" and "seawater" levels of salinity. Credit: this brief interview with Katie was filmed by Heather Craig, and was edited by William Everett.
On Saturday, July 12, a fine bunch of folks gathered on the 5th floor of the Media Lab to talk about water!
A few weeks ago, Public Lab had received generous support from Rackspace for an Open Water event in July; and we decided to use the funds we'd received towards holding a workshop focused on exploring 'conductivity)' as an important and widely-used water quality parameter. In addition to facilitating a group discussion on the topic, we hoped we could work together on prototyping a simple, inexpensive way of measuring conductivity: there are some situations (like suspected fracking contamination of house tap water) in which simply knowing that there has been a recent 'spike' in conductivity can be sufficient to indicate a serious water quality problem -- so having an inexpensive, accessible tool that indicates conductivity spikes could be very useful!
After a great discussion in the first few hours of the workshop, we ended up making great progress on the electronics. By the end of the workshop, we had:
- built simple, cheap 555 conductivity meters on a breadboard
- demonstrated that we could distinguish solutions of varying salinity from one another using this circuit
- added an 'audio' component to the circuit via a piezo buzzer, allowing one to 'hear' the conductivity of solutions -- neat!
- wired up an audio jack to the circuit, so that the resultant audio could be recorded on a smartphone or laptop
- tested out browser-based pitch detection software -- different levels of conductivity can now be assessed using only the browser!
- had lots of fun!
The workshop begins ...
The event started a little past 11 AM, with the following folks eventually gathering in the conference room that Catherine d'Ignazio had so nicely reserved for us.
The first part of the workshop involved a wide-ranging discussion around the water quality projects that have been brewing within the Public Lab community.
- Heather Craig
- Wang Yu
- Craig Versek
- Jiansheng Feng
- Christine Walley
- Lily Bui
- Melissa Eliot
- Katie Gradowski
- Will Macfarlane
- Eben Pendleston
- Don Blair
After introducing ourselves, we had a great, free-form discussion about water quality for the first two hours of the workshop. Some of the topics included:
- Public Lab's Riffle open hardware water quality monitor
- The ways in which inexpensive, non-proprietary sensors might allow for new and important questions to be asked and answered in water quality
- What a distributed water quality monitoring effort might look like, and some of the associated challenges
- How we might calibrate open hardware sensors
- Brainstorming ways of developing community support structures for distributed water quality monitoring efforts
- Suggestions for organizations with whom to partner on these efforts
- The notion of setting up 'tool libraries' for water quality monitoring in libraries and community centers (places like Parts & Crafts).
Whiteboard writings from first few hours of discussion.
Basics of conductivity
After a great discussion, we ordered pizza, and started working on building our own DIY conductivity sensors. We soon realized that we needed to be clear about what conductivity actually is. Craig lead us through a nice discussion on the whiteboard ...
Craig's impromptu lecture provided us all with a useful overview of how conductivity is measured ...
Craig's depiction of a basic conductivity measurement. Also, see the Wikipedia entry on conductivity).
Aside: here's a great primer from Fondriest for those unfamiliar with how conductivity is measured.
First: creating a resistance-dependent oscillation circuit
Folks then quickly dove into building the circuit, with the idea that doing so would make for a good, hands-on way to get a feel for how conductivity works.
The basic circuit we aimed to assemble is very 'simple' when it comes to the electronics world. Here's the basic idea:
There is an inexpensive ($0.50) chip called the '555 timer' which, when connected to a few resistors, capacitors, and a power supply, will provide an oscillating output voltage. The rate of this oscillation depends on one of the resistors in the circuit. So, for example, one can hook up an LED to the 555 timer output, and control the rate of LED blinking by changes the value of the proper resistor. In our kit, we had a 555, and LED, and a component that provides user-controlled resistance: a potentiometer. The resultant circuit was the first circuit we aimed to build in the workshop. [More on how that connects with conductivity further down this page ...]
We based on assembly on a design put together by Ben Gamari, based on another circuit we found online:
The circuit we assembled at the workshop ... [note: this version works!]
For reference, here's a schematic showing a similar circuit:
Reference schematic for the 'astable 555 timer circuit', which oscillates at a frequency controlled by resistors in the circuit
The way this 555 'astable' oscillating circuit is constructed, the oscillation frequency of the output will increase as the resistance value R2 decreases.
For reference, here are the parts required to build the circuit, with associated costs. We aimed to be able to build 10 kits in the workshop, so some of the items are priced in units of 10 (with a few thrown in, just in case):
- 10 x Half-size breadboard[ID:64] = $45.00
- 1 x Breadboarding wire bundle[ID:153] = $6.00
- 10 x Waterproof 2xAA Battery Holder with On/Off Switch[ID:770] = $35.60
- 10 x Piezo Buzzer (PS1240) [ID:160] = $13.50
- 10 x Breadboard trim potentiometer (10K) [ID:356] = $11.30
- 1 x Super Bright Blue 5mm LED (25 pack)[ID:301] = $8.00
- 12 x 555 timer integrated circuit, LMC55CN/NOPB-ND = $13.73
For 10 kits, this ends up being under $14 per kit -- not bad!
Here's how the parts arrived to the workshop:
555 timer conductivity circuit parts
Folks quickly dug into those boxes and found what they needed!
Everyone starts assembling the circuit ...
Don placed his schematic on the main screen, so that everyone could reference it ...
Intense concentration ...
Really digging in ...
Eben wondering why his circuit isn't blinking ...
Katie wondering why her circuit isn't blinking ...
Yu and Katie puzzling over their circuits ...
At some point, Will pointed out that Don's schematic was wrong all along:
Will quickly figured out how to fix the error, and everyone was quickly able to build a working 555 timer circuit very easily, with a flashing LED controlled by a variable resistor (potentiometer):
Aside: later that evening, Lily -- who missed the prototyping segment of the workshop -- was able to follow the corrected schematic at home, and afterwards tweeted in her successful result:
Using the oscillator to assess conductivity
In order to move from simply blinking an LED to a conductivity measurement, the plan was then to replace the resistor which was controlling the 555 timer oscillation frequency with a 'DIY conductivity probe': two stainless steel screws poked through a plastic water bottle cap. When the probe is dipped into the water sample the resistance of the water between the two screws now controls the LED frequency. (For those who are following the schematic above: the conductivity probe replaces "R2" in the schematic). A simple way to visualize relative changes in conductivity!
Because the oscillation frequency will increase as the resistance value R2 decreases, now that we're using water in lieu of the resistor R2, we expect that the oscillation frequency will increase as the conductivity of the water between the two metal screws increases. I.e.: the greater the oscillation frequency we observe, the greater the conductivity of the solution in which the probe sits.
To construct the conductivity probe, some of us simply used the water bottle cap: sticking the screws through the cap, and connecting wires to the screw ends on the inside of the cap:
As you'll see in some of the videos later, this led to trouble: the cap often ended up sinking into the water sample, submerging the entire cap and dunking the alligator clips into the water, so that instead of measuring the conductivity across the stainless steel screw tips, the measurement was of the conductivity between the alligator clip ends. Not good!
It turned out that a better way was to keep the top half of the bottle attached, which served to keep the wires away from the water:
The water bottle cap conductivity probe.
In advance of the workshop, Craig had carefully measured out various amounts of table salt in order for us to be able to be able to prepare some water samples whose salinity matched some [real-world examples]:
A few days before the workshop, we'd found a nice table of salinity values for some typical real-world scenarios:
(Note: a good reference for conductivity references and conversions is here.)
Craig had prepared several vials of table salt, in masses appropriate for mixing with 100 mL of water in order to generate samples that matched the concentrations in the above table values:
We should have used distilled water to create the solutions, but we didn't have any handy, so we used the bottled water that came in the plastic bottles (although next time we'll ask every participant to find a recycled water bottle to bring!).
So we then measured out 100 mL into the 'bottom half' of the plastic water bottles (which we'd cut in half earlier to make the probes) ... and added the various salt amounts that Craig had prepaired to the 100 mL volume of water:
- Solution no. 1: No salt (distilled water).
- Solution no. 2: 100 mg (low salt).
- Solution no. 3: 425 mg (medium salt).
- Solution no. 4: 1100 mg (high salt).
- Solution no. 6: 5000 mg (brine - similar to salt water).
(Not sure what happened to number 5! I think it was dumped accidentally in the process of mixing ... )
Craig and Melissa creating solutions of varying salinity ...
We all then started exploring how solutions of varying salinity affected the rate of oscillation in our circuits, by watching the LED blink rate change as we dipped the probe in to the various samples ...
One issue with assessing conductivity through the blinking of an LED is that when the blink rate exceeds a threshold value, the [human eye can't discern the individual blinks -- and although the LED, which then seems constantly lit, might vary slightly in brightness, the differences might be hard to discern.
So we tried replacing the LED in the circuit with ... a piezo buzzer! At low frequencies, we heard 'clicks' at a certain rate; and as the frequencies increased, we began to hear tones.
The oscillation frequency of the circuit output increases with increasing conductivity. (Keep that in mind when watching the videos / listening to the audio track below!)
Will does a nice job explaining how this measurement works in the following video:
Don also attempts to explain the setup in this video:
(And recall that Katie also does a great job explaining the concept in the video at the top of this research note.)
Afterward, we all spent several happy minutes making solutions 'sing' their conductivity values ...
... and then Craig and Jiansheng began to work on seeing whether, instead of a piezo buzzer, they could simply hook up an audio jack directly to the laptop, and record / display the resultant oscillations as a 'sound input':
Yu determined that we'd probably be safe if we dropped the input voltage down to below 1.3 V (it began at 3V, due to the 2 X AA batteries powering the circuit); so Jiansheng and Craig used the potentiometer in the kit to create a voltage divider, dropping the input down below 1 V (if I recall correctly):
Once we had the audio jack setup, we navigated our browser to an open source, browser-based 'pitch detection' page (really fun!) that determines the dominant frequency in an audio input signal (of the sort that our circuit was now providing):
You can test this browser-based pitched detection live right now, here!
Here was our very first test of getting the browser to 'recognize conductivity levels' via the laptop audio input jack (spoiler alert: it pretty much worked!)
[Warning: the following video involves some overly-gleeful exclamations from Don ...]
Notice that the final sample didn't quite register as a separate frequency. As Craig points out in the video, we're still not quite sure how the frequency-detection algorithm works; we thought there could be issues with our input frequency being too high; or with the fact that the algorithm expects a sinusoidal, rather than a sawtooth wave (of the sort we presumed ours was)
We tried the test again:
This time, we noticed that two of the solutions were no longer very different. This was likely because of 'cross-contamination' of the sample preparations -- we were constantly dipping the same probe in the various solutions in a random order, and we probably ended up mixing the various solutions together this way, changing their salt concentrations and diminishing any differences among them.
Recording conductivity values on a laptop via audio jack
To finish off our investigations, we decided to use a popular open source sound recording program, Audacity, in order to record the audio input values. (We were curious as to what conductivity 'really sounded like'!)
Because our solutions seemed contaminated, we started off with a containr of fresh tap water, and simply added salt to that container in between samples. You can hear the results by pressing play in the audio recording below:
Our recollection is that the probe begins in air (minimal sound), and then is placed in tap water (Warning -- you'll hear an alarm-like BUZZ! You might want to turn your volume down ...). We then added in some salt, with the probe still in the solution (you'll hear the frequency increase, smoothly) ... and then we took the probe out of the water (sounds like a record player needle scratch, and then silence) ... added some salt, and replaced the probe (BUZZ! but this time at a higher frequency). We tried this several times; but because we weren't listening to the audio 'live' while doing it, we weren't quite successful and generating noticeable differences in frequency with each sample:
In retrospect, one issue is probably that, in this experiment, we were only adding an 'additional pinch of salt' in each iteration -- the same amount of salt each time, more or less -- whereas our earlier solutions (which displayed noticeable differences in frequency) had concentration differences that increased ten-fold with each sample. We're eager to try the experiment again, with greater differences in concentration (or a revised circuit, with greater sensitivity).
We tried a second time quickly before wrapping up:
At this point, we all agreed that we'd had an incredibly productive workshop session -- and that it all went so well because of all of the really great folks who showed up.
A big thank you!
A big thank you goes out to:
... and everyone who came to the workshop!
Thanks, folks -- you were all amazing! Let's gather together again soon ...
Heather Craig and Don Blair co-organized the event; most of the above videos and pictures were taken by Heather, with the remaining taken by Craig Versek.