This repository contains the source code for the WaterS 2.0 project. WaterS 2.0 is a Water Quality Prediction System based on LSTM NNs for a Sigfox-compliant IoT Device. The goal is to make predictions of water quality through time series analysis. The dataset used for training the model contains a qualitative and quantitative monitoring system of the underground water bodies. It is populated with several water parameters, such as, average temperature, electric conductivity, medium dissolved oxygen, and PH) coming from different station probes. The code is mainly written with Python 3 and integrates different types of libraries for the back-end computation of the model. There are also several bash scripts, so for a faithful reproduction, a Linux environment is recommended.
The libraries used by WaterS 2.0 are the following:
Plugin | README |
---|---|
Keras | [https://keras.io/] |
Tensorflow | [https://www.tensorflow.org/] |
sklearn.preprocessing | [https://scikit-learn.org/stable/] |
NumPy | [https://numpy.org/] |
Pandas read_csv module | [https://pandas.pydata.org/] |
Matplotlib | [https://matplotlib.org/] |
The proposed source files have been developed and tested with Ubuntu 18.04 LTS and Python 3.6.9 and we encourage to use a similar environment to run the scripts.
Use the following commands to install the scripts' dependencies:
$ sudo apt-get install python3-pip python3-tk graphviz
$ pip3 install -r reqs.txt
Use the config.py.demo to build a config settings file, setting:
- number of neurons;
- number of epochs;
- Numphy random seed value.
Then start the script:
$ ./train.py
Train data will be created in the same folder of the Python script.
You can also use the automatic train with dynamic setting of neurons and epochs (see the train_script.sh file). In this case, a custom "RESULTS" folder will be created, with the train data according to the dynamic configuration chosen. A Dockerfile is also available to create a container with the exact environment used during our tests. In the docker.info file there is a list of useful commands that can be used for this purpose.
This work uses the Arduino MKRFOX1200, a development board which contains the ATMEL SAMD21 micro controller. As all Arduino devices, the MKRFOX1200 can be programmed using the Arduino Software (IDE).
Detailed instructions for installation in popular operating systems can be found at:
- Linux (see also the Arduino playground)
- macOS
- Windows
The Arduino MKRFOX1200 requires also the installation of additional libraries (for adding the SigFox connectivity to the Arduino platform) to be integrated into the Arduino IDE. All the necessary information are available below:
Additional libraries used:
Plugin | README |
---|---|
Arduino Sigfox - libraries | [https://github.com/arduino-libraries/SigFox] |
OneWire | [https://github.com/PaulStoffregen/OneWire] |
Arduino Dallas - library (Arduino-Temperature-Control) | [https://github.com/milesburton/Arduino-Temperature-Control-Library] |
Arduino Low - Power | [https://www.arduino.cc/en/Reference/ArduinoLowPower] |
TinyGPS++ | [https://github.com/mikalhart/TinyGPSPlus] |
After that, just import the arduino/Waters_source_v2.ino file into the Arduino IDE and deploy it to your device!
For more information on how to get started with these kind of product please visit the Getting Started page.
WaterS System and detailed component part list:
-
pH Probe (BNC Electrode Probe Controller)
-
3.7 V‐720 mAh LiPo Battery (Generic Battery)
WaterS is released under the GPLv3 license.