---
title: Step‑by‑Step Guide to Building a Low‑Cost Potentiometric pH Sensor for Home Labs
siteUrl: https://logzly.com/electrodeinsights
author: electrodeinsights (Electrode Insights)
date: 2026-06-18T12:25:22.873970
tags: [phsensor, diylab, electrochemistry]
url: https://logzly.com/electrodeinsights/stepbystep-guide-to-building-a-lowcost-potentiometric-ph-sensor-for-home-labs
---


If you’ve ever tried to measure the acidity of a garden soil or a homemade kombucha brew with a cheap strip, you know the frustration of vague numbers and short‑lived accuracy. A proper potentiometric pH sensor can give you reliable, repeatable readings, and you don’t need a $200‑plus lab instrument to get one. In this post I’ll walk you through building a functional pH sensor for under $30, using parts you can find at a local electronics store or online. By the end you’ll have a device that talks to your Arduino or Raspberry Pi and lets you log data the way a real scientist would.

## Why a Potentiometric Sensor?

A potentiometric sensor measures the voltage that develops between a glass electrode (the part that contacts the solution) and a reference electrode. The voltage is directly related to the hydrogen ion activity, which we report as pH. Unlike color‑based strips, the voltage reading is linear, temperature‑compensated (if you add a simple thermistor), and can be logged continuously. That makes it perfect for [home‑brew experiments](/electrodeinsights/design-a-low-cost-ph-sensor-with-custom-electrodes-a-practical-step-by-step-tutorial), small‑scale battery research, or any DIY project that needs real‑time acidity monitoring.

## Parts List – Keep It Simple

| Item | Typical Cost | Where to Find |
|------|--------------|---------------|
| Glass pH electrode (miniature, 2 mm tip) | $12‑15 | e‑bay, hobby‑shop |
| Ag/AgCl reference electrode (solid‑state) | $8‑10 | e‑bay, scientific supply |
| BNC connector (female) | $1‑2 | electronics store |
| 10 MΩ resistor (high precision) | $0.10 | any electronics retailer |
| Arduino Nano (or any 5 V microcontroller) | $5‑7 | online |
| Small breadboard and jumper wires | $3‑4 | hobby shop |
| Optional: thermistor (10 kΩ) for temperature compensation | $1‑2 | electronics store |
| Enclosure (plastic project box) | $2‑3 | hardware store |

Total: roughly $30. If you already have an Arduino or a breadboard, the cost drops even further.

## Assembling the Sensor Head

### 1. Prepare the Electrodes

The glass electrode is fragile, so handle it by the metal stem, not the glass tip. Rinse it with distilled water and gently pat dry. The reference electrode comes pre‑filled with a saturated KCl solution; you can leave it as is.

### 2. Connect the Electrodes to a BNC Plug

Most hobby‑level data loggers use a BNC connector for a clean, shielded link. Solder a short piece of insulated wire to the inner conductor of the BNC plug – this will be the signal line from the glass electrode. Solder another wire to the outer shield – this will serve as the common (ground) and also connect to the reference electrode.

**Tip:** Use a heat‑shrink tube over each solder joint. It keeps moisture out and adds a bit of mechanical strength.

### 3. Build the High‑Impedance Input

The voltage from a pH electrode is tiny (typically 0‑200 mV) and the internal resistance of the glass can be several hundred megaohms. To avoid loading the sensor, we need a high‑impedance buffer. A simple way is to place a 10 MΩ resistor between the signal line and the Arduino’s analog input. This resistor forms a voltage divider with the electrode’s internal resistance, keeping the current below a microampere.

### 4. Add Temperature Compensation (Optional but Recommended)

pH readings shift about 0.03 units per degree Celsius. If you want better accuracy, attach a 10 kΩ thermistor next to the electrode tip. Connect it in a voltage divider with a 10 kΩ fixed resistor and feed the junction to another analog pin. You can then correct the pH value in software using the measured temperature.

## Wiring to the Arduino

1. Connect the BNC shield (ground) to the Arduino GND pin.  
2. Connect the BNC signal (through the 10 MΩ resistor) to A0.  
3. If you added a thermistor, connect its divider junction to A1 and the other ends to 5 V and GND respectively.  
4. Power the Arduino via USB or a 5 V wall adapter.

## Calibrating the Sensor

Calibration is the most important step. You’ll need two standard buffer solutions, typically pH 4.00 and pH 7.00 (or pH 10.00 if you work in alkaline range). Here’s the process:

