Testing DIY EC sensors in Papawai Stream

It is the first time I install and test the two EC probes at Papawai Stream. I am close to where the wastewater pipe is crossing the stream. I have decided to audio record myself talking along with my fieldwork for better documentation of my process and challenges in the field. The writing in this post is a combination of re-telling of events based on the photos I took with my mobile phone and a transcript of my audio recording, which has been edited to aid clarity and flow of narrative.

moving The kit from lab to field

I have put together a kit that is transportable by one person. The wooden crates make it easy to carry the probes and they could also play in the role during installation in the field to keep the electronics in place and safely stored outside of the water during the recording of data.

Additionally, I am carrying a backpack with my Thinkpad laptop, and a waterproof bag with additional equipment such as the TDS reader, spare batteries and USB cables and other necessities such as extra jars, paper towels, cable ties, pens, and a notebook. I also take a little camping stool and my smartphone with me. I transport the equipment by car to the Prince of Wales Park and from there carry it from the carpark to the install site.

After a short hike up the council walkway, I reach the entrance to the site where I plan to install my work, just on the left before the bridge. The narrow walking path to access Papawai stream is covered in pine needles, lined by grass, bushes and pine trees.

Path to access Papawai Upstream. Brown narrow footpath in grass lined by bushes and pine trees.

I follow the stream upstream and reach the site that I have scouted earlier as a possible install location. The stream flows on the right side of the walkway. From there it takes me about one minute to reach the install location further upstream where the path meets the water again. I have placed the probes in reused jars, but I have not waterproofed them yet, so I temporarily propped the jars up with bubble wrap to protect the electronics from humidity and insects while making them easily accessible during the testing.

Papawai test Install site showing crates with probes next to stream
Setting up

The Raspberry Pi has been on all the time since I tested it back in the lab, so the Moturoa_Transmissions network is still up and running, but no nodes are connected to it yet. I start unrolling the cables and connect the probes one by one to their batteries. I make sure the crate is in a stable position, so it does not create a hazard once I launch the probes into the stream water.

When I attempt to launch the first probe, I notice it does not easily drown. The water is just a couple of centimetres deep.

Looks weird. Two electrical plugs in the water.

I am also testing whether the new code on my SD card node is working. I have updated the code so that a new CSV file is created every time the node is being reset, as opposed to overwriting any old data, which was good enough for earlier experiments, but now I need a more stable way of collecting and keeping data. I chose not to thoroughly test the SD card code in the lab because the main focus of this experiment was to evaluate the functionality of EC probes and I needed to get into the field as soon as possible to avoid having to work after dark.

I notice I haven’t brought a dedicated battery for the temperature probe, so I need to use the spare one from the equipment bag. The temperature probe is still in the plastic bottle casing from the previous install. It could work if I redesigned the cap to aid with accessibility to charge/change the batteries. The probe itself also still has a stone gaffer taped at the bottom of the wire to add weight to the probe for easier launching into less reachable parts of water. The previous install location at Moturoa Stream was wildly overgrown, and I made this with what I had at hand in the field. I could add some fluoro-pink tape over the black to make the submerged probe more visible as it is difficult to spot under water. The temperature probe got a quite long cable (partly seen on the photo below with red, yellow and black strands) and it already got entangled with a plant around here even though I have just carefully de-tangled the cable before leaving the lab. I am launching the probe into the water close to the already submersed EC probes, but carefully, not to short-circuit the prongs of the other probes.

2 EC probes and temperature probe submersed in stream water

That looks pretty good. I am also taking a panorama of the setup to capture the relationships of the probes with the stream.

Panorama of experiment setup showing a latop on a stool on the left side. Next to the stool are two wooden crates with glass jars containing electronics. Three probes are submersed in the stream visible on the right side. Cables can be seen on the ground.
accessing the sensor data

So now I got the probes in the water, I am moving on to the exciting part of seeing the data, and what values the two EC probes return. It’s quite sunny and dry today, so I thought it would be fine to take my development laptop with me into the field and use it to live-view the data of my devices.

Plants are already losing some bits and pieces on my keyboard.

