IOT Water Quality monitoring using Arduino,pH Sensor,Nodemcu ESP8266

(Last Updated On: July 7, 2019)

water quality monitoring

Description:

Water Quality Monitoring System, In this Tutorial, you will learn how to make an IOT based water quality monitoring system using Arduino, pH Sensor, Nodemcu esp8266 wifi module and Blynk Application. As this is an IOT “Internet of Things” based project, the water quality can be monitored from anywhere around the world. In this Episode, I will practically explain how to measure the pH value of the Well water, and I will also explain whether the water under test is good or bad for health. In this Tutorial, you will also learn how to use the 16×2 LCD widget in the Blynk application. This is Version2 of the pH sensor Water Quality Monitoring System.


While in Version1

https://www.electroniclinic.com/ph-sensor-arduino-how-do-ph-sensors-work-application-of-ph-meter-ph-sensor-calibration/

I covered the extreme basics like for example

  • What is pH?
  • How does a pH sensor work?
  • How to measure the pH value of different liquids?

In version1 I also explained how to calibrate the pH sensor. So if you are using a pH sensor for the First time then I highly recommend first you should watch Version1 and then you can resume from here.

In this Tutorial, we will cover

  1. Complete Circuit Diagram
  2. pH sensor Unboxing
  3. pH Sensor Pinout
  4. pH sensor and Nodemcu ESP8266 wifi module interfacing with Arduino.
  5. Arduino and Nodemcu Programming and finally
  6. Testing



The components and tools used in this project can be purchased from Amazon, the components Purchase links are given below:

Arduino Uno: https://amzn.to/2tVz1vu
Mega 2560: https://amzn.to/2ze1kdu
Nodemcu esp8266 wifi module: Best price https://amzn.to/2NAvmiB
Gravity: Analog pH Sensor / Meter Kit For Arduino by DFrobot: https://amzn.to/2MEtRzy
330-ohm resistors pack: https://amzn.to/2NtlAeh
5v 2A adaptor: https://amzn.to/2GsNfcw
2n2222 NPN transistors: https://amzn.to/2EmXsIb
10k Resistor: https://amzn.to/2KTd6OW
lm7805 Voltage Regulator: https://amzn.to/2IZEl5x
330-ohm resistors pack: https://amzn.to/2NtlAeh
female DC power jack socket: https://amzn.to/2KEo1gt
470 uf capacitors: https://amzn.to/2xDCOzf
5×7 cm Vero board: https://amzn.to/2OHGbvn
female headers: https://amzn.to/2zqmtiJ
connection wires: https://amzn.to/2DpBuW7
Super Starter kit for Beginners: https://amzn.to/2KJvmKG
Jumper Wires: https://amzn.to/2KMoVXs
Bread Board: https://amzn.to/2MS4q8X
12v Adaptor: https://amzn.to/2Ntr6h1
PCB plate: https://amzn.to/2IUwpCt
Variable Supply: https://amzn.to/2MT4Qfj
Digital Multimeter: https://amzn.to/2Nvft9i
Vero Board / stripboard: https://amzn.to/2MTf9jD
Soldering iron kit: “best” You guys should definitely purchase this: https://amzn.to/2zfoNuJ
Solder wire: https://amzn.to/2ufUMWf
Wire Stripper: https://amzn.to/2KOqxfU
wire cutter: https://amzn.to/2ucIq14
PCB small portable drill machine: https://amzn.to/2Nu62XF

Circuit Diagram:

water quality monitoring

This is the circuit diagram of the Nodemcu esp8266 wifi module Power Supply. This Schematic is designed in cadsoft Eagle 9.1.0 version. This is 5v regulated Power supply which is used to power up the Nodemcu esp8266 wifi module.  This Power Supply is based on the famous LM7805 voltage regulator. J1 is the female power jack and this is where we connect a 12v adaptor, battery or a solar panel. Two 470uf capacitors are connected at the input and output sides of the voltage regulator. A 330-ohm resistor is connected in series with a 2.5v led. This is a current limiting resistor. The output of the voltage regulator is connected with the Vin pin of the Nodemcu esp8266 wifi module and the ground is connected with the ground. SV1 and SV2 are the female headers. The connections of the Nodemcu module and pH sensor will be explained during the interfacing.


water quality monitoring

This is the Final Power Supply board designed for powering up the Nodemcu ESP8266 wifi module. It’s PCB designing, online order placement and Soldering is already explained in my previous tutorial.

High quality & Only 24 Hours Build time:

