Project tutorial
DIY Benchtop pH Meter

DIY Benchtop pH Meter © CC BY-NC

How to make a benchtop pH meter with an Arduino Uno and the Gravity analog pH sensor from Atlas Scientific.

  • 33 respects

Components and supplies

Necessary tools and machines

Drill, drill bits, drywall cutter bits, files, screwdrivers, benchtop vise, band saw, glue gun and glue stick, soldering iron and solder, digital caliper, ruler

Apps and online services

About this project

In this project, we will be making a benchtop pH meter using the Gravity analog pH circuit and probe from Atlas Scientific and an Arduino Uno. Readings will be displayed on a liquid crystal display (LCD).


- This meter was developed on a Windows computer. It was not tested on Mac.

- The enclosure is not waterproof.

Step 1: Prepare Housing

Safety : Remember to take care when handling tools/machinery and to wear proper safety gear such as goggles, gloves, and respirators.

The housing used is an ABS plastic enclosure. It has to be modified for the pH meter.

Cut opening for the LCD

a) The LCD is placed in the top portion (cover) of the enclosure. Center a 98x40mm rectangle on the cover.

b) Put the piece in the vise and drill a 3.2mm (1/8") pilot hole in the rectangle that was marked off.

c) Use this pilot hole as the start point for the 3.2mm (1/8") drywall cutting bit. Since this a small job, we will use the bit on the hand drill rather than a drywall cutting machine. Work on the inside of the rectangle instead of the lines as it may be a bit difficult to cut in a straight manner with this bit on the drill.

d) Next, use a hand file to remove the excess material and shape the rectangle to the required size.

Cut openings for BNC connector and Arduino ports

The openings for the BNC connector and Arduino ports are on the side of the bottom portion of the enclosure.

a) Using the dimensions provided below, mark the center point for the circle and outlines for the two rectangles.

b) Put the piece in the vice and cut the openings. The circular opening is made using drill bits. The rectangular ones are made by following a similar process used to make the opening for the LCD.

Outfit the base plate to mount components

The base plate is used to mount the Arduino, pH sensor and mini breadboard. 3.2mm thick acrylic sheet is used.

a) Using a band saw, cut the acrylic sheet to 135x62.5mm.

b) Mark off the positions for the four holes as shown below. Drill 2.38mm (3/32") diameter holes. Countersink the holes on one side of the plate to a depth of 3mm and diameter of 4.4mm (11/64"). This is necessary to keep a flat under-surface when the screws are inserted to hold the standoffs.

c) Attach the 11mm standoffs using the provided screws. The pH sensor comes with 4 standoffs and screws. Use two of them for the Arduino.

Step 2: Install Electronics in Housing

a) Insert the base plate into the bottom portion of the housing. Keep in position with screws or hot glue.

b) Mount the pH sensor on the base plate. Secure to standoffs with screws.

c) Mount the Arduino Uno onto the base plate. Secure to standoffs with screws.

d) Add the mini breadboard onto the base plate.

e) Solder the header pins to the LCD (pins provided). Insert LCD into the top portion of the housing and use some hot glue to keep the screen in place.

Step 3: Wire Electronics Together

Wire the components are shown in the schematic above.

Use the mini breadboard for the 1kΩ and 220Ω and for distributing the Arduino's 5V and ground pins.

The two resistors are used to set the screen contrast.


Gravity pH sensor, pH probe

Step 4: Finalize Assembly

After the wiring has been completed:

a) Put the top and bottom portions of the housing together using the provided screws.

b) Connect the probe to the BNC connector.

Step 5: Upload Code Onto Arduino Uno

The code for this project makes use of customized libraries and header files. You will have to add them to your Arduino IDE to use the code. The steps below include the process of making this addition to the IDE.

a) Connect the Arduino to your computer and open the IDE. The IDE can be downloaded from this LINK if you do not have it. Go to Tools -> Board -> Select Arduino/Genuino Uno. Go to Tools -> Port -> select the port where the Arduino is connected to.

b) Add Liquid Crystal Display library: In the IDE go to Sketch -> Include library -> Manage libraries. In the search bar of the Library Manager enter "liquidcrystal". Look for the package titled "LiquidCrystal Built-in by Arduino, Adafruit". It may or may not be installed. If not, select the package and click on install.

c) Add Atlas Gravity sensor library: Download the zip file from the following LINK. The file will be saved as "". In the IDE go to Sketch -> Include library -> Add.ZIP Library. Locate the "" file and select to add.

d) Next, we have to add the code for the pH meter. Copy the code from this LINK onto the IDE work panel.

e) Compile and upload the code to the Arduino.

f) The pH readings will then be displayed on the LCD. You can also view the readings on the serial monitor. To open the serial monitor, go to Tools -> Serial Monitor or press Ctrl+Shift+M on your keyboard. Set the baud rate to 9600 and select "Carriage return".

Step 6: Calibrate pH Sensor

Note: If you plan on using an external power supply for the Arduino, connect it to the Arduino before doing the calibration. This will ensure that the reference levels are appropriately set, which will aid in the correct calibration.

This pH meter can be calibrated to one, two or three-points calibration. Standard buffer solutions (pH 4, 7 and 10) are required

The serial monitor is used for the calibration process. The user will be able to observe the gradual change in readings as they come to stabilization and send the appropriate commands.

Calibration data are stored in the EEPROM of the Arduino.

Calibration commands

Low-point: cal, 4