I spend some time failing to connect to my Moturoa_Transmissions WiFI network  and need to restart my machine. This takes a while and gives me time to look at the probes again. I rearrange them because the cables are overlapping, but find it difficult to place them the way I like because the curl of the cable dictates the placement on the ground. I also notice that the probes disappear when underwater and I could consider adding some elements of color to set them visually apart from the surroundings. While trying to rearrange cables and probes, I notice that it would have helped to bring some gloves since I am not entirely sure if it is safe to touch the water. Additionally, some hand disinfectant as used during the SHMAK workshop would have been a good addition to my carry bag.

My laptop has rebooted, and I finally see my own WiFI network, but I also notice another wireless network named AI-THINKER, which curiously seems to be another ESP8266 based Internet of Things network.

I open a terminal window on my laptop and use the mosquitto_sub command to subscribe to all topics to see all data floating around in my little PubSub network.

This is exciting.

I see EC returning a value of 267 and EC_rua on 276, which appears to be consistent with previous readings, where EC_rua returned a slightly higher value than EC. The readings seem to be remaining constant, which is good.

I don’t see the temperature in the feed, so maybe the battery I used is not working. It does not have an indicator light so I do not know whether it is discharging or not. I will swap the power supply to the spare solar battery I brought along. This one is clearly discharging according to the LED, so I should see a temperature value soon.

Oh yeah, watertemp here we go. 14.2

Now I will cross-check this result (in degrees Celsius) with the temperature my TDS reader returns. So I am stepping down towards the probes and submerge the prongs in the water, and it seems to be about 1 degree off. I might jot these values down in my notebook just in case.

EC is 265. EC_rua is 275. Watertemp sensor returns 14.2°C, the TDS 15.5°C. The TDS reader shows 158 ppm.

concluding the experiment

I would call this a successful experiment, I have collected 15 minutes of data so far. No one has walked past yet. It worked this way, but the gear obstructs the walking path a little, and I need to find a more stable and safe spot for longer installs that can also be left alone for some time. This was easier at the previous install where most devices were installed behind a fence and the others were safely suspended, with just the probes touching the ground without obstructing anyone’s path, sheltered by large Harakeke plants. The jars work well, so I should continue working with them as material and find a suitable solution to make them both outdoor- and longterm install-proof as well as provide easy access to the electronics for charging and possible hardware updates. The electrical cords work, but the way they are lying on the ground like this looks quite ugly. The white colour of the cable helps to set them apart from the dark ground, but I should consider some more thoughtful decoration or support for the cables. Suspending the electronics on one of the fallen trees, as previously planned, could work, but needs some careful consideration of the environment.

Observations and recommendations for next install:

Design development and install

  • Draft some designs, so the probes are stable and visible underwater while not disturbing the natural flow of the stream.
  • Design versions of outdoor-proof but easily accessible lids for glass jars.
  • Overall the electrical cords in this setup are visually not appealing. The white colour sets the cables visually apart from the background, which is good for safety but aesthetically unpleasant.
  • The installation of probes should be tested suspended from trees. This needs additional install tools such as hooks, cable ties and a variety of options should be tested in lab and field.
  • Replicate the probes and connect them within the network. Build three probe pairs temperature & EC and design an output that is accessible from the bridge.

Equipment and electronics

  • Bring all spare batteries just in case.
  • Use a lapel microphone attached to an audio recorder for hands-free recording.

Hygiene, health and safety:

  • Bring some (plastic) gloves to be able to safely touch the water when adjustment of probes in water is required.
  • Add paper tissues and hand sanitizer to the kit if getting in contact with water or dirt.
  • Consider bringing gumboots for installing probes in more inaccessible, boggy areas.
  • To stabilize the setup, I would need to bring something like pegs to fix the cables to the ground.
  • Add some colours to the bottom of the probes or consider using makers to make sensors and cables more visible when submerged in the stream water. Especially the black wire of the temperature probe disappears into the environment.

Lab EC-sensor tests

Before using more EC probes in the field and gathering data from different parts of the stream I tested them in a controlled environment in the lab.

Experiment 1: 

The two versions tested use the same materials, same length of chord and same 560 Ohm resistor. The first test involved a jar filled with tap water, immersing both sensors in the jar and monitoring the data via mosquitto_sub.

Jar filled with tap water for testing two DIY EC probes

