Earth Day 2021: Stream Research

About the project

Our natural waterways are beautiful, provide recreation and support agriculture. We must ensure their health, safety and conservation!

Project info

Difficulty: Moderate

Platforms: AdafruitDFRobotUbidotsAtlas ScientificBlues Wireless

Estimated time: 6 hours

License: MIT license (MIT)

Items used in this project

Hardware components

Grommet Kit, 100 Pcs Grommet Kit, 100 Pcs x 1
Panel Mount TRRS Jack Panel Mount TRRS Jack x 1
TRRS Male Plug TRRS Male Plug x 1
Rechargeable Battery, 3.7 V Rechargeable Battery, 3.7 V x 1
Adafruit FeatherWing Proto Adafruit FeatherWing Proto x 1
DFRobot Semi Flexible Monocrystalline Solar Panel (5V 1A) DFRobot Semi Flexible Monocrystalline Solar Panel (5V 1A) x 1
DFRobot Waterproof DS18B20 Sensor Kit DFRobot Waterproof DS18B20 Sensor Kit x 1
DFRobot Analog TDS Sensor (SEN0244) DFRobot Analog TDS Sensor (SEN0244) x 1
DFRobot Analog Turbidity Sensor (SEN0189) DFRobot Analog Turbidity Sensor (SEN0189) x 1
Atlas Scientific Gravity™ Analog DO Sensor Kit Atlas Scientific Gravity™ Analog DO Sensor Kit x 1
Atlas Scientific Gravity™ Analog ORP Sensor Kit Atlas Scientific Gravity™ Analog ORP Sensor Kit x 1
Atlas Scientific Gravity™ Analog pH Sensor Kit Atlas Scientific Gravity™ Analog pH Sensor Kit x 1
Blues Wireless Notecarrier-AL Blues Wireless Notecarrier-AL x 1
Blues Wireless Notecard Blues Wireless Notecard x 1
Adafruit HUZZAH32 – ESP32 Feather Board Adafruit HUZZAH32 – ESP32 Feather Board x 1

View all

Software apps and online services

Irwin: Unibit Step Drill #4 Irwin: Unibit Step Drill #4
Arduino IDE Arduino IDE
Ubidots Ubidots
Blues Wireless Notehub.io Blues Wireless Notehub.io

Hand tools and fabrication machines

Hot glue gun (generic) Hot glue gun (generic) x 1
Soldering iron (generic) Soldering iron (generic) x 1

Story

Flat Creek (Cassville, Missouri)

According to Wikipedia...

Flat Creek is a stream in Barry and Stone counties of southern Missouri. It is a tributary of the James River.... Flat Creek was so named on account of flat terrain near its course in the vicinity of Cassville.

Flat Creek (Cassville, Missouri)

Flat Creek (Cassville, Missouri)

Flat Creek (Cassville, Missouri)

To me, it represents so much more. As a child, I grew up swimming and fishing in Flat Creek, and it holds a very special place in my heart. As my children grow up, I want to share my love of the creek and make new memories with them.

Sadly, I've noticed an increase in general pollution (e.g. styrofoam cups, plastic bottles, aluminum cans), and I've begun to wonder what else might be in the water that is NOT visible. Often, this "invisible" danger poses the greatest threat to wildlife and public health.

There are several potential sources of water pollution in Flat Creek:

  • Cassville Waste Treatment Facility
  • Rainwater runoff from the City of Cassville
  • Nitrates from fertilizers used in agriculture

My Goal

I've decided to dedicate this Earth Day to creating a remote water quality monitoring station. Specifically, one which uses widely available, reasonably priced, and relatively accurate sensing equipment. My goal is to create a blueprint that can be easily recreated by STEM classrooms and enthusiasts across the country, and foster better understanding, awareness and respect for our impact on the environment.

Data is power, and with sufficient data we can approach our respective municipalities, and provide them with all the information they need to seek or allocate funding for the preservation and conservation of our natural waterways.

The Equipment

Not that long ago, testing water quality required chemicals, testing strips and laboratory equipment. Fortunately, the recent commoditization and general availability of sensors and wireless networks have given rise to endless possibilities that were never available before.

Some assembly required...

Some assembly required...

Some assembly required...

