In September 2016, a water treatment plant has to be shut down because polluted water flowed into the plant. The water supply company was unable to pin point the contamination source and this caused a serious water service disruption.
My university course requires the students to build a system to solve community problems. An automated water quality monitoring system would ease the job of finding the pollution source!System Overview
4 sensors are interfaced to Arduino Genuino 101. All of them requires some interfacing circuit because they are current-output sensors. Arduino Genuino 101 collects the measurements data periodically, gets the GPS coordinates, and uploads the data bundle into a database using GPRS data link. Users can go to the website to view the result as shown below.Sensor probes
The three current output sensors are from Global Water, provided by the supervising lecturer. I use temperature, pH and dissolved oxygen level sensors in this project. Unfortunately, the dissolved oxygen level sensor is faulty.
The other sensor is a turbidity sensor, which output a voltage level proportional to the amount of suspended solid particles in the water.Interfacing Sensors and Arduino
A resistor converts the current output into measureable voltage level.A7 GPRS and GPS module
I chose this A7 module because it is relatively cheaper than SIM900 variant, and it combines both GPRS and GPS in a single package!
However, the cheaper price does come with a price. First, the GPS antenna that comes with the module is not really a GPS antenna, you will have to buy one yourself. Second, it only supports 115200 bps UART communication by default, and even if you change it using software, it will return to the default baud rate after a power cycle, and Software Serial at 115200 bps is very very unreliable. I pulled my hairs for 2 days for this problem. After that I implemented a baud rate change function in the Arduino code.
And, since this is a new module, I need to create my own library for this module. The source codes are collected from various places, like SIM900, and Adafruit GPS module. It is messy, but it works, please don't condemn me.
A circuit has to be designed to switch on the module. It has two pins, RESET pin and PWR_KEY pin to be controlled. A voltage is applied to the PWR_KEY for at least 2s to boot up the module. To reset, pull the RESET pin to GND. Otherwise, the RESET pin should be pulled up to 5V. I first reset the module, and then proceed to power up the module to make sure it starts up okay.Power Source
Power source deserves a special mention here (I think?) because of the current output sensors. They require a minimum of 10V to operate, higher than our beloved 5V. Since I wanted to demonstrate the capability of this system to work remotely, I opted for Li-Ion battery.
2 Li-Ion batteries in series will give 7.4-8.4V, one buck converter to bring it down to 5V for our Arduino and A7 module, another boost converter to provide a 11V power rail for those water sensors. With this setup, the system will not run for a long time, but that is not a main concern for this prototype.The board
The system is build on a prototype board. The board and Arduino Genuino 101 fit nicely into the enclosure.Enclosure
The lecturer also gave an old enclosure, with holes drilled by previous students for projects related to the water sensors. Wonderful!
Notice the connectors to the sensors. I found them attached to the sensors, thus I searched around for connectors that would mate with them. I found them with the code GX16. They are very versatile and would surely come in handy in future projects!Webpage
I hosted the website on Microsoft Azure because they provide a free sservice for students. It comes with limitations, but is sufficient for this application.
The databse is provided by ClearDB, in partnership with Azure as well. Again, memory limitations, but enough for this project.
The codes are provided in the repo, but remember to add in your credentials into username_password.php file.
The log.php dumps all the data received from Arduino into a database.
Then the webpage presents a Google Map, with markers shown in locations which have measurements data. The other php files are all "tools" to access the database to retrieve the data in database.
The response of the website is quite slow, and since I just hacked all these together, I wish to improve it. Suggestions are very much welcomed. :)