Note: The pink tape wrapped around one probe was an attempt to avoid the probe mistaken with a power plug on the lab table, which poses a severe hazard. The probes are stored away safely when unattended to ensure health and safety.  This version of the probe uses the Live (L) and neutral (N) prong of the plug. To improve the safety of the probe the live (L) prong should be removed and Neutral (N) and Ground (⏚) should be used for measuring the electric conductivity. 

The terminal output shows the EC probes publishing the measured values under the topics motorola/ec and moturoa/ecrua. While the test recording was done, the DHT11 sensor was also active in the lab, publishing air temperature (moturoa/atemp) and air humidity (moturoa/ahumid). Output showing values returned by two EC probes (moturoa/ec and moturoa/ecrua) and DHT11 sensor showing air temperature (moturoa/atemp) and air humidity (moturoa/ahumid)

This first test showed a deviation of around 10 between both probes, behaving relatively consistent. The next test would require measurements in the stream to see whether the probes return coherent readings from flowing  water.

Experiment 2:

Due to bad weather and high winds it was too dangerous to conduct testing in the field. However, to get a better idea of the consistency between the two probes I went to an easily accessible part of the stream outside of the forested area and collected two samples of stream water. 

Back in the lab I pour the first sample into a clean jar that is big enough to contain all three sensors. I prepared a paper sheet for keeping experiment notes, starting with date/time, location of sample taken, last weather and readings from the TDS meter at the beginning and end of the test.

  1. I boot the Raspberry Pi (the Pi acts as Wi-Fi Access POint hosting the Moturoa_Transmissions network and acts as the MQTT-broker).
  2. Connect laptop to Moturoa_Transmissions and start log with timestamp
    mosquitto_sub -v -h 192.168.42.1 -p 1883 -t '#' | xargs -d$'\n' -L1 sh -c 'date "+%D %T $0"' > data.log
  3. Immerse probes into water sample and activate by connecting the Wemos D1 micro controllers to power supplies (USB batteries).

The raw data of both test results can be found on the development repository.

DIY Electrical Conductivity: Trial and Error

EC Version 1: Pens, Nichrome and too much tape

The first EC meter I built was based on the instructions by Practical Maker (2011). The probe involves two Nichrome resistance wire attached to an empty pen tube and covered with electrical tape.

The Nichrome wires are soldered to stranded core copper wire from an audio cable and connect via a 10kΩ resistor to the analog input of a Wemos D1 mini. 

For testing I would use the Wemos D1 mini in combination with a small breadboard and jumper wires and header pins connecting to alligator cables to hook up my probe to the micro controller and my computer.

For the test setup I initially submerged the probe in a glass of distilled water. I would read out the voltage via the Arduino Serial Monitor and note the voltage value down in my notebook. I would also take a reading with my TDS-3 meter and note the value down next to the voltage. I would add a measured amount of salt to the water solution and repeat this process.

While the initial voltage readouts looked promising, the material assembly of the probe proved problematic and generated inconsistent voltage readings.

The final assembled design of the first unsuccessful probe


The electrical tape trapped water in between the multiple layers which would generate inconsistent readouts. The probe would also still show conductivity once I lifted the probe from the water solution, which would only slowly drip from the parts and also slowly lift and move the electrical tape. To sum it up, this probe design was not only quite complex and flimsy, but also unreliable in terms of readouts. This meant I needed to look for another solution. 

EC Version 2: Repurposing a wall plug

In a very detailed blog post Ratcliffe (2015) described how to build a EC meter for Arduino for $3. His solution involved repurposing a Type A Two Prong american plug. I took one old New Zealand plug and connected it to my previous setup.

The appearance of a power plug suspended in a glass of water looked very strange from the start. However, the initial tests showed that the plug was an easy, hassle-free way of generating reliable voltage readings alongside the TDS meter.

Practical Maker. (2011). DIY EC Probe. Retrieved from https://www.youtube.com/watch?v=0NPtmHdbW3k
 
Ratcliffe, M. (2015, September 4). Three Dollar EC – PPM Meter. Retrieved March 19, 2019, from https://hackaday.io/project/project/7008-fly-wars-a-hackers-solution-to-world-hunger/log/24646-three-dollar-ec-ppm-meter-arduino