Shop OBEX P1 Docs P2 Docs Learn Events
pH Probe??? — Parallax Forums

pH Probe???

Anthony240Anthony240 Posts: 24
edited 2006-04-05 17:19 in BASIC Stamp
I was wondering if Parallax sells a probe that could be used to measure pH?· I have located a circuit online that will measure small changes in voltage using RCTIME command.· This circuit can be used with probes that put out small changes in voltage, IE: a pH probe.

pH circuit I found online:· (scroll to bottom of page)
http://www.emesystems.com/BS2rct.htm

Thanks
Anthony

Comments

  • Anthony240Anthony240 Posts: 24
    edited 2006-03-21 17:07
    I have done some research and found a probe that I think will work. The probe I found is the S200C-BNC from sensorex.com (http://www.sensorex.com/support/specifications/download/LabSpecs.pdf). The only question that I have is can the basic stamp handle a high impedance millivolt input from the pH probe? If so, shouldn't I be able to use the circuit in the above website at the bottom of the page?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-03-21 17:32
    You'll have to get an ADC (analog-to-digital converter) because the Stamps don't have analog inputs as such.

    [noparse][[/noparse] Does the BS2p40 have an analog comparator? ]
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-03-21 18:35
    Not to step on anyone's toes, but it is way too common of a misconception that you need an ADC for reading any analog voltage. ADCs have thier place and purpose, but a good 80-90% of the time, the hobbiest is just throwing away thier money. For approximate and ocassional readings RCTIME works just fine. Tracy Allen's circuit would work fine with a pH probe, because incorporating active circuit elements such as the opamp in his circuit, will greatly reduce the errors due to tolerances in the passive components chosen.

    About the only time you really need an ADC is when you want a very high precision value and/or very fast readings. In the first case unless you're placing the ADC on a well designed·mixed signal PCB, you are not going to get the precision anyways. In the second situation, what the heck are you using a basic stamp in the mix anyways?

    For moderate precision, sigma delta techniques can be used.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 3/21/2006 6:44:48 PM GMT
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-21 19:02
    If I just use the pH probe and hook it directly to the pH circuit, will I have to amplify the signal before running it into the pH circuit. From what I can tell, the pH circuit result will not change much with very small changes in the probe voltage. If I wanted to amplify the signal comming from the probe what would be the best way to do that? That way the small changes would be amplified into bigger changes then fed into the pH circuit and the result would be differ for small changes in the probe signal.

    Paul,
    I don't follow you on the sigma delta techniques. Could you tell me more about them?
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-03-21 19:18
    Yes, you should be able to use the circuit from the above website, at the bottom of the page (of the above website).

    The purpose of the op-amp in that circuit IS to amplify the millivolt high-impedance signal of the Ph Probe.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-03-21 19:19
    · It can be difficult making recommendations.

    · I recall someone posting about what to do with an IC that output a voltage proportional to incident light (volts, not millivolts.)· I recommended using the output voltage to turn on a transistor, using it as a variable resistor (hence the name) in an RCTIME circuit, having done an experiment of my own and posted same.· Almost immediately,·some august individual·came along, tut-tutted and pooh-poohed and pronounced the situation a prime candidate for an ADC.· Then it turns out the guy only wanted to use the IC for dawn/dusk sensing (you don't need an ADC for that.)··
    · Other situations where a high degree of resolution is thought necessary only to turn on a port-a-potty fan or·somesuch.
    · Some people have grand expectations.· Y'know what I mean?·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-03-21 20:07
    Anthony, dont worry about sigma delta, its not that easy to explain and its not needed for what you are doing.

    PJ Allen, there is a difference of opinion even among experienced people, but it is more out of personal bias or inexperience with analog voltages that they "dont want to bother with it" and use an ADC. I myself thought ADCs needed to be used more often until very recently when I heard Chip explain σδ in a way I understood more clearly. He explained it when asked about ADC on the propeller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-03-22 07:32
    Anthony, the circuit at www.emesystems.com/BS2rct.htm#SmallV would work fine to amplify the high impedance voltage from a pH probe, provided you choose an appropriate op-amp. It has to be an op-amp with a very high input impedance and low picoamp level bias current, either FET or CMOS. I'd probably use an LM6482, which is a CMOS input op-amp with 4 picoamp input current and it can work in that circuit on the single 5 volt power supply. If you have to get something from Radio Shack, then about the only choice is a TL072, but you would have to provide it with + and - 9 volt power supplies, which is a pain. Do NOT try to use a '741 or an LM358 or other bipolar op amp. The input current is much much too high.

    The voltage output from pH probes is not really that small, tenths of a volt full scale. So you might not have to sweat about the input offset voltage of the op amp. If you want the highest possible accuracy, a CMOS input CAZ amp like the LT1051 is the way to go, but then you probably would want to use an ADC instead of RCtime.

    The circuit as shown works only with positive signals, which would mean Acidic pH, unless you flip the input polarity and measure basic pH. The circuit could be modified a little to cover both + and -. Sensorex pH probes are very good.

    Also refer to www.emesystems.com/OL2ph.htm
    Anthony240 said...
    I have done some research and found a probe that I think will work. The probe I found is the S200C-BNC from sensorex.com (http://www.sensorex.com/support/specifications/download/LabSpecs.pdf). The only question that I have is can the basic stamp handle a high impedance millivolt input from the pH probe? If so, shouldn't I be able to use the circuit in the above website at the bottom of the page?
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Anthony240Anthony240 Posts: 24
    edited 2006-03-22 14:30
    Tracy,

    Is the ztx1051 transistor the only one I could use? I'm not familiar with that particular transistor but I will read up on it. I ordered the S200C-BNC pH probe today from Sensorex. I am also ordering a LM6482 op amp and the ztx1051 transistor. Hopefully by the end of the week I'll be measuring pH!!!

    Thanks
    Anthony
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-03-22 16:26
    You could use any NPN transistor there, but the Zetex transistor is a superbeta type. That means its gain is very high, which translates into low error. The Zetex transistors in the super-e-line series are really really good transistors to have around. They can also handle much higher power levels at lower base drive currents than ordinary NPNs (like the 2N1304).

    You could also use a low threshold n-fet, and that would work even lower errors, but you would not notice a difference in this application.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Anthony240Anthony240 Posts: 24
    edited 2006-04-04 12:09
    Good news!! I'm measuring pH. Using the RCtime circuit at the following web site (http://www.emesystems.com/BS2rct.htm#SmallV) with R1=10K, R2=120ohm and C2=.01uF I can measure the mV input from my pH probe and convert that to a pH value. Like Tracy stated in a previous posting, the circuit as shown only works with positive signals, which means Acidic pH < 7. How can I modify the circuit to cover both + and - values? As soon as I put my probe into at pH of 7 or greater my values reads 0. One thing I thought about was to add a 1 volt offset to the signal so that I will always have a positive value of pH. How could I add a 1 volt offset to the signal?

    At the following web site, (http://www.emesys.com/OL2ph.htm) there is a sample of basic stamp code that reads a mV value and converts it to pH. This example also has a 1 Volt offset that is compensated for. Does anybody know where I can find the ADread subroutine that returns the mV value? The ADread subroutine is not shown on this page.

    Thank You
    Anthony
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-04-04 18:05
    Congrats on the success! The ADread routine is simply a generic reference to whatever routine you use to measure the voltage. For example, www.emesystems.com/OL2tlc2543.htm.

    There are ways to modify the RCtime circuit at #SmallV. The easiest way is to lift the ground connection of the pH probe off ground by 0.4 volt at the input of the amplifier. That could be done with a resistor divider. Then neutral pH would give an RCtime value corresponding to 0.4 volts. Acid (pH<7) would increase the voltage at the input and decrease the RCtime value, and alkaline (pH>7) would decrease the voltage below 0.4 volts, and increase the RCtime reading. Do you see what I mean? There are less kluged ways to do it, but I think they would involve a lot more wiring, at which point you are better off with an ADC. Did you get the LM6482? It is a dual op-amp, so you could use 1/2 of it to buffer the 0.4 volt reference from the resistor divider.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Anthony240Anthony240 Posts: 24
    edited 2006-04-04 19:58
    I did get the LM6482 op-amp. But I don't follow how I could use half of it to buffer the .4 volt reference from the resistor divider? I'm not really sure how to hook up the op-amp to create a resistor divider to get the .4 volt offset.

    Thanks
    Anthony
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-04-04 21:23
    Anthony,

    ·· Methods vary, but what I use to get a divided voltage is a multi-turn 100K potentiometer.· Then using a known IN voltage I dial-in my OUT voltage.· For example, if I want to scale 0-15V to 0-5V I would put exactly 15 volts on one end of the pot, the other to ground, the adjust the set screw until I have exactly 5V on the wiper.· This is especially useful when you have multiple channels to calibrate, which I often do.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-04-05 05:30
    Hi Anthony,

    Here is what I have in mind:

    attachment.php?attachmentid=41115

    The voltage divider between the 10kohm and 866 ohm resistor should produce about 0.4 volt at the junction (866/10866 * 5 ~= 0.4). Or you could use a potentiometer there, like Chris suggested. The op-amp acts as a buffer to create a "virtual ground" at its output pin. The (-) side of pH probe attaches to that (instead of to the regular ground). The (+) side of the pH probe attaches to the input of the VCCS circuit you already have. The output when pH is zero will be near what you have as full scale now, so you may have to adjust R and C. The RCtime result will be a shorter time in acid and a longer time in alkali. The pH output voltage (~ +/- 0.4 volt) is added to the 0.4 volt offset. Is that clear?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
    542 x 167 - 2K
  • Anthony240Anthony240 Posts: 24
    edited 2006-04-05 12:50
    If I understand correctly, when I put the probe into a pH of 7 I should get .4 volt out. I have found that there is 59.16mV/ph so when I put the probe into a pH of 4 I should get 578mV and when I put the probe into a pH of 10 I should get 222mV. I then can convert that mV value to pH.

    What I'm not too sure about is the relationship between the R and C in the circuit. I have been using a .01uF capacitor and changing the value of R. I have noticed that the bigger value of R, the longer RCtime value I get. But I haven't seen the effect of the capacitor. Using a .1uF cap I was getting similar values as when I used the .01uF cap. Any hints here?

    Thanks
    Anthony
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-04-05 16:00
    You are correct about how the pH voltage adds to (or subtracts from) the 400 millivolts, at the input to the VCCS stage. Call that Vph. (Did I say, VCCS=Voltage controlled current source).

    The op amp and R enforce a current source of,
    I = Vph / R
    So, if R = 1000 ohms, when Vph = 400 mV
    I = 0.4 / 1000 = 0.0004 amp = 400 microamps.

    The charging of the capacitor is linear. Assume that it starts at 5 volts, and it has to charge down to 1.4 volts, the Stamp threshold.
    dV/dt = I/C
    dV/dt is a constant when I is a constant, so we can separate the terms:
    dV = I dt / C
    dt = C dV / I
    t = C (5 - 1.4) / 0.0004
    and if C=0.1uf
    t = 0.0009 second, 900 microseconds, or 450 RCtime units on a BS2. I think I calculated that right, off the cuff. Please check it!

    That is the formula you can use to choose R and C. It is best to keep the current small, in the 100 microamp range, so that the capacitor can be fully prepped to Vdd when the stamp pin is a high output. So I would choose R of around 4000 ohms. The current with pH changes will then be in the 0 to 200 microamp range. With C=0.1 uF, then RCtime result will be centered (at pH=7) at around 3600 microseconds (1800 RCtime units on a BS2).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Anthony240Anthony240 Posts: 24
    edited 2006-04-05 17:19
    Tracy,

    WOW. That really helps. You are a life saver. My project is due by the end of the month and I think that I may just get it done and all working. You have been a great help and I wanted to thank you.

    I can't wait to get home tonight and try out all my new knowledge. I will let you know if I have any more problems.

    Thanks
    Anthony
Sign In or Register to comment.