Development of a Sensor and Measurement Platform for Water Quality Observations: Design, Sensor Integration, 3D Printing, and Open-Source Hardware
Environmental Monitoring and Assessment
This is the complete Python source code required to reproduce graphs in the paper. The source code also produces data figures and comparisons.
Electronic and mechanical design files are provided. These files are licensed using permissive open source licenses as indicated below.
A measurement and development platform for collecting water quality data (the WaterWatcher) was developed. The platform includes sensors to measure turbidity, total dissolved solids (TDS), and water temperature as variables that are often collected to assess water quality. The design is extensible for research and monitoring purposes, and all design files are provided under open-source permissive licenses for further development. System design and operation are discussed for illustrative purposes. A block diagram indicates elements of mechanical, electrical, and software design for this system. The mechanical assembly used to house circuit boards and sensors is designed using 3D printing for rapid prototyping. The electronic circuit board acts as a carrier for an Arduino 32-bit microcontroller board and an associated cellular module along with a GPS for geolocation of water quality measurements. The cellular module permits data transfer for Internet of Things (IoT) functionality. System operation is set up using a command line interface (CLI) and C++ code that allows for calibration coefficients and human-readable transfer functions to be defined so that sensor voltages are related to physical quantities. Data are cached on a secure digital (SD) card for backup. The circuit was calibrated, and system operation assessed by deployment on an urban reservoir. Biogeochemical cycles were identified in the collected data using spectrogram and semivariogram analyses to validate system operation. As a system with hardware and software released under an open source license, the WaterWatcher platform reduces the time and effort required to build and deploy low-cost water quality measurement sensors and provides an example of the basic hardware design that can be used for measurements of water quality.
For paper code to re-create figures.
- Python 3
- pipenv
- sh utility for Windows to run shell scripts
Install the pipenv
utility using pip
.
To download STEP files for the mechanical design (also required):
- Windows OS and Autodesk Inventor installed and activated
- Windows OS that supports VBScript (most versions of Windows do)
- Desktop browser
- Cmder - https://cmder.net/
To program the microcontroller and to compile the device code, an Arduino code IDE is required along with the required compilers:
- Platform.io - https://platformio.org/
The shell script run.sh
in the paper-code
directory will automatically
create graphs in the paper.
The shell script run.sh
in the mechanical/download-files
directory
will convert STEP files for use in Inventor. Check the
/mechanical/download-files/downloaded/files-download.txt file for further
details on which parts to download.
The part files are downloaded from McMaster-Carr (https://www.mcmaster.com/) and these downloaded files are for your own use as per the distribution license provided by McMaster-Carr. Create an account and log in to the McMaster-Carr website before downloading parts.
The conversion between STEP and IPT is performed by VBScript and the Inventor API.
This process can only be completed using a Windows machine. If you do not have
access to a Windows machine, please contact the authors.
When opening the assembly for the first time in Inventor (assembly-with-lid.iam
)
some benign errors or dialog boxes might appear indicating that files
are not the same as originally referenced.
When asked "Do you really want to use the resolved document?" click "Yes."
When asked "Would you like to update the assembly now?" click "Yes" and then save the assembly.
Click on "Accept" if a dialog box indicates that there are errors. When saving the assembly, click on the "Yes to All" button and then "OK."
The files-download.txt
file with the
download links might have to be modified as required in
the mechanical/download-files
directory.
This file is only provided to be potentially useful.
Bolded entries in the table indicate parent directories. Non-bolded entries indicate subdirectories.
Directory | Description |
---|---|
data | Data collected in the context of this project |
calibration data | Data collected from calibration |
deployment | Data collected during deployment |
electrical-schematic-appendix-b | Appendix B of the paper |
electronic | Electronic design files |
bom | Bill-of-Materials (BOM) for PCBs |
gps-power-pcb | |
gps-power-pcb-gerber | |
main-pcb | Electronic design files for the main PCB |
main-pcb-gerber | Gerber files for the main PCB |
mechanical | Mechanical design files |
bom | Bill-of-Materials for mechanical design |
download-files | Python script for downloading and converting STEP files |
inventor | Inventor files for mechanical design |
mechanical-diagram-appendix-a | Appendix A of the paper |
paper-code | Code used to create paper outputs |
software | Code to implement the system |
v1 | Version 1 of the microcontroller software |
v2 | Version 2 of the microcontroller software |
ww-server | Example code to run on the server that receives data from the WaterWatcher |
- The main PCB is a four-layer PCB with nominal stackup.
- Round up drill size to the next available drill if required.
- Soldermask on both sides of the PCB.
- Silkscreen on both sides of the PCB.
- DFM Now! software can be used for Gerber preview (https://www.numericalinnovations.com/)
- gerbv also works well as Gerber preview software (http://gerbv.sourceforge.net/)
Layer Extension | Layer Description |
---|---|
.GTO | Top Overlay |
.GTS | Top Solder |
.GTL | Top Layer |
.G1 | Layer 2 |
.G2 | Layer 3 |
.GBL | Bottom Layer |
.GBS | Bottom Solder |
.GM1 | Mechanical 1 |
.GPT | Top Pad Master |
.GPB | Bottom Pad Master |
.DRR | NC Drill File Report |
.TXT | NC Drill File |
The data and code are available in this repo. The data can also be downloaded from Figshare and the DOI is given in the paper.
- Python 3
- Altium Designer
- Autodesk Inventor
Python libraries:
- numpy
- scipy
- matplotlib
- and others...
- Smart Water Systems Lab (University of Saskatchewan)
The project code is licensed under the GPLv3 License - see the LICENSE.md file for details. The GPLv3 License ensures that the code can be freely shared and used.
The electronic and mechanical design files as created by Nicholas J. Kinar in the context of this project are licensed under the CERN Open Hardware License Version 2 - Strongly Reciprocal.
All other parts or technologies used for this project are as licensed by the original license holder.