View previous topic :: View next topic |
Author |
Message |
hbk
Joined: 20 Mar 2006 Posts: 3
|
Posted: Tue Mar 21, 2006 11:33 pm Post subject: PH electrode interface |
|
|
Hi,
Does anybody have an idea on interfacing a PH probe ?
Thank you!
HB |
|
Back to top |
|
|
PatM
Joined: 25 Oct 2004 Posts: 104
|
Posted: Wed Mar 22, 2006 7:26 am Post subject: |
|
|
I don't know how much you know about pH sensors and/or electronics - so I'll give the $10 tour instead of the 50 cent one. Just skip what you already know!
Its fairly easy once you understand what a pH sensor is: a battery. When you immerse a pH sensor in the solution to be tested, the pH (amount of free positive hydrogen atoms - (p)otential of (H)ydrogen) determines how much voltage and which direction the current will flow.
pH sensors put out positive or negative voltages (temperature dependant) around +600mV to -600mV with neutral pH (7.0) putting out zero volts. The lower the pH (acidic) the more positive the voltage gets and the more base the more negative the output gets. So at a pH of 14 (as base as you can get) the probe would put out about -400mV and at a pH of 0 (super-duper acid) about +400mV at room temperature. The higher the temperature, the greater the voltage.
The standard output is called the Nerst potential and is at 54.2mV per pH unit at zero degrees celcius. Each degree celcius higher adds 0.1984mV per pH unit - so at 25C (room temperature) you get 59.16mV per pH unit.
The tricky part about pH sensors is that, although the voltage is easy to read, the current capability of the sensor is extremely low. An ORP sensor (chlorine/bromine) can be read with a simple multimeter - just stick in in the solution and connect the meter to read it. A pH sensor, on the other hand, puts out so little current that a multimeter acts as like a short - dropping the voltage to zero; unless you can find a voltmeter with a 1 teraohm input impedence or better (not available in your local home hardware).
Most ADCs don't have that kind of input impedence either - the Mega32, for example, recommends 10Kohm or less source output impedance. On top of the impedence problem, you also have to deal with a sensor that put out both positive and negative voltages. The Mega ADCs are single ended (meaning they read only positive voltages).
So to deal with both the high output impedance and the dual-voltage output problem, you need to buffer the sensor signal through an OP-AMP and use more op-amps to add a positive offset to the signal, making it all positive voltages.
I use the LMC6482 or the TLC2264, both are 16 volt dual supply units, meaning they don't care what voltages go to the VCC (V+) and ground (V-) pins as long as the difference isn't greater than 16 volts - I use +5 of course on V+ and generate -5 volts using a ICL7662. Both amps also have a 10 Teraohm input impedance, so they can read the pH probe signal with no troubles at all. You can use just about any double-ended OPAMP as long as it has a 1 teraohm or better input impedance, rail to rail isn't really required.
You will need three opamp stages (two LMC6482's which have two opamps in each chip or one 2264 which has four):
The first is a simple voltage follower - this reads the tiny-current signal from the sensor and puts out an identical voltage with a beefy current capability.
The second is to buffer and adjust an offset signal using the -5V supply. Since the AVR's ADC cannot read a negative voltage, you want to take the -400mV to +400mV signal and add at least 400mV to it - that way your AVR sees +0 to +800 instead. I add about 600mV just to be safe (1200mV if 2x gain).
The third op-amp combines the offset voltage and the sensor signal and gives you the ADC ready voltage.
I just threw together a schematic and attached it as a JPG. I've used this before and it worked fine. I used the TLC2264 which is why you only see one set of power pins - it has four opamps in a single package (and yes, its available in DIPs!).
That should get you started.
Edit: You may want to feed the 7662 +9V to get -9 out, then run that through a 7905 regulator (same as the 7805 but for negative voltage) to get rock solid -5 volts. I didn't find it necessary but... |
|
Back to top |
|
|
hbk
Joined: 20 Mar 2006 Posts: 3
|
Posted: Wed Mar 22, 2006 10:48 pm Post subject: |
|
|
Thank you for very elaborate and very explaining entry on ph electrodes.
My idea was to use the differential capability of the Mega32 and a simple voltage follower on one side of the electrode and the shield side to a Vdd/2 resistor split. Your idea is more by the book and prevents of course an eventual earth voltage leak problem.
My Mega32 board already use the PA so I find it easier to use a I2C based ADC like PCF8574, with only 8 bit and no amplification adjustment as far as I could see I will need to amplify signal about 5 times.
I would like to see your schematic it's seems to be missing?
Best regards
HB
|
|
Back to top |
|
|
PatM
Joined: 25 Oct 2004 Posts: 104
|
Posted: Thu Mar 23, 2006 1:16 am Post subject: |
|
|
The schematic is attached to my reply - it shows up right in the message display - but you have to be logged in to see it. Also, I just had to log in twice before the forum decided I was truly logged in. |
|
Back to top |
|
|
PatM
Joined: 25 Oct 2004 Posts: 104
|
Posted: Thu Mar 23, 2006 1:26 am Post subject: |
|
|
I dont think the differential channels work the way you think. If I remember correctly, the Mega differential just lets you use a positive voltage above ground as the bottom end instead of only ground.
Also, what are you trying to measure and what range are you concerned with? If you're just trying to keep something between 6 and 8 pH, 8 bit is fine. I use them for swimming pools where the pH must stay between 7.4 and 7.6, I had to go 12 bits so I could see 1/100th pH units. |
|
Back to top |
|
|
beeBop
Joined: 26 Oct 2005 Posts: 4
|
Posted: Sat Mar 25, 2006 5:55 am Post subject: |
|
|
Hi Pat,
Thanks alot for this; you saved me a lot of research time!
Just a question about C4 - pin1 is +, yes?
And terra is 10 to the power of 12?
Just wondering if I can do it in a TLC084.
Anyway, thanks a lot!
Regards,
Robert |
|
Back to top |
|
|
PatM
Joined: 25 Oct 2004 Posts: 104
|
Posted: Sat Apr 01, 2006 6:05 pm Post subject: |
|
|
Sorry for the delay, was busy elsewhere. Yes, Pin 1 is + on C4. The 7662 output is negative so the negative leg of the cap goes to its output and the positive to ground.
The TLC084 is a single supply opamp, it can't take the negative voltage the pH sensor puts out, only the positive side. |
|
Back to top |
|
|
PatM
Joined: 25 Oct 2004 Posts: 104
|
Posted: Sat Apr 01, 2006 6:07 pm Post subject: |
|
|
Oh and yes, 10^12, millions of millions. |
|
Back to top |
|
|
beeBop
Joined: 26 Oct 2005 Posts: 4
|
Posted: Mon Apr 03, 2006 1:10 am Post subject: |
|
|
Hi Pat,
No worries about the delay, thanks for the answer!
Ah: Quote: | The TLC084 is a single supply opamp, |
No, it has + and - supply; I'm doing a project with TLC08x right now. In fact, I may try the ph sensor on this board, and I'll have +12 and -12 from a max 743, if it outputs smooth enough source. I'll let you know how it goes.
Thanks again,
Robert |
|
Back to top |
|
|
PatM
Joined: 25 Oct 2004 Posts: 104
|
Posted: Thu Jun 22, 2006 1:50 pm Post subject: |
|
|
How are you making out? One thing I found is you have to be very careful with your grounding. Make sure you run a seperate ground wire directly from the regulator to the ADC reference/OpAmps. The first time I tried this I had the ADC etc on the same digital ground as my processor - holy bouncing numbers batman!
BTW: The TLC084 datasheet says its a single supply OpAmp. Did you just name the wrong model number?
http://focus.ti.com/lit/ds/symlink/tlc080a.pdf |
|
Back to top |
|
|
PatM
Joined: 25 Oct 2004 Posts: 104
|
Posted: Thu Jun 22, 2006 1:52 pm Post subject: |
|
|
Jeez, I just noticed: I have the notes wrong on the drawing - omitting R2 makes 1x gain, not 2x... Using R2 makes it 2x. Dunno what I was thinking. |
|
Back to top |
|
|
beeBop
Joined: 26 Oct 2005 Posts: 4
|
Posted: Sat Jun 24, 2006 2:25 am Post subject: |
|
|
Hi Pat,
OMG! You are right! I looked at the data sheet I have locally, and it is very different! I checked the date - Revised November 1992! The data sheet you linked to is 2006. Now I'm wondering just where I got that data sheet from??
Strangely enough, I have used it with +/- supply, and it worked? Now I'm totally baffled. I think I need to get in touch with TI and find out how to tell the difference. Or better still, change Amps!
I haven't had the chance to put this together just yet; too much work on my plate, but the time is comming up.
I will keep you posted, and thanks so much for the heads up.
Regards,
Robert |
|
Back to top |
|
|
PatM
Joined: 25 Oct 2004 Posts: 104
|
Posted: Tue Jun 27, 2006 4:16 pm Post subject: |
|
|
Ok, I really messed up that schematic and mixed two schemes together. In the original circuit, R7 and R8 give U1D a 2x gain, and there was supposed to be a 221K resistor after R10 in parallel with C1. This halves the output of U1A so the net result is 1x gain from U1D. So the circuit above would have 4x gain as shown, 2x if R2 was omitted.
The original circuit was difficult to control with gains. R10 and the missing resistor as well as R7 and R8 had to be matched as close as possible in resistances to get exactly 1x and 2x gain, a few percent off and the gains could be anywhere from 0.9 to 2.2. I found having three gain combinations to be just too much mucking about.
I'm going to breadboard this again and sort out what I did in the actual circuit. If I remember correctly, I omitted R8 and the missing resistor, leaving the only gain adjustments at R2 and R3. |
|
Back to top |
|
|
press9761
Joined: 20 Jun 2006 Posts: 108
|
Posted: Wed Jul 12, 2006 3:27 am Post subject: more PH info |
|
|
The information posted under this topic is excellent. I have read it many times. However, could you possible put a corrected schematic up and possibly a picture of the circuit you put together (for reference). I want to build this but I'm hesitant because of the mistakes discussed.
The PH probe explanation was perfect!
Thank you all so much!!! |
|
Back to top |
|
|
PatM
Joined: 25 Oct 2004 Posts: 104
|
Posted: Wed Jul 12, 2006 10:19 pm Post subject: |
|
|
Ok, here's a fixed version of the original circuit - this has the missing resistor added and the gain notes corrected.
Been busy working on the Talkbox, haven't had a chance to breadboard up the pH circuit again.
Don't worry about making up a pH circuit - just use one of those white plastic breadboards and you can experiment all you want with gains. Just don't hook the output directly to an ADC until after you've decided on a gain and have enough offset voltage that you won't send the ADC a negative voltage. |
|
Back to top |
|
|
|