PH Meter

From ProjectWiki
(Difference between revisions)
Jump to: navigation, search
(New page: <big>pH Meter</big> ==Errata== ==Probe== A pH probe works something like a little battery powered by the test solution. In a nutral solution the pH probe would generate 0v. An acidic sampl...)
 
Line 1: Line 1:
 
<big>pH Meter</big>
 
<big>pH Meter</big>
==Errata==
+
==What is this?==
 +
Here is a simple pH meter that uses standard pH probes. This is a quick unfinished afterthought to the [[PPM_Meter]] article. (u_u~feel free to make additions or corrections.) It describes how to use a standard and pretty cheap (like $10-$40) pH meter probe and make a simple meter or microcontroller interface.
 +
 
 
==Probe==
 
==Probe==
 +
[[Image:PHProbe.JPG|right|thumb|120px|Typical pH Probe]]
 
A pH probe works something like a little battery powered by the test solution. In a nutral solution the pH probe would generate 0v. An acidic sample would generate a positive voltage proportional to the ionic strenghth of the sample being measuring. A basic solution does the same except resulting in a negative voltage outpout.   
 
A pH probe works something like a little battery powered by the test solution. In a nutral solution the pH probe would generate 0v. An acidic sample would generate a positive voltage proportional to the ionic strenghth of the sample being measuring. A basic solution does the same except resulting in a negative voltage outpout.   
  
 
So, a standard pH Probe generates a voltage either positive or negative proportional to the acidicy or baseyness of whatever its testing.
 
So, a standard pH Probe generates a voltage either positive or negative proportional to the acidicy or baseyness of whatever its testing.
 +
 +
