A pH sensor connected to Arduino lets you measure the acidity or alkalinity of water, soil extracts, and nutrient solutions with reasonable accuracy for under ₹800. Whether you’re running a hydroponics setup on your Bengaluru terrace, monitoring aquarium health, or testing borewell water quality, a pH sensor project gives you real-time data instead of relying on colour-change litmus strips. This guide covers sensor selection, proper calibration, and practical projects for Indian water conditions.
Understanding pH and Why It Matters
The pH scale runs from 0 (strongly acidic) to 14 (strongly alkaline), with 7 being neutral. In India, these pH ranges are practically important:
| Application | Ideal pH | Why It Matters |
|---|---|---|
| Drinking water (BIS standard) | 6.5-8.5 | Health safety, pipe corrosion |
| Aquarium (freshwater) | 6.5-7.5 | Fish health and breeding |
| Hydroponics (leafy greens) | 5.5-6.5 | Nutrient absorption |
| Garden soil (most plants) | 6.0-7.0 | Root nutrient uptake |
| Swimming pool | 7.2-7.6 | Chlorine effectiveness, skin comfort |
pH Sensor Options for Arduino
Analogue pH Sensor Kit (E-201-C Probe)
The standard Arduino pH kit includes a glass electrode probe (E-201-C or similar), a signal conditioning board with BNC connector, and a potentiometer for offset adjustment. The probe generates a voltage proportional to pH (about 59.16 mV per pH unit at 25°C, based on the Nernst equation). The signal board amplifies this to a 0-5V range readable by Arduino’s ADC.
These kits cost ₹500-800 and work well for educational and hobby projects. The probe has a lifespan of 6-12 months with proper care.
DFRobot Gravity pH Sensor v2
A higher-quality option with better signal conditioning and BNC connector. It includes a calibration tool and better documentation. Costs about ₹1,500-2,000. Worth it for long-term monitoring setups.
Wiring the pH Sensor Module
| pH Board Pin | Arduino Pin |
|---|---|
| V+ (VCC) | 5V |
| GND | GND |
| Po (Analogue Out) | A0 |
Screw the pH probe’s BNC connector into the board’s BNC socket. Keep the probe cable away from motor drivers and power lines — pH signals are very small and easily contaminated by electrical noise.
Two-Point Calibration Procedure
pH sensors must be calibrated with buffer solutions of known pH. Buy pH 4.0 and pH 7.0 buffer sachets (available at aquarium shops or online for about ₹50-80 per pair).
- Rinse the probe with distilled water and pat dry.
- Immerse in pH 7.0 buffer. Wait 2 minutes for reading to stabilise. Record the analogue value.
- Rinse again with distilled water.
- Immerse in pH 4.0 buffer. Wait 2 minutes. Record the analogue value.
- Calculate slope and intercept for the linear equation: pH = slope × voltage + intercept.
// Calibration values (replace with YOUR readings)
const float PH7_VOLTAGE = 2.50; // Voltage at pH 7.0
const float PH4_VOLTAGE = 3.04; // Voltage at pH 4.0
// Calculate calibration constants
float slope = (7.0 - 4.0) / (PH7_VOLTAGE - PH4_VOLTAGE);
float intercept = 7.0 - slope * PH7_VOLTAGE;
Arduino Code for pH Measurement
const int phPin = A0;
const int NUM_SAMPLES = 40;
// Calibration constants (from your calibration)
const float PH7_VOLTAGE = 2.50;
const float PH4_VOLTAGE = 3.04;
float slope, intercept;
void setup() {
Serial.begin(9600);
slope = (7.0 - 4.0) / (PH7_VOLTAGE - PH4_VOLTAGE);
intercept = 7.0 - slope * PH7_VOLTAGE;
Serial.println("pH Sensor Ready");
Serial.print("Slope: "); Serial.println(slope, 4);
Serial.print("Intercept: "); Serial.println(intercept, 4);
}
void loop() {
// Average multiple readings for stability
float voltageSum = 0;
for (int i = 0; i < NUM_SAMPLES; i++) {
voltageSum += analogRead(phPin) * (5.0 / 1024.0);
delay(20);
}
float voltage = voltageSum / NUM_SAMPLES;
float pH = slope * voltage + intercept;
Serial.print("Voltage: ");
Serial.print(voltage, 3);
Serial.print("V | pH: ");
Serial.println(pH, 2);
delay(2000);
}
Practical pH Projects for India
1. Hydroponics pH Controller
Maintain optimal pH (5.5-6.5) in your hydroponic nutrient reservoir using an Arduino, pH sensor, and peristaltic pumps for pH Up and pH Down solutions. When pH drifts outside the target range, the system adds a small dose of corrective solution automatically. Critical for rooftop hydroponics in Indian cities where water quality varies by area.
2. Aquarium pH Monitor with Alerts
Indian aquarium hobbyists know that municipal water pH varies widely — Delhi water runs 7.5-8.5, while Bengaluru borewell water can be 6.5-7.5. A continuous pH monitor with an ESP32 sends Telegram alerts when pH drifts outside your fish’s safe range. Particularly important during water changes or CO2 injection in planted tanks.
3. Drinking Water Quality Tester
Build a portable water quality tester with a pH sensor and TDS (Total Dissolved Solids) probe. Test borewell water, RO purifier output, and municipal supply. Indian BIS standard IS 10500 specifies drinking water pH between 6.5 and 8.5.
4. Soil pH Tester for Agriculture
Indian soils range from acidic (pH 4.5-5.5 in Kerala’s laterite soils) to alkaline (pH 8.0-8.5 in Rajasthan). Mix soil with distilled water (1:5 ratio), let it settle, and measure the extract pH. This guides lime or sulphur amendment decisions for farmers and serious gardeners.
Sensor Care and Maintenance
- Always store the probe wet — the glass membrane must stay hydrated. Store in pH 4.0 buffer or 3M KCl solution. Never let it dry out.
- Rinse with distilled water between samples — tap water can contaminate readings due to dissolved minerals.
- Recalibrate monthly — the probe’s response changes over time as the glass membrane ages.
- Keep the BNC connector dry — moisture in the connector causes erratic readings.
- Replace the probe annually — glass pH probes have a typical lifespan of 6-18 months depending on usage and storage.
Frequently Asked Questions
How accurate is an Arduino pH sensor?
With proper two-point calibration, you can expect ±0.1-0.2 pH accuracy. This is sufficient for hydroponics, aquariums, and water testing. For laboratory-grade accuracy (±0.01 pH), you need a certified pH meter with temperature compensation — those start at ₹3,000-5,000.
Can I measure pH of soil directly?
Not by sticking the probe into soil. The glass probe needs liquid contact. Make a soil-water slurry (1 part soil, 5 parts distilled water), stir, let settle for 30 minutes, then measure the liquid. This gives a reliable estimate of soil pH.
Why does temperature affect pH readings?
The Nernst equation governing pH electrode response includes a temperature term. At 25°C, the sensitivity is 59.16 mV per pH unit. At higher temperatures, the sensitivity increases. For accurate readings, use automatic temperature compensation (ATC) by adding a DS18B20 and adjusting the slope in software.
My pH readings jump around. How do I get stable values?
Average 20-50 readings. Ensure the BNC connector is dry and tight. Keep the probe cable away from motors and power supplies. Wait 2 minutes after immersing the probe before reading — the glass membrane needs time to equilibrate. If readings still jump, the probe may be ageing or damaged.
Can I leave the pH probe submerged permanently?
For short-term monitoring (weeks), it works. For permanent installations, the probe ages faster when continuously submerged. Professional aquaculture and hydroponics systems retract the probe between measurements using an automated arm — but for hobby use, replacing the probe every 6-12 months is more practical.
Conclusion
A pH sensor module for Arduino costs under ₹800 and opens up a range of practical projects from hydroponics control to water quality testing. The key to good results is proper calibration with buffer solutions and careful probe maintenance. For Indian water conditions — where municipal, borewell, and RO water all have different pH levels — having a portable pH tester is genuinely useful information, not just a hobby exercise.
Get pH sensors and water quality testing components at Zbotic’s sensor collection.
Add comment