Measure Lake Water PH Using PH Sensor & ESP32 by Group 11
by Iffah Ismail in Circuits > Arduino
88 Views, 0 Favorites, 0 Comments
Measure Lake Water PH Using PH Sensor & ESP32 by Group 11
We are from Group 11 , Nurul `Iffah binti Che Ismail and Yang Fakhrul Hadi bin Yang Rizal has created a pH sensor to measure pH level lake using pH sensor & ESP32 at Houseboat Kenyir, Stesen Penyelidikan Alami Kenyir (SPAK), Tasik Kenyir, Terengganu on 5 - 6 January 2024. The sensor was left for a week at the houseboat, to get the pH data.
Supplies
For development of IoT based water lake pH sensor , we have used:
Arduino IDE :
- A software application platform for write, compile and upload code into microcontroller which is ESP32.
ESP32 :
- ESP32 is a microcontroller which is able to upload the programming language as a controller for the pH sensor using Arduino programming language (simplified version of C/C++) with additional libraries for hardware interactions.
MyMQTT:
- MyMQTT (Message Queing Telemetry Transport) is a ‘client’ for this project. It is a lightweight messaging protocol designed for low-bandwidth or high-latency. MyMQTT is commonly used in IoT applications for good communication between devices, it is a specific implementation or client for MQTT where we have used to subscribe/receive and publish/send data.
Node-RED:
- A flow-based development tools for visual programming to manipulate and process the data that has been subscribed form MQTT broker. It offers a visual interface for establishing connections between various nodes, which stand in for devices or services, to build a flow that specifies how the data is handled and used.
To summarize:
- Hardware (ESP32): Responsible for interfacing with the pH sensor and sending data to the IoT network.
- MQTT (MyMQTT): Manages the communication protocol for the IoT network, allowing devices (like ESP32) to publish and subscribe to data.
- Data Processing (Node-RED): Provides a visual interface for defining how data received from the MQTT broker should be processed, edited, or acted upon in this project.
PH Sensor Specifications
- Module Power: DC 9.00V 1A
- Measuring Range: 0-14PH
- Accuracy: ± 0.1pH (24 )
- Response Time: 1min
- Industry pH Electrode with BNC Connector
- Power Indicator LED
- Output: Analog values in the range of (0.5V to 3V)
- Alkali Error: 0.2PH
- Internal Resistance: 250MO
Components that we have used for this project:
Components Name
- ESP32 WiFi Module
- Analog pH Sensor Kit
- Breadboard
- Connecting Wires
- Power bank
- Type-C adapter
- ESP32 Cable
- USB Cable
- LED
- Resistor
- Plastic case
- Rope
- Cable Ties
Connect the Output Pin
Connect the output pin as shown in the diagram. For this project, we used powerbank as the power supply. We modified the USB Cable connect from sensor to the powerbank. To ensure the powerbank not into power off mode, we used Type-C adapter to connect the USB Cable pH Sensor and ESP32 to the slot Type-C of powerbank.
Upload the Basic Code
For this step, connect the pH Sensor USB and ESP32 into port of the laptop and upload the Basic Code into Arduino app and compile. Observe the serial monitor.
Calibrate the Sensor
To give accurate results, the sensor should be calibrated before using if the PH sensor probe is changed. To calibrate, the 5k resistor on the PH module need to be tuning. If no changes have been made to the probe, there is no need for calibration of the sensor.
In this project, we tuning the 5K resistor and we made a few solution tests:
We tested with the solution lime and detergent which the serial monitor shows the pH of lime solution is 2.5~2.88 and detergent pH is 6.80 ~ 7.90. These are the correct pH for lime and detergent.
Precaution step:
As the bulb type is very fragile, the sensor tip should be kept in the storage solution ( distilled water) if not used. It is very sensitive as it is made from glass and should be kept at a safe place and need to be handled carefully. The probe tube is to be rinsed with deionized water that has been provided with the kit and dry it before immersing it into the any test solution. To stabilize the result, we need to wait for a few minutes and get few data. After getting a stable result, the probe tip will be rinsed with deionised water and dried, then placed in the liquid storage tip ( contains distilled water). To get better results, we used the sensor multiple times within 3 to 4 days and kept it vertically.
Add LED & Resistor
We used breadboard to add led, resistor and used few connecting wires.
Upload New Code
We have upload a new code into ESP32. The new coding consisting the basic code of pH calculations, subscribe and publish the topic, the data will publish every 30 minutes and control ON/OFF LED.
Downloads
Create Visual Interface Into Node-rED
We created a visual interface like as shown in the picture into Node-RED.
Subscribe the Topic From MQTT
Install MyMQTT from app store and then publish and subscribe the topic.
Installing the Sensor at the Houseboat
We have put the power bank, breadboard with led, pH sensor probe and ESP32 into plastic containers. Then, put the tape around the lid and to ensure that no water can get in into the container to make it waterproof. We also tied rope to make the case stay in the place. The pH probe will immerse into the waterlake.
Unfortunately for this project, the type-C cable is not functioning well. We had to use the power supply from the houseboat connect with the pH sensor cable , while ESP32 cable connect with the power bank because if the both cable connect to it , it tends to power off mode after few minutes.
Observing the Data From MyMQTT (from Mobile) & Node-RED
The houseboat provided WiFi connection to the sensor & ESP32. We finally can observe the data from MyMQTT through mobile and visual results from graph in Node-RED. The LED also can be turn on / off by using MyMQTT and LED switch in Node-RED.