It does this using this fascinating thing called [http://en.wikipedia.org/wiki/Glass_electrode Glass Electrode]. It has this little ball (see pic!) at the tip with a special pH glass. The probe's output is fed thru a shielded cable into the amplifier. Shielding is needed because the extremely low voltages and currents involved are easily are susceptible to noise.
  
 
The output of this probe is very small, very low current (extremely high impedance), varies a lot between probes (even by the same manufacturer) and is affected by the room temperature. It requires additional circuitry process the signal and give some type of usable output.
 
The output of this probe is very small, very low current (extremely high impedance), varies a lot between probes (even by the same manufacturer) and is affected by the room temperature. It requires additional circuitry process the signal and give some type of usable output.
 +
 +
Ok, so why not just MAKE a pH probe?? Good question! Tbhnfirly. Seem to remember something about using two dissimilar metals to power a clock from potatoes which seems as if it may work, have not actually tried it... ~_~
  
 
==Amplifier==
 
==Amplifier==
 +
[[Image:PH-sch-only.jpg|400px|thumb|right|Simple pH Meter amp. [[:Image:PH-sch.jpg|Click here for full Version w/notes!!]]]]
 
The circuit here will allow adjusting for probe and temperature variants and produce output in Volts/pH or ADC compatible ranges.
 
The circuit here will allow adjusting for probe and temperature variants and produce output in Volts/pH or ADC compatible ranges.
* Volts/pH configuration: output will be between 0 and 14Volts with the voltage directly
+
* Volts/pH configuration: output will be between 0 and 14Volts with the voltage directly representing the pH value. This is most useful if you want to plug it directly into a volt meter.
representing the pH value. This is most useful if you want to plug it directly into a volt meter.
+
* ADC configuration: output will be between 0 and 5V for interfacing with an ADC or microcontroller's input range.
* ADC configuration: output will be between 0 and 5V for interfacing with an ADC or  
+
microcontroller's input range.
+
  
 
It uses op-amp U1a to amplify and buffer the high impedance signal from the probe and adjust the slope which is done by adjusting the gain loop. The output of this stage if adjusted properly would be beetween -7v to+7v with -8 peing pH of 14 and +7 being pH of 0. Wha is needed is for this voltage to be inverted and offset, and bothe those tasks  are accomplshed using op-amp-u1b. The output at this stage should be 0 to 14FV indicating the pH of the sample being tested.
 
It uses op-amp U1a to amplify and buffer the high impedance signal from the probe and adjust the slope which is done by adjusting the gain loop. The output of this stage if adjusted properly would be beetween -7v to+7v with -8 peing pH of 14 and +7 being pH of 0. Wha is needed is for this voltage to be inverted and offset, and bothe those tasks  are accomplshed using op-amp-u1b. The output at this stage should be 0 to 14FV indicating the pH of the sample being tested.
  
 +
Prolly should note that the circuit has no AC noise limiting, this could be a problem if the probe is located near electromagnetic sources such as pump motors. If you get sporadic readings might try a .1uF or so capacitor across R3. Being in the gain loop of U1b it will work as a integrator and easily pass DC such as the probe reading, while nullifying AC signals. :D
 +
 +
==Microcontroller Stuffs==
 
If using in ADC mode, you can use the microcontroller to scale/offset. just set the offset a little above 0v and set 7pH to be about 2.5v. Then use the controller to sample the offset and scale test solutions, then calculate the ph of test sample. Like this for fixed point maths:
 
If using in ADC mode, you can use the microcontroller to scale/offset. just set the offset a little above 0v and set 7pH to be about 2.5v. Then use the controller to sample the offset and scale test solutions, then calculate the ph of test sample. Like this for fixed point maths:
  
Line 22: Line 31:
 
/* zero (7pH) ph meter */
 
/* zero (7pH) ph meter */
 
void c_zeroPh(void) {
 
void c_zeroPh(void) {
m_cfg.phoset=delayADC(ADC_CH1,m_cfg.phdelay);
+
m_cfg.phoset=delayADC(ADC_CH1);
 
meterSave(); // save settings to eeprom
 
meterSave(); // save settings to eeprom
 
}
 
}
Line 28: Line 37:
 
/* calibrate ph to 4.0 solution */
 
/* calibrate ph to 4.0 solution */
 
void c_scalePh(void) {
 
void c_scalePh(void) {
m_cfg.phscale=((long)(delayADC(ADC_CH1,m_cfg.phdelay)-m_cfg.phoset)*10000)/-300;
+
m_cfg.phscale=((long)(delayADC(ADC_CH1)-m_cfg.phoset)*10000)/-300;
 
meterSave(); // save settings to eeprom
 
meterSave(); // save settings to eeprom
 
}
 
}
Line 34: Line 43:
 
void c_readPh(void) {
 
void c_readPh(void) {
 
long pH;
 
long pH;
pH=((long)(delayADC(ADC_CH1,m_cfg.phdelay)-m_cfg.phoset)*10000/m_cfg.phscale)+700; // read the results
+
pH=((long)(delayADC(ADC_CH1,)-m_cfg.phoset)*10000/m_cfg.phscale)+700; // read the results
 
printf("pH: %2i.%02i\r\n",(int)pH/100,(int)pH-(int)((pH/100)*100));
 
printf("pH: %2i.%02i\r\n",(int)pH/100,(int)pH-(int)((pH/100)*100));
 
}
 
}
 
</source>
 
</source>

Revision as of 04:08, 3 March 2008

pH Meter

Contents

What is this?

Here is a simple pH meter that uses standard pH probes. This is a quick unfinished afterthought to the PPM_Meter article. (u_u~feel free to make additions or corrections.) It describes how to use a standard and pretty cheap (like $10-$40) pH meter probe and make a simple meter or microcontroller interface.

Probe

Typical pH Probe

A pH probe works something like a little battery powered by the test solution. In a nutral solution the pH probe would generate 0v. An acidic sample would generate a positive voltage proportional to the ionic strenghth of the sample being measuring. A basic solution does the same except resulting in a negative voltage outpout.

So, a standard pH Probe generates a voltage either positive or negative proportional to the acidicy or baseyness of whatever its testing.

It does this using this fascinating thing called Glass Electrode. It has this little ball (see pic!) at the tip with a special pH glass. The probe's output is fed thru a shielded cable into the amplifier. Shielding is needed because the extremely low voltages and currents involved are easily are susceptible to noise.

The output of this probe is very small, very low current (extremely high impedance), varies a lot between probes (even by the same manufacturer) and is affected by the room temperature. It requires additional circuitry process the signal and give some type of usable output.

Ok, so why not just MAKE a pH probe?? Good question! Tbhnfirly. Seem to remember something about using two dissimilar metals to power a clock from potatoes which seems as if it may work, have not actually tried it... ~_~

Amplifier

The circuit here will allow adjusting for probe and temperature variants and produce output in Volts/pH or ADC compatible ranges.

  • Volts/pH configuration: output will be between 0 and 14Volts with the voltage directly representing the pH value. This is most useful if you want to plug it directly into a volt meter.
  • ADC configuration: output will be between 0 and 5V for interfacing with an ADC or microcontroller's input range.

It uses op-amp U1a to amplify and buffer the high impedance signal from the probe and adjust the slope which is done by adjusting the gain loop. The output of this stage if adjusted properly would be beetween -7v to+7v with -8 peing pH of 14 and +7 being pH of 0. Wha is needed is for this voltage to be inverted and offset, and bothe those tasks are accomplshed using op-amp-u1b. The output at this stage should be 0 to 14FV indicating the pH of the sample being tested.

Prolly should note that the circuit has no AC noise limiting, this could be a problem if the probe is located near electromagnetic sources such as pump motors. If you get sporadic readings might try a .1uF or so capacitor across R3. Being in the gain loop of U1b it will work as a integrator and easily pass DC such as the probe reading, while nullifying AC signals. :D

Microcontroller Stuffs

If using in ADC mode, you can use the microcontroller to scale/offset. just set the offset a little above 0v and set 7pH to be about 2.5v. Then use the controller to sample the offset and scale test solutions, then calculate the ph of test sample. Like this for fixed point maths:

/* zero (7pH) ph meter */
void c_zeroPh(void) {
	m_cfg.phoset=delayADC(ADC_CH1);
	meterSave(); // save settings to eeprom
}
 
/* calibrate ph to 4.0 solution */
void c_scalePh(void) {	
	m_cfg.phscale=((long)(delayADC(ADC_CH1)-m_cfg.phoset)*10000)/-300;
	meterSave(); // save settings to eeprom
}
 
void c_readPh(void) {
	long pH;
	pH=((long)(delayADC(ADC_CH1,)-m_cfg.phoset)*10000/m_cfg.phscale)+700; // read the results
	printf("pH: %2i.%02i\r\n",(int)pH/100,(int)pH-(int)((pH/100)*100));
}
Personal tools
irssi scripts
eggdrop scripts