{"id":1494,"date":"2014-06-22T03:45:58","date_gmt":"2014-06-22T01:45:58","guid":{"rendered":"http:\/\/hex.ro\/wp\/?p=1494"},"modified":"2015-05-31T13:39:58","modified_gmt":"2015-05-31T11:39:58","slug":"ph-electrode-mv-output-using-an-atlas-scientific-ph-circuit","status":"publish","type":"post","link":"https:\/\/hex.ro\/wp\/blog\/ph-electrode-mv-output-using-an-atlas-scientific-ph-circuit\/","title":{"rendered":"pH Electrode mV output using an Atlas Scientific pH Circuit"},"content":{"rendered":"<p><strong>Introduction<\/strong><\/p>\n<p>Atlas Scientific makes a nice <a href=\"https:\/\/www.atlas-scientific.com\/product_pages\/embedded\/ph.html\" title=\"pH Circuit\">pH circuit<\/a> that is very simple to setup and communicate with via serial.<\/p>\n<p>Part of my Aquarium Monitoring project, I decided to employ 4 pH Circuits (v5.0) to retrieve the pH in all my 4 aquariums. I encountered two problems:<br \/>\na) The <a href=\"https:\/\/www.atlas-scientific.com\/product_pages\/components\/multi-uart-carrier.html\">Multi Circuit Carrier Board<\/a> (that allows connecting 4 pH Circuits on a ready made board with BNC connectors) doesn&#8217;t give the possibility to hookup a PWR ISO individually for each channel.<br \/>\nb) There&#8217;s no possibility to access the mV values recorded by the device, you only get a string representing the pH value.<\/p>\n<p><!--more--><\/p>\n<p>I will describe the impact of problem a) in a future post.<br \/>\nImpact of problem b) is that without access to the mV values:<br \/>\n1) you can&#8217;t determine the slope of the electrode (so that you can tell how healthy it is). An electrode is considered good if the ph 7 offset is within the +\/-25mV and the slope is between 90% and 105%.<br \/>\n2) no possibility to do software calibration given the raw mV values (so that you can use pH buffers of 7, 4 and 9 for example)<\/p>\n<p>My controller is a pcDuino3 since I believe Arduino shields are much more expensive than needed so with a pcDuino3 I got a smart node which aggregates all measured values (for now pH and temperatures using DS18B20 sensors) to a Cacti server for MRTG charts of the values.<\/p>\n<p>I had difficulties finding a pH 10 buffer solution to calibrate the pH Circuit at the 7 4 and 10 values. You can&#8217;t tell it to calibrate at 9 for example, but if you could get access to the raw mV values of the electrode, then you could calculate the offset and the slope (and do a proper regression line) using other pH buffers beside 4 or 10.<\/p>\n<p>I decided to try to work out the mV from the output of pH Circuit.<\/p>\n<p><strong>Equations:<\/strong><\/p>\n<p>Since the pH Circuit offers an output even after being reset (the X command) it meant it has a function (either hardware or software) that will take the mV output of the electrode and convert it to a pH value, considering the temperature to be 25C.<\/p>\n<p>I made few assumptions:<br \/>\na) in the reset state, the pH circuit assumes the electrode is ideal, and that a 0 mV readout from the electrode will be shown as ph &#8220;7.00&#8221; (and for example, a ~170mV output of the electrode will be shown as &#8220;4.00&#8221;).<br \/>\nb) in the reset state, the pH Circuit assumes the slope to be 59.15 mV\/pH (pH Circuit documentation says that it will consider the temperature of 25C once reset).<\/p>\n<p>Thus:<\/p>\n<pre>mV = 59.15 * (7 - pH)<\/pre>\n<p>However, there was no way I could test that this function holds.<\/p>\n<p>I got curious if how the pH Circuit adjusts the output values when you send various temperature commands. Since I&#8217;m currently testing with two aquariums, one had a stable pH at 7.86 and the second one had the pH at around 6.92 (both pH Circuits were in the reset state \/ no calibration).<\/p>\n<p>I mapped out the output of pH Circuits after sending it various temperatures commands:<\/p>\n<pre>Temp  Tank 1  Tank 2\r\n 0    7.94    6.91 \r\n10    7.91    6.92\r\n20    7.88    6.92\r\n25    7.86    6.92\r\n30    7.85    6.92\r\n40    7.82    6.92\r\n50    7.79    6.93<\/pre>\n<p>So for the Tank 1, the output decreased with 0.03 pH units per each 10C, while for Tank 2 it almost stayed the same. While I sent the commands (let&#8217;s say everything took less than few minutes) the tanks were during lights off thus I assumed there were no temperature \/ pH variations that could change the output of the electrodes themselves.<\/p>\n<p>After reading more about the pH electrode mV corrections related to temperature, it was normal to have a 0.03 increments when the pH is at 8, and almost no influence when the pH is 7). And this is what the pH Circuit was reporting! So it behaves correctly.<\/p>\n<p>I found a table of the slope dependency to temperature here: <a href=\"http:\/\/www.all-about-ph.com\/ph-temperature-compensation.html\">http:\/\/www.all-about-ph.com\/ph-temperature-compensation.html<\/a> and put it in Libre Office to see the chart:<\/p>\n<p><a href=\"http:\/\/hex.ro\/wp\/wp-content\/uploads\/2014\/06\/ph_slope_vs_temp.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hex.ro\/wp\/wp-content\/uploads\/2014\/06\/ph_slope_vs_temp-300x190.png\" alt=\"ph_slope_vs_temp\" width=\"300\" height=\"190\" class=\"aligncenter size-medium wp-image-1496\" srcset=\"https:\/\/hex.ro\/wp\/wp-content\/uploads\/2014\/06\/ph_slope_vs_temp-300x190.png 300w, https:\/\/hex.ro\/wp\/wp-content\/uploads\/2014\/06\/ph_slope_vs_temp.png 844w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>It was linear. I asked Libre Office to insert a regression line for the slope to temperature table and the rounded up function was<\/p>\n<pre>f(T) = 0.2 * T + 54.2<\/pre>\n<p>Where T is in Celsius and f(T) represents the slope value depending on the temperature.<\/p>\n<p>Putting the slope into the initial mV equation results in:<\/p>\n<pre>mv = (0.2 * T + 54.2)(7 - pH)<\/pre>\n<p>where:<\/p>\n<p>T is the temperature in Celsius and pH is the pH circuit output.<\/p>\n<p>So now I had an electrode which was at 25C reporting &#8220;6.92&#8221; value, what should pH Circuit display if we assume the temperature is actually 0C ?<\/p>\n<p>At 25C, and output of 6.92, then with equation 1:<\/p>\n<pre>mV = 59.15 * (7 - pH)\r\nmV = 59.15 * (7-6.92) = 59.15 * 0.08 = 4.732<\/pre>\n<p>Since the temperature of the tank \/ electrode isn&#8217;t actually changed (so still the same mV value is read from the electrode) by pH Circuit, we could work out what value is should display based on the slope:<\/p>\n<pre>\r\nmv = (0.2 * T + 54.2)(7 - pH)\r\n=>\r\npH = 7 - mv\/(0.2 * T + 54.2)\r\n=> (since we'll ask the pH circuit for the value assuming T = 0C\r\npH = 7 - 4.732 \/ 54.2\r\n=> pH = 6.912<\/pre>\n<p>This is exactly the value reported by pH Circuit when I send it the &#8220;00.00&#8221; command (asking it to assume a temperature of 0C) \ud83d\ude42<\/p>\n<p>So now I can estimate the mV of the electrode given the temperature of the tank is known (but I use a DS18B20 isolated sensor for each tank) and the output of a uncalibrated pH Circuit.<\/p>\n<p><strong>References:<\/strong><\/p>\n<p>1. <a href=\"http:\/\/www.omega.com\/Green\/pdf\/pHbasics_REF.pdf\">http:\/\/www.omega.com\/Green\/pdf\/pHbasics_REF.pdf<\/a> (page 2 and 3)<br \/>\n2. <a href=\"http:\/\/www.all-about-ph.com\/ph-temperature-compensation.html\">http:\/\/www.all-about-ph.com\/ph-temperature-compensation.html<\/a><br \/>\n3. <a href=\"https:\/\/www.atlas-scientific.com\/_files\/_datasheets\/_circuit\/pH_Circuit_5.0.pdf\">https:\/\/www.atlas-scientific.com\/_files\/_datasheets\/_circuit\/pH_Circuit_5.0.pdf<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Atlas Scientific makes a nice pH circuit that is very simple to setup and communicate with via serial. Part of my Aquarium Monitoring project, I decided to employ 4 pH Circuits (v5.0) to retrieve the pH in all my 4 aquariums. I encountered two problems: a) The Multi Circuit Carrier Board (that allows connecting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1609,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-1494","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it"],"_links":{"self":[{"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/posts\/1494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/comments?post=1494"}],"version-history":[{"count":18,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/posts\/1494\/revisions"}],"predecessor-version":[{"id":1666,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/posts\/1494\/revisions\/1666"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/media\/1609"}],"wp:attachment":[{"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/media?parent=1494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/categories?post=1494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/tags?post=1494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}