This project is the result of a natural partnership between Blues Wireless and Atlas Scientific. Together these companies have all the components necessary to create the perfect solution. Atlas Scientific is the industry leader in environmental robotics (including water quality sensing equipment), and they have graciously provided the full array of sensors from their trademarked Gravity line of sensors. Blues Wireless is the sponsor of this project, and provides the Notecard and Notecarrier-AL, which offers the fastest and least expensive path to IoT for any product.

Sensor Array

The monitoring station consists of six sensors, which provide key data points and insights and allow us to determine the overall health and well being of the stream.

Cellular Connectivity

The Notecard has a built in cellular modem, which is controlled by a JSON API. The Notecarrier-AL provides pinout connections to the Notecard's M.2 connector and has both cellular and GPS antennas on board.

Blues Wireless Notecard

Blues Wireless Notecard

Blues Wireless Notecard

Power Management

Perhaps surprisingly, the Notecard and Notecarrier-AL also provide a highly efficient power management solution. The Notecarrier-AL has pre-soldered JST connectors ready to accept a ~4-7V solar panel and rechargeable battery. At the same time, the Notecard can be configured to switch power to your host MCU, and idle in a low-power mode for a specified period of time.

All told, the combination of Notecard and Notecarrier-AL can make any project wireless and power performant!

The Build

To be successful in the stream, an enclosure must be capable of floating, sporting a solar panel, easy to spot (for recovery), and be "waterproof" to some degree.

In order to meet this criteria, I elected to use a field box. They are designed for ammunition, therefore they have moisture resistant lid, a large volume and bright colors. The walls are 2.5mm thick, injection-molded plastic, so it's light-weight, tough and easy to modify.

Sheffield Field Box

Sheffield Field Box

Sheffield Field Box

Southwest Missouri is situated in the heart of Tornado Alley, and we have extreme weather in April. The peaceful stream of Flat Creek can become a raging torrent in just a few hours. For this reason, I consider water to be my biggest hazard.

Water Hazards

  • Flooding and capsizing of the container
  • Torrential rain penetrating the enclosure
  • Stream water seeping through the grommets around the probes
  • Humidity collecting on the walls of the enclosure

My greatest fear is that the box will be torn from it's styrofoam belt, capsize, and take on water before it finds it way to dry land. If that situation were to occur, then eventually the box would come to rest in the natural position on it's side.

1 / 2Lid Mounted Electronics

Lid Mounted Electronics

Lid Mounted Electronics

Grommeted Sensor Probes

Grommeted Sensor Probes

I went back and forth when deciding where to mount the electronics, I eventually settled on mounting the electronics on the lid of the container - opposite the probes protruding from the bottom. This way, regardless of the orientation, the electronics would be perpendicular to the ground/water and the PCBs would be hung to dry. All this, to give me the best chance of the Notecard reporting home with it's GPS coordinates, so I might be able to find the box down river.

Power Efficient Design

The monitoring station will be sitting in a stream sampling the water quality indefinitely, and will be solar powered. To ensure it has appropriate power we are wiring things to only be enabled when they are in use; this includes the sensors.

As previously stated, the Notecard and Notecarrier combo provide the foundation for our power-efficient design. The ESP32 should be wired to the Notecard in the following fashion.

________________________________________
| ____________________________________ | ____________________
| | | | /
| | _________________ | | | O
| | |O| |O| | | | (Notecarrier-AL)
| --> SDA-|* ___________ *|-21 | | VUSB>-|[]
----> SCL-|* | ESPRESSIF | *|-TX | | ----> BAT>-|[]
14-|* |ESP32-WROOM| *|-RX | | | MAIN>-|[]
32-|* |CE | *|-MI | | | VIO>-|[]
15-|* | | *|-MO | | | |[]
33-|* | ___ | *|-SCK | | | V+-|[]
27-|* | | || *|-A5 ---^-^--^----> GND-|[]
12-|* |______|___|| *|-A4 | | | | EN-|[]
13-|* *|-A3 | | | | RST-|[]
USB-|* *|-A2 | | | | |[]
-----> EN-|* ----- *|-A1 | | ---^----> SCL-|[]
| --> BAT-|*___ | | *|-A0 | -----^----> SDA-|[]
| | | | ----- *|-GND <-- | --> ATTN-|[]
| | | | _ *|-NC | | AUXEN-|[]
| | |----- |O| *|-3V | | AUXRX-|[]
| | | ----- *|-RST | | AUXTX-|[]
| | |O___0_|___|_0___O| | | AUX1-|[]
| | | | AUX2-|[]
| |_________________________________________| | AUX3-|[]
|_____________________________________________| AUX4-|[]
RX-|[]
TX-|[]
|
| O
____________________

