Twitter icon
Facebook icon
LinkedIn icon
Google icon
Reddit icon
StumbleUpon icon
Del.icio.us icon

Earth Day 2021: Stream Research

Added to IoTplaybook or last updated on: 05/12/2021
Earth Day 2021: Stream Research

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)

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.

Things used in this project

Hardware components

Adafruit HUZZAH32 – ESP32 Feather Board
Adafruit HUZZAH32 – ESP32 Feather Board
 
× 1

Newark

Notecard
blues wireless Notecard
 
× 1

Blues Wireless

Notecarrier-AL
blues wireless Notecarrier-AL
 
× 1

Blues Wireless

Gravity™ Analog pH Sensor Kit
Atlas Scientific Gravity™ Analog pH Sensor Kit
 
× 1

AtlasScientific

Gravity™ Analog ORP Sensor Kit
Atlas Scientific Gravity™ Analog ORP Sensor Kit
 
× 1

AtlasSceintific

Gravity™ Analog DO Sensor Kit
Atlas Scientific Gravity™ Analog DO Sensor Kit
 
× 1

AtlasScientific

 
DFRobot Analog Turbidity Sensor (SEN0189)
 
× 1

DFRobot

 
DFRobot Analog TDS Sensor (SEN0244)
 
× 1

DFRobot

 
DFRobot Waterproof DS18B20 Sensor Kit
 
× 1

DFRobot

 
DFRobot Semi Flexible Monocrystalline Solar Panel (5V 1A)
 
× 1

DFRobot

 
Adafruit FeatherWing Proto
 
× 1

Adafruit

Rechargeable Battery, 3.7 V
Rechargeable Battery, 3.7 V
 
× 1

Newark

 
TRRS Male Plug
 
× 1

Amazon

 
Panel Mount TRRS Jack
 
× 1

Amazon

Grommet Kit, 100 Pcs
Grommet Kit, 100 Pcs
 
× 1

Newark

Software apps and online services

Notehub.io
blues wireless Notehub.io
 
 

Notehub

Ubidots
Ubidots
 
 

Ubidots

Arduino IDE
Arduino IDE
 
  Arduino

Hand tools and fabrication machines

 
Irwin: Unibit Step Drill #4
 
 

Amazon

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

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...

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 wellbeing 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

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

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 its 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.

Lid Mounted Electronics

1 / 2 • Lid Mounted Electronics

Grommeted Sensor Probes

2 / 2 - 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 its 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 its 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.

 

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

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 its 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

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.

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

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.

Custom parts and enclosures

Sheffield Fieldbox Stand

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

Schematics

Partial Wiring Diagram

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

 

Code

StreamResearch

Arduino based, monitoring station firmware.

zfields / StreamResearch

Arduino Sketch driving the Earth Day 2021 Stream Research project. — Read More

https://www.hackster.io/zachary_fields/earth-day-2021-stream-research-55a49b

Latest commit to the master branch on 4-21-2021

Download as zip

Credits

Zachary J. Fields

Zachary J. Fields

I like to make stuff.

 

Hackster.io

This content is provided by our content partner Hackster.io, an Avnet developer community for learning, programming, and building hardware. Visit them online for more great content like this.

This article was originally published at Hackster.io. It was added to IoTplaybook or last modified on 05/12/2021.