1. Rinse the glass electrode with distilled water, then dip it into the pH 7.00 buffer. Wait for the reading to stabilize (about 30 seconds). Record the raw analog value (let’s call it V7).  
2. Rinse again, then dip into the pH 4.00 buffer. Wait and record the raw value (V4).  
3. Compute the slope (m) and offset (b) using the Nernst equation simplified for room temperature:  

   `m = (pH7 - pH4) / (V7 - V4)`  

   `b = pH7 - m * V7`  

   In code, you’ll convert the analog reading (0‑1023) to voltage (0‑5 V) first, then apply the linear equation `pH = m * voltage + b`.

If you added temperature compensation, you’ll also need a temperature‑correction factor. A simple approach is to adjust the slope by `0.03 * (T - 25)` where T is the measured temperature in Celsius.

## Sample Arduino Sketch

```cpp
const int pHpin = A0;
const int tempPin = A1;   // optional
const float Rref = 10000.0; // 10k resistor for thermistor divider
const float Rhigh = 10000000.0; // 10M resistor

float V7 = 2.45; // replace with your measured voltage at pH 7
float V4 = 2.85; // replace with your measured voltage at pH 4
float pH7 = 7.0;
float pH4 = 4.0;

float m = (pH7 - pH4) / (V7 - V4);
float b = pH = pH7 - m * V7;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int raw = analogRead(pHpin);
  float voltage = raw * (5.0 / 1023.0);
  float pH = m * voltage + b;

  // temperature compensation (optional)
  int tRaw = analogRead(tempPin);
  float Rt = Rref * (1023.0 / tRaw - 1.0);
  float T = 1.0 / (log(Rt / Rref) / 3950.0 + 1.0 / 298.15) - 273.15; // B=3950
  pH = pH + 0.03 * (T - 25.0);

  Serial.print("Voltage: "); Serial.print(voltage, 3);
  Serial.print(" V  pH: "); Serial.print(pH, 2);
  Serial.print("  Temp: "); Serial.print(T, 1); Serial.println(" C");
  delay(1000);
}
```

Replace `V7` and `V4` with the voltages you recorded during calibration. The sketch prints a clean line of data you can copy into a spreadsheet or feed into a logging program.

## Testing It Out

Start with something easy: a cup of lemon juice. Dilute it 1:1 with distilled water, stir, and dip the sensor. You should see a pH around 2‑3. Next, try a baking‑soda solution (1 tsp in 200 ml water) – expect a pH - expect a pH near 9. If the numbers look reasonable, you’ve built a working sensor!

## Troubleshooting Common Issues

* **Drifting readings** – Make sure the reference electrode is not drying out. Keep it moist with a small drop of KCl solution or replace it if it looks cracked.  
* **No voltage change** – Check the connections at the BNC plug; a loose ground will kill the signal. Verify the 10 MΩ resistor is correctly placed.  
* **Noise spikes** – Shielded cables help, but you can also add a small capacitor (0.1 µF) across the signal and ground near the Arduino input to smooth out high‑frequency noise.

## A Little Story from My Lab

When I first tried this project last summer, I used a borrowed glass electrode that had been sitting in a drawer for years. The first reading I got was a steady 0.5 V no matter what solution I tried. I was ready to give up, but then I remembered a tip from a senior colleague: “Always check the reference electrode first.” A quick dip of the reference alone into a buffer gave me a clean 0.2 V shift, confirming the reference was still alive. Swapping the glass electrode solved the problem, and I learned that even a tiny piece of old glass can ruin the whole experiment. Now I keep a spare electrode in my toolbox – you never know when a rogue buffer will need rescuing.

## Going Further

Once you’re comfortable with the basic sensor, you can explore:

* **Multi‑point calibration** – add a pH 10 buffer for a three‑point curve, improving accuracy across the full range.  
* **Wireless logging** – pair the Arduino with an ESP‑01 module and send data to your phone or a cloud dashboard.  
* **Integration with battery tests** – monitor electrolyte pH in a small flow cell while you charge a [lithium‑ion pouch cell](/electrodeinsights/stepbystep-guide-to-building-a-lowcost-highperformance-lithiumion-battery-electrode-at-home). The data can reveal subtle degradation pathways.

Building a low‑cost potentiometric pH sensor is a great way to bring real electrochemical measurement into a home lab. It teaches you about high‑impedance circuits, the quirks of glass electrodes, and the importance of careful calibration. Most of all, it gives you confidence that you can trust the numbers you see on the screen, whether you’re brewing kombucha or tinkering with next‑gen battery chemistries.