ARDUINO PH METER

77,285

220

26

Introduction: ARDUINO PH METER

About: Founded in 2005, Atlas Scientific specializes in building laboratory grade sensing equipment for robots, appliances, and industrial control systems. Thousands of Atlas Scientific sensors can be found in a wide…

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

Note:

- This meter was developed on a Windows computer. It was not tested on Mac.
- The enclosure is not waterproof.

MATERIALS

TOOLS

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

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 above, 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. 6.4mm (1/4") 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. 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 undersurface 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

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

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

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

4) Add the mini breadboard onto the base plate.

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

Datasheets

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 "Atlas_gravity.zip". In the IDE go to Sketch -> Include library -> Add .ZIP Library. Locate the "Atlas_gravity.zip" 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.

Note that pH 7 calibration should be performed first.

Calibration commands

Mid-point: cal,7

Low-point: cal,4

High-point: cal,10

Clear calibration: cal,clear

Steps

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

b) Pour some of the pH 7 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,7 into the serial monitor. Calibration to pH 7 is now complete.

Repeat steps a-d for pH4 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.

Be the First to Share

    Recommendations

    • Big and Small Contest

      Big and Small Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • For the Home Contest

      For the Home Contest

    26 Comments

    0
    VisualDrizzle
    VisualDrizzle

    5 weeks ago

    Could someone send a picture of the breadboard with the resistors and wires set up? I can’t get the display to work, it turns on but won’t project the pH. Any help is appreciated.

    0
    avignonresearch
    avignonresearch

    Question 3 months ago

    Hello. I have an Atlas Scientific pH probe (ENV-30-PH) and an Atlas Scientific Gravity pH Meter V2.2. I calibrated the pH probe using ESP8266 D1 mini microcontroller and everything worked well. However, the pH levels were not read from the ESP8266 D1 mini when the microcontroller powered-up. I would expect the calibrated values to be stored in the EEPROM and read from the EEPROM when restarted. Am I missing something? Thank you.

    0
    asuranewsnetwork
    asuranewsnetwork

    Question 1 year ago

    I'm pretty new to this and I'm having trouble understanding the wiring/schematic. Is there a better picture/ example I can look at.

    0
    CB71
    CB71

    Answer 11 months ago

    It took me a while but here ya go. Hope it helps.

    Breadboard Pins.jpgUNO pins.jpg
    0
    salazar.gracie
    salazar.gracie

    2 years ago

    Since working with a 16x2 LCD Display as opposed to the 20x4, I've been having trouble with getting the code to cooperate with the display to show the pH on screen. Any ideas on how to get it to work?

    0
    salazar.gracie
    salazar.gracie

    Reply 2 years ago

    or maybe just problems with the setup of the breadboard?

    0
    mohamadmoh2025
    mohamadmoh2025

    2 years ago

    Can this circuit be used to measure the acidity of olive oil ?? What value will the sensor give to the acidity of the oil in this case?
    Kindly can you provide me with links to download the acidity sensor libraries

    0
    AtlasScientific
    AtlasScientific

    Reply 2 years ago

    It cannot be used to measure the acidity of olive oil.

    0
    CB71
    CB71

    Question 2 years ago

    Looks easy to build. Could this be used for soil pH testing? Since posted has there been any updates in software or circuits? Is there means to include a battery?

    0
    AtlasScientific
    AtlasScientific

    Answer 2 years ago

    Yes, it can be used for soil pH testing. There were no updates in software or circuits. It is possible to include a battery.

    0
    bpm5cm
    bpm5cm

    2 years ago

    Would it be difficult to change the calibration inputs from a serial command to a push button? This way it could be free standing.

    0
    AtlasScientific
    AtlasScientific

    Reply 2 years ago

    It is not difficult. Adding push buttons would be a neat modification.

    0
    Turbo_Nasty
    Turbo_Nasty

    3 years ago

    Hello. I tried to compile the code today. I received an error. arduino_pH_meter:75:8: error: 'class Gravity_pH' has no member named 'cal_clear'
    pH.cal_clear(); //call function for clearing calibration
    ^
    exit status 1
    'class Gravity_pH' has no member named 'cal_clear'


    I am not a great programmer. I did look through the H and cpp files I did not see anything for Cal clear. Any one else run into this?

    0
    AtlasScientific
    AtlasScientific

    Reply 3 years ago

    The function for clearing the calibration has been added to the .h and .cpp files.
    Update the "Atlas_gravity" folder in your Arduino IDE.

    0
    BradW127
    BradW127

    Reply 3 years ago

    Ran into this issue as well. Can't seem to get it to work for some reason :/

    0
    AtlasScientific
    AtlasScientific

    Reply 3 years ago

    Check that your .h and .cpp files have the function for clearing the calibration.

    0
    Turbo_Nasty
    Turbo_Nasty

    Reply 3 years ago

    Thanks. I can’t wait to try it.

    1
    AndrewM512
    AndrewM512

    Question 3 years ago

    would there be anything different if the lcd is an IC2 connection?

    0
    AndrewM512
    AndrewM512

    Answer 3 years ago

    with doing this with a IC2 display do i still need the two resistors? and is there a way to use an esp8266 inplace of the arduino and get remote reading form it? if so can you point me in the direction to explain how to do it ? thanks

    0
    AtlasScientific
    AtlasScientific

    Reply 3 years ago

    It depends on the type of I2C display. If the display has a button for adjusting the screen contrast then there is no need for the two resistors.

    It is possible to use an esp8266 inplace of the arduino. The design and coding would have to be redone. Refer to the following link for an example where an esp8266 was used with some of our EZO sensors.
    https://www.instructables.com/Atlas-WiFi-Hydroponics-Meter/