Example Code

pH Measurement Emulator Revised for DAQmx

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • Data Acquisition (DAQ)


  • LabVIEW


  • NI DAQmx

Code and Documents




This example program emulates a handheld pH meter, and is based on a previous DevZone example for Traditional NI-DAQ (Legacy).



The  program reads in voltage values from a pH probe connected to an E Series  or equivalent DAQ device, while displaying the current pH measurement  in a digital display and a gradiated color box.  The program also offers  a calibration subsection that allows the user to calibrate the ph probe  and a data logging subsection.


This VI reads in a voltage from a pH probe, converts the  voltage value to a pH and then displays the pH on the front panel.  The probe uses a default calibration factor, however you can use the  calibration option to self calibrate the meter.   The calibration  settings are stored in a datalog file (calibrate.dlg) so that the meter  will retain the new calibration. 



  • LabVIEW 2009 or compatible
  • DAQmx 8.9.5 or compatible


  • Most NI DAQ devices, but may require additional signal conditioning hardware
  • pH probe


Steps to Implement or Execute Code

  1. Select the appropriate data acquisition device, channel, terminal configuration and sample rate for your pH probe.
  2. Click the Calibrate button to create a scaling function for your data using a known pH value and corresponding voltage measurement.
  3. Click Begin Logging Data/Stop Logging Data to start and stop logging pH data to the pHlogfile.txt file.
  4. Click STOP to stop your program.


Additional Information or References

This is a modified version of the original pH Meter Traditional NI-DAQ (Legacy) code to work with DAQmx, now located with the rest of the Traditional NI-DAQ (Legacy Examples).

For more information on pH Measurements see the the Introduction to pH Measurements.



**This document has been updated to meet the current required format for the NI Code Exchange.**

National Instruments
Applications Engineer

Visit ni.com/gettingstarted for step-by-step help in setting up your system.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.


I would like to know if I can use this VI with a 5pin pH probe, I have NI cDAQ-9174  chassis, Just I need to know what module purchase to build my system, thanks

Hai, I currently conducting an experiment using LABVIEW as the main system for monitoring. I'm using arduino to connect pH probe to my laptop. However, I have problem to coding the VIs for pH probe and I need help for coding pH probe using LABVIEW 2016, could you please help me?