https://www.pcbway.com/setinvite.aspx?inviteid=260737

Download PCB Gerber Files from the PCBWay official website:

https://www.pcbway.com/project/shareproject/Nodemcu_ESP8266_Power_Supply.html

Download link of the Nodemcu library for cadsoft eagle:

https://www.diymodules.org/download/eagle-libs/shr/0000000020/nodemcu.lbr

Gerber files generation and online order placement:

 

This PCB is developed by the PCBWay Company. The PCB board file can be downloaded from my Website.

About the DFrobot pH Sensor kit:

water quality monitoring

This is the analog pH sensor kit from the DFrobot, DFrobot is a leading robotics and open source hardware provider. They create innovative, user-friendly hardware & software products that become the building blocks in all kinds of electronic projects. I personally recommend you should definitely visit www.dfrobot.com .



This pH Sensor kit can be using in Water quality monitoring equipments, it can be used in the water tanks, Fish aquarium, this pH Sensor kit can be used with GSM, nodemcu esp8266 wifi module for remote notifications.

water quality monitoring

This pH sensor kit is best for measuring the water quality and other parameters. It has an LED which works as the Power Indicator, a pH sensor, a BNC connector, a variable resistor which is used for the calibration which I will explain during the testing and PH2.0 sensor interface circuit.


pH Sensor Kit Interfacing with Arduino:

For the step by step, interface connections watch video Tutorial given at the end of this Article.

Connect the red wire with the Arduino’s 5v…

Connect the black wire with the Arduino’s Ground…

Connect the blue wire with the Arduino’s Analog pin A0.

Connect the TX and RX Pins of the Nodemcu ESP8266 wifi module with Pin number2 and Pin number3 of the Arduino.

Connect Ground Pin of the Nodemcu module with the Arduino’s ground.

Blynk Application for the Water Quality Monitoring System:

  • First of all, open the Blynk application.
  • set the project name as pH meter.
  • Click on the Choose device and select Nodemcu.
  • Make sure you set the connection type to wifi and then click on the create button, an authentication token will be sent on your email id, which will be then used in the programming, simply copy and paste it in programming.
  • Now click on the screen and search for the LCD widget and add it.
  • Now Click on the LCD, Select Advanced.
  • Click on the Pin and select Virtual Pin V2.



water quality monitoring

Our application is ready and now let’s discuss the programming.

Programming:

In this project two Programs are used, one program is written for the Arduino while the other Program is written for the Nodemcu ESP8266 wifi module. Let’s first of all start with the Arduino Programming.

Arduino Programming for the Water Quality Monitoring System:

This is the same Program I used in Version1 of the pH sensor water quality monitoring system. This time I made a few changes, I added these two libraries. The stdlib.h library has a standard function which is used for converting the float value into the String, while the softwareserial.h library is used for creating multiple Serial Ports. As I always say never use the Arduino’s default serial port for communication with other devices. As you know in Arduino we have only one Serial port which is on pin number 0 and pin number 1. The Arduino’s default Serial Port should only be used for debugging purposes.


Now the question is if we are using the Arduino’s default Serial port for the debugging purposes then how we will connect the Nodemcu Module with the Arduino? Well, no worries at all we can use the software serial library for creating multiple Serial Ports. So that’s the reason I added the software serial library and defined a Serial Port with the name Nodemcu on Pin number 2 and Pin number 3. So the Nodemcu module TX and RX Pins will be connected with the Arduino’s Pin number 2 and Pin number 3…

Another change that I made to the program is I added this function which is used to convert a float value into the String value. Then I added this String value along with the comma which is used as the delimiter. Finally, the String message is sent to the Nodemcu module and at the end, we empty the String for the new day.


Nodemcu Programming for the Water Quality Monitoring System:

water quality monitoring

The pH of pure water is 7. In general water with a pH lower than 7 is considered acidic, and with a pH greater than 7 is considered basic. The normal range for pH in surface water systems is 6.5 to 8.5, and the pH range for groundwater systems is between 6 to 8.5.  Waters taken from underground sources and not treated or modified in any way will have a pH between 7.2 and 7.8, which is the ideal range for good health.


water quality monitoring

The water under test is in the ideal range and has a pH value of around 7.4 which is considered good for health.

In my upcoming Tutorial, I will upgrade this Project and will use a waterproof temperature sensor “DS18B20” with the pH sensor. This way we can monitor the Water Quality and Temperature. I will practically perform some tests on the River water. So subscribe right now so that you never miss any of my upcoming tutorials.


Watch Video Tutorial:

Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Close