By wiring the enable EN pin of the ESP32 to the attention ATTN pin of the Notecard, the Notecard is able to power down the entire MCU and go into a low-power hibernation itself for a time period specified by the host. This simple technique is extremely efficient and conserves precious battery power.

Similarly, each sensor has it's power pin connected to a digital GPIO on the ESP32, so it can be powered on just before a sample is taken then powered down again when complete.

An example of individual sensor wiring is shared in the Fritzing diagram.

Testing

Before sending my monitoring station off to the creek, I performed a battery of tests to ensure it's sea-worthiness.

1 / 2Rain Simulation

Rain Simulation

Rain Simulation

Float Test

Float Test

The Plan

The largest and most obvious threat to the stream is the Municipal Waste Treatment Facility. It's true that with proper treatment, water can be reasonably conditioned before being returned to the environment, but all too often budgets are tight, training is insufficient, and our natural resources are deprioritized in favor of other projects.

Treated Water Release Gate

Treated Water Release Gate

Treated Water Release Gate

I have made two water monitoring stations, and I will start by sampling water both upstream and downstream from the waste treatment facility. This will enable me to directly compare water as it passes by the treated water release gate.

If I find evidence of contamination or bio-hazardous conditions (e.g. depleted oxygen levels), I will report my findings to the Cassville City Council and ask for the prioritization of fixing the condition of our local stream and precious resource.

The Data

Raw Sensor Data

I elected to capture raw sensor readings from the device, without performing any calculations or transformations. By deferring to transform the data until it is ready to be consumed, we save the source information as it was originally captured. In it's original form the data can be enriched and reprocessed if/when more accurate or robust calculations are discovered.

Cloud-based Transformation

With raw data coming into the Notehub project, JSONata can perform most any transformations or calculations necessary before forwarding the meaningful data representations to a final endpoint. This way, if I chose to switch endpoints entirely, then I won't need to recreate any of the transformation logic. It also has the added benefit of allowing me to modify/alter/tweak the calculation without having to write and deploy new firmware to the device.

Example: JSONata Turbidy NTU Calculation

$square := function($n) {
$n * $n
};
$mV_3V3_12_bit := function($adc_sample) {(
$max_adc := 4095;
$max_mV := 3300;
($adc_sample * $max_mV / $max_adc)
)};
$tbt_NTU := function($tbt_raw){(
$tbt_V := ($mV_3V3_12_bit($tbt_raw) / 1000);
((-2572.2 * $square($tbt_V)) + (8700.5 * $tbt_V) - 4352.9)
)};
Go to the Notehub.io route and view the entire JSONata transformation.

The Dashboard

To be able to share the results of this project, I needed a good way to visualize the data. It's hard to drive tough conversations without being able to represent data in a relatable and meaningful way. Dashboards are incredibly effective at sharing several related data points, so that was the path I elected to follow.

I recently became aware of Ubidots, and it fits the bill perfectly.

Ubidots Dashboard

Ubidots Dashboard

Ubidots Dashboard

Click here to view the dashboard with real-time data!

By simply declaring an Ubidots "device" (end-point), I was able to target Ubidots from my Notehub.io project's route, and direct the sensor readings to flow into Ubidots. Once the sensor readings were in my Ubidots device, it was trivial to arrange them into a dashboard.

For the complete steps on connecting to Ubidots from your Notehub.io route, you can follow the Ubidots Guide provided by Blues Wireless.

In Summary

This project enables the capture AND presentation of data in a meaningful way, which can then be used to present data to those who can help fund or prioritize the health, safety and longevity of the environment.

I hope you join me in celebrating this Earth Day by recreating this project and testing and protecting your local waterways!If you have any comments or suggestions on how I can improve the project or get more accurate readings, please leave a comment below - I do check them. Also, if you need help recreating this project, feel free to reach out directly and send me a DM.

Schematics, diagrams and documents

Partial Wiring Diagram

There are no Fritzing parts for the DFRobot SEN0189 and SEN0244, so I was unable to add them to the image. The are similar to the Atlas chips, and should be wired in kind.

CAD, enclosures and custom parts

Sheffield Fieldbox Stand

Raises box to provide space for sensors to protrude from bottom.

Code

StreamResearch

Arduino based, monitoring station firmware.

Credits

Photo of zfields

zfields

I like to build stuff.

   

Leave your feedback...