Mid-point: cal, 7

High-point: cal, 10

Clear calibration: cal, clear


a) Remove the soaker bottle and rinse off the pH probe.

b) Pour some of the pH 4 solution into a cup. Ensure that there is enough to cover the sensing area of the probe.

c) Place the probe in the cup and stir it around to remove trapped air. Observe the readings on the serial monitor. Let the probe sit in the solution until the readings stabilize (small movement from one reading to the next is normal)

d) After the readings stabilize, enter the command cal, 4 into the serial monitor. Calibration to pH 4 is now complete.

Repeat steps a-d for pH7 and pH10. Remember to rinse the probe as you proceed to different buffer solutions.

What about temperature compensation?

The sensor used in this project has an accuracy of +/- 0.2%. The pH meter will operate within this accuracy in the temperature range of 7 - 46°C. Outside of this range, the meter will have to be modified for temp compensation. Note: The pH probe can be subjected to a range of 1 − 60 °C.


arduino pH meter codeC/C++
Once uploaded, open the serial monitor, set the baud rate to 9600 and append "Carriage return"
The code allows the user to observe real time pH readings as well as calibrate the sensor.
One, two or three-point calibration can be done.

Calibration commands:
 low-point: "cal,4"
 mid-point: "cal,7"
 high-point: "cal,10"
 clear calibration: "cal,clear"

#include "ph_grav.h"                                  //header file for Atlas Scientific gravity pH sensor
#include "LiquidCrystal.h"                            //header file for liquid crystal display (lcd)

String inputstring = "";                              //a string to hold incoming data from the PC
boolean input_string_complete = false;                //a flag to indicate have we received all the data from the PC
char inputstring_array[10];                           //a char array needed for string parsing
Gravity_pH pH = A0;                                   //assign analog pin A0 of Arduino to class Gravity_pH. connect output of pH sensor to pin A0
LiquidCrystal pH_lcd(2, 3, 4, 5, 6, 7);               //make a variable pH_lcd and assign arduino digital pins to lcd pins (2 -> RS, 3 -> E, 4 to 7 -> D4 to D7)

void setup() {
  Serial.begin(9600);                                 //enable serial port
  pH_lcd.begin(20, 4);                                //start lcd interface and define lcd size (20 columns and 4 rows)
  pH_lcd.setCursor(0,0);                              //place cursor on screen at column 1, row 1
  pH_lcd.print("--------------------");               //display characters
  pH_lcd.setCursor(0,3);                              //place cursor on screen at column 1, row 4
  pH_lcd.print("--------------------");               //display characters
  pH_lcd.setCursor(5, 1);                             //place cursor on screen at column 6, row 2
  pH_lcd.print("pH Reading");                         //display "pH Reading" 
  if (pH.begin()) { Serial.println("Loaded EEPROM");} 
  Serial.println(F("Use commands \"CAL,4\", \"CAL,7\", and \"CAL,10\" to calibrate the circuit to those respective values"));
  Serial.println(F("Use command \"CAL,CLEAR\" to clear the calibration"));

void serialEvent() {                                  //if the hardware serial port_0 receives a char
  inputstring = Serial.readStringUntil(13);           //read the string until we see a <CR>
  input_string_complete = true;                       //set the flag used to tell if we have received a completed string from the PC

void loop() {

  if (input_string_complete == true) {                //check if data received
    inputstring.toCharArray(inputstring_array, 30);   //convert the string to a char array
    parse_cmd(inputstring_array);                     //send data to pars_cmd function
    input_string_complete = false;                    //reset the flag used to tell if we have received a completed string from the PC
    inputstring = "";                                 //clear the string
  Serial.println(pH.read_ph());                       //output pH reading to serial monitor
  pH_lcd.setCursor(8, 2);                             //place cursor on screen at column 9, row 3
  pH_lcd.print(pH.read_ph());                         //output pH to lcd

void parse_cmd(char* string) {                      //For calling calibration functions
  strupr(string);                                   //convert input string to uppercase

  if (strcmp(string, "CAL,4") == 0) {               //compare user input string with CAL,4 and if they match, proceed
    pH.cal_low();                                   //call function for low point calibration
    Serial.println("LOW CALIBRATED");
  else if (strcmp(string, "CAL,7") == 0) {          //compare user input string with CAL,7 and if they match, proceed
    pH.cal_mid();                                   //call function for midpoint calibration
    Serial.println("MID CALIBRATED");
  else if (strcmp(string, "CAL,10") == 0) {         //compare user input string with CAL,10 and if they match, proceed
    pH.cal_high();                                  //call function for highpoint calibration
    Serial.println("HIGH CALIBRATED");
  else if (strcmp(string, "CAL,CLEAR") == 0) {      //compare user input string with CAL,CLEAR and if they match, proceed
    pH.cal_clear();                                 //call function for clearing calibration
    Serial.println("CALIBRATION CLEARED");


arduino pH meter wiring diagram
Uploads2ftmp2f86efa8d0 6026 41fb 90f2 8b308cc58b852fph gravity wiring diagram28229 kom6t1sj0o


Similar projects you might like

DIY pH Dosing Pump

by Atlas Scientific

  • 28 respects

Arduino pH Sensor Calibration

by Atlas Scientific

  • 10 respects

Arduino DIY Light Meter With BH1750 Sensor

Project tutorial by Nick Koumaris

  • 4 respects
Add projectSign up / Login