ESP8266IOT Projects

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

IoT Water Quality Monitoring:

 

Water Quality Monitoring System using pH Sensor– 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 tutorial, 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.

Recently I uploaded the articles on

Water quality monitoring using Turbidity Sensor and Arduino”.

Arduino Hydroponics System” and

Soil Nutrients Monitoring using NPK Sensor


While in Version1 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



Amazon Purchase Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:

Nodemcu ESP8266 WiFi Module:

LM7805 Voltage Regulator:

470uf capacitor:

330-ohm resistor:

DC Female Power Jack:

Female Headers:

Male Headers:

Gravity: Analog pH Sensor / Meter Kit For Arduino by DFrobot:

pH Sensor Kit DIYMORE

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

DISCLAIMER:

Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!


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:

Download PCB Gerber Files from the PCBWay official website:

Download link of the Nodemcu library for cadsoft eagle:


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 used 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 that works as the Power Indicator, a pH sensor, a BNC connector, a variable resistor that 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 the 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.

Note: this old version of the Blynk app is no more functional. For the blynk mobile App setup and Blynk.cloud dashboard setup ready my article on the New Blynk V2.0. In this article I have explained how to migrate your projects from Blynk 1.0 to the new Blynk V2.0. You can also watch the video.

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.

IoT water Quality Monitoring 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:

 

Related Projects:

TDS meter Arduino, water Quality monitoring Project, TDS in Water

ESP32 and TDS Sensor-based IoT Water Quality Monitoring System:

 

 

 

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

7 Comments

  1. Hi Engr Fahad,
    Good day to you sir,

    My name is Johan Sebastian and I am a student studying in Abu Dhabi Indian School, Abu Dhabi. I would like to know if i could use esp8266 nodemcu without the pcb board or the capacitors.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button