PDA

View Full Version : DIY ph amp



DIY
Fri May 18, 2007, 07:30 AM
I've been meaning to make a pH amp for a while now, Bad Inferno's 1-wire monitoring system and Bald_noggin's pic based controller gave me the spark to continue on with what I'd already started.

I wanted a pH amp that could be connected to different devices, for example a 1-wire ADC or a PIC. To be the most portable I wanted the following things

. Operate from a single supply, preferably 5v
. Have a gain of around 8.2 to provide a resolution of .01 PH using 10bit adc found on most PIC's @ 5v.
. Calibration adjustment pot's included to reduce need for memory usage on a PIC due to needing a programmed calibration routine.
. Work with 1-wire ds2450 as well as PIC, although ds2450 accuracy is only 8bit, it can be configured to read at 10.
. Simple & cheap to build, the hardest part should be making the board

So on to the circuit, I'm no electronic's guru but I do like to DIY... I've looked at various pH circuits on the net and in project books and decided on the basic example design given in the LM6001 opamp datasheet and added various features found in other circuits.

The spec is a usable output of just above 0v to just below 5v and the intended 0.01 resolution on a 10bit ADC. The readable range is 2.0 - 12.0 pH.. Since I'm not planning on running an aquarium lower than a pH of 2.0 or higher than 12.0 it's fine for me.

The first pic is the circuit in operation on a breadboard, it is connected to my other stalled project - a pic based controller...
I'm really happy with the operation so far so the next step is to make a PCB and house it in a shielded enclosure.

Second pic is the actual circuit, some values may still need some "tweaking" otherwise it seems to work ok.

More to follow...

(Info added, circuit updated 19/5)

Bad Inferno
Fri May 18, 2007, 11:15 AM
Great job...Tell me about the 7660. I think what I am seeing is a input of 5VDC and a +/- output of what voltage....?

I built a cct for a pressure sensor had all sorts of trouble ranging the thing. its output was 4-20ma and I put it across a 250 ohm resistor to give me 1-5VDC....however I could not get the span I wanted and have ended up with a span of 1.5 volts on my 1wire A/D input which can take 0-5VDC. I don't want to steal your ph amp thread so I might PM you my cct. If you wouldn't mind having a look. I use this pressure sensor as level monitoring in my reservoir. The sensors provide something like 0-10mv for 0-10 kpa. I assume I can use your exact cct just change the gain ?

http://www.freescale.com/files/sensors/doc/data_sheet/MPX2010.pdf



rob

DIY
Fri May 18, 2007, 11:29 AM
I actually was considering the same thing after I finish some of the things I have started... I even did a quick breadboarded circuit some time ago but didn't get it quite right at the time..

Very similar circuit to the one above and yes different gain, I think I have a couple of examples somewhere I used when I tried it. I'll do a hunt and see what I have. pm me your email and I'll send you what I have, and happy to look at what you have so far.

The 7660 is an inverter so for 5v in gives -5v out, it has limitations like it can't provide much current, and even at a couple of mA drain will start to drop voltage - eg +5v gives -4.7v but for an opamp or 2 it's handy.

DiscusMad
Fri May 18, 2007, 02:06 PM
I wish I had great knowlage on electronics
the best I ever did was some sort of keyboard at high school

DIY
Fri May 18, 2007, 02:15 PM
I wish I had great knowlage on electronics

Me too :lol: :lol:

It's all self taught and fiddling for me. I've spent more hours surfing the web reading than any person should spend in front of a monitor.... but it's great when it comes together!

DIY
Fri May 18, 2007, 04:19 PM
Update:

I've spent this evening creating a pcb board layout in cadsoft's eagle (it's free!), the main criteria was it should fit inside the 100x50x25mm diecast enclosure I got today.

Pic's are of the actual board layout and a printed copy of the layout sitting near the enclosure after i checked the dimensions.

DIY
Sun Jul 15, 2007, 02:02 PM
Been meaning to update this thread for a while :oops:

I'll let the pics do the talking :lol: :lol:

DIY
Sun Jul 15, 2007, 02:04 PM
Works great connected to my breadboarded PIC controller. I was able to calibrate without any problems, although in the attached pic the pobe is just in storage solution. The RJ45 connection is based on the 1-wire standard for analogue sensors.

DIY
Sun Jul 15, 2007, 02:14 PM
And finally a pic of it connected to a DS2450 1-wire ADC which is in turn hooked up to a NSLU2 (not pictured) as described in the aquarium monitor - controller thread. I've also copy & pasted a pic of the raw voltage (volt.A) from the owfs web server running on the NSLU2.

If anyone ever builds one to use with a DS2450 like this, the basic calculation is (Raw Voltage/0.48859)+1.88 = pH units. So for the raw voltage in the pic of 2.11386 that equals a pH of 6.20 (rounded to 2 decimal places)

I'm happy with the result :thumb

Bad Inferno
Sun Aug 12, 2007, 08:15 AM
Have you seen the cheap pH meters on ebay ? take a look they seem OK....I was thinking if you could get to the back of the seven segment displays we maybe able to read off the value displayed as digital inputs and decode the value in a PIC ?

DIY
Sun Aug 12, 2007, 09:22 AM
Anything's possible :wink:

To decode the seven segment display might use up a lot of I/O pins though. There's a lot of different cheap meters on ebay atm not just Ph so it is tempting to try a couple of them.

Bad Inferno
Sun Aug 12, 2007, 09:36 AM
i was thinking you could multiplex each of the 7 segment displays and just use external cmos ? switches to select either digit 1 / 2 or 3...as my pH provides a 0-5VDC output I'm OK however of others this could be possible without having to really build too much. I just got one of those "black" pH probes off ebay ($15.00) ..it took a week in the tank and it has settled in now. Don't really like the fact I cannot see the reference KCL solution in the probe. I still think I like the "green" tube style probes selling on ebay. I also found that the fluval pipe fitting with the two suction cups (it looks like a plastic device that the heater normally get attached with) is just the correct size to fit the probe into. So you attach this inside the tank and the probe just slips.

ILLUSN
Sun Aug 12, 2007, 09:37 AM
careful with the cheap meters on ebay, i had an orp meter that said my redox varied from 260-1999mv over a 2 day span (it also said the tap water was -160mv on day 3 :wink:

C4Vette
Sat Sep 08, 2007, 08:25 PM
Update:

I've spent this evening creating a pcb board layout in cadsoft's eagle (it's free!), the main criteria was it should fit inside the 100x50x25mm diecast enclosure I got today.

Pic's are of the actual board layout and a printed copy of the layout sitting near the enclosure after i checked the dimensions.

Very well done!
This is about where I am now with my 1-wire project. The Linux-box with 1-wire hub and owfs is up and running with a nice website. The next step is pH. Already have the probe and like your design. Would you mind sharing the project-file for cadsoft? I'm thinking about a change for the power and would like it to run from single +5v and let the board invert it with a ICL7660CPA to prevent the need of an extra powersupply.
And can you please eleborate at the calibration procedure?

DIY
Sat Sep 08, 2007, 11:59 PM
I'm thinking about a change for the power and would like it to run from single +5v and let the board invert it with a ICL7660CPA to prevent the need of an extra powersupply.

Have a good look at my circuit above that is exactly what I have done, no change required.


can you please eleborate at the calibration procedure?

R5 is to set the offset of the input op-amp, so is a one-time adjustment at completion. short out the input and adjust R5 so that the a mulitmeter on pin6 of the first op-amp (ca3140) shows 0v.

the rest is standard pH calibration routine, place pH probe in ph 7.0 solution and adjust R10 so the output is 2.5v, then pH probe in pH 4 or 10 and adjust R4 to the slope required, for me it's 1.04v@pH4 or 3.96v@pH10.

Bad Inferno
Sun Sep 09, 2007, 01:06 AM
Welcome C4Vette to the world of Discus !

Cheers rob

Bald_noggin
Sun Sep 09, 2007, 01:40 AM
Hmmmm, C4Vette something I like about that name! Welcome!

C4Vette
Sun Sep 09, 2007, 02:40 PM
Hmmmm, C4Vette something I like about that name! Welcome!

The 'nick' is from a former hobby <sniff, snotter>. The 1992 Corvette is long gone but the memories linger.



Have a good look at my circuit above that is exactly what I have done, no change required.

Ahh, it must have been too late for me :oops: This mix-up happened because I was comparing several projects. What I meant was that I want to integrate the DS2450 onto the PCB. Still any change you are going to 'lent' me the design?
Thanks for the extra explanation for the calibration. Just ordered some components to build this too. Now I have to find someone who can make the PCB. The soldering and software-part I can do myself.

Ed

DIY
Mon Sep 10, 2007, 10:51 AM
What I meant was that I want to integrate the DS2450 onto the PCB. Still any change you are going to 'lent' me the design?Ed

Pm me your email and I will send the eagle files to you :wink:

Warning on using the ds2450, I found it is a very noisy ADC. Bad Inferno also noticed problems with the ds2450. Better to use one of the battery monitoring one wire chips ds2438, ds2760 etc as they have a higher resolution ADC function.
I tried a ds2760 and it was miles better than the dodgy ds2450 which is only a true 8bit adc. The advantage of the ds2450 is that it has 4 inputs, if you are going to integrate into the pH amp the extra inputs will be wasted anyway.

C4Vette
Sun Oct 07, 2007, 06:39 PM
R5 is to set the offset of the input op-amp, so is a one-time adjustment at completion. short out the input and adjust R5 so that the a mulitmeter on pin6 of the first op-amp (ca3140) shows 0v.

the rest is standard pH calibration routine, place pH probe in ph 7.0 solution and adjust R10 so the output is 2.5v, then pH probe in pH 4 or 10 and adjust R4 to the slope required, for me it's 1.04v@pH4 or 3.96v@pH10.

Ok, I build it and seems to work fine.
Didnt't use the pcb (yet) but used a pre-drilled board. This way I could make it smaller so it fits inside de router I'm using as Linux-system.
The voltage outputs are extremely stable and the calibratation is very accurate.
One question before I can go on logging data:
Why a slope of 1.04 and not exactly 1.0 ?
It would make calculations more understandable. The slope, being the difference between the pH-4 and pH-7, at 1 volt it makes 0.5 volt per pH-step.

ph7 = voltage with ph7 calibration fluid (currently 2.5)
ph4 = voltage with ph4 calibration fluid (currently 1.0)

slope = (ph7 - ph4) / 3
pH = 7 + ((voltage - ph7) / slope)

DIY
Thu Nov 08, 2007, 02:53 AM
Only just saw your question, sorry for the delay :shock:

Yes a slope of 1 makes it easy for manual calculation, a slope of 1.04 was purely for the PIC I was using.

I calculated using a slope of 1.04 with my PIC, due to the way a PIC returns a number from 1 to 1024 based on 1024 steps from 0v to 5v meant the calculation was as simpe as adding 188 to get the result.

R1b4z01d
Thu Mar 27, 2008, 08:02 PM
Anyone have a part list?

C4Vette
Thu Mar 27, 2008, 08:35 PM
Anyone have a part list?

There are not that many components in the schema. Just follow the numbers and write them down; takes about three minutes :)

Mine is still working fine 8-)

Bald_noggin
Thu Mar 27, 2008, 09:23 PM
Hi C4Vette!

Do you still have the EAGLE files for the PCB. I'm interested in building one but I've also had a few queries about it too.

Thanks!

Col.

Bad Inferno
Fri Mar 28, 2008, 12:21 AM
I had spoken off-list to DIYJunkie about 1wire integration. The amp really needs to give 0-5VDC for a 4-8ph span. The 1wire AI only has 8 bit resolution and to get a 0.02 ph reading we will need to increase the gain. I suggest someone tries to change the gain so that the units range is 4-8 ph. This will enable us to still use 4 & 7 ph buffers for calibration and be suitable for 1wire.

what do you think

Gilles
Fri Mar 28, 2008, 11:51 AM
Good idea, problem is that here in HOlland, we really need to have 3-9 range, since my PH is 8.2 when my CO2 is empty ;)

C4Vette
Fri Mar 28, 2008, 12:32 PM
Hi C4Vette!

Do you still have the EAGLE files for the PCB. I'm interested in building one but I've also had a few queries about it too.

Thanks!

Col.

pm your email-address and I'll sent them to you.
I didn't use them because it would have costed me to much time to learn the program and edit the pcb to my liking. I think the pcb is too large and does not include the 1wire hardware. Also would it be nice to use smd-technologie to reduce the size. I succeeded to fit the hardware in my router (running OpenWrt) with the bnc-connector protruding near the utp-connectors.

Ed

Bald_noggin
Fri Mar 28, 2008, 10:42 PM
I succeeded to fit the hardware in my router (running OpenWrt) with the bnc-connector protruding near the utp-connectors.


:D Nice one!

Bald_noggin
Mon Mar 31, 2008, 09:12 PM
:D Thanks for that file C4Vette! :D

DIY
Fri Apr 04, 2008, 03:50 AM
Been offline for a while with work commitments etc, anyway I've had a few question relating to changing the PH range, gain etc.

I figure the easiest way is to explain the circuit a bit, and then if you need to change the gain (PH range) of my circuit you can work it out yourself.

***WARNING DIS-JOINTED MATHS AND DEDUCTIONS FOLLOW, CONTINUE AT YOUR PERIL :lol: :lol: :lol: ***

ph probe basics: (calibration is to correct individual probe variances, and drift over time)
pH7.0 = 0v output
For every 1.0 pH change, the probe outputs -59mv (-0.059v)
so at ph 4.0 the output = 177mv (0.177v)
and at ph10.0 the output is -177mv (-0.177v)

my posted circuit has 2 op-amps, looking at the circuit the left op-amp is connected to the probe and amplifies the voltage (gain).

The output voltage for the first op-amp is calcluated using the resistors R3 & (R2+R4) using the basic op-amp formula:
Voutput=Vinput*(((R2+R4)/R3)+1)
or put another way the gain = (((R2+R4)/R3)+1).

If we put the values of my posted circuit in, and assume R4 is adjusted to a value of 17.6k then (((220,000 + 17,600)/33,000)+1) = 8.2

What you can see from that is the 100k pot I put in allows for a large gain adjustment, in fact the 2 endpoints of the pot are obviously 0 and 100k. if we calculate both of those...

(((220,000 + 0)/33,000)+1) = 7.6
(((220,000 + 100,000)/33,000)+1) = 10.7

You can substitute whatever values you need to to get the gain you are after, I recommend leaving R3 at 33K and changing R2 and the pot to your requirements.

The second op-amp adds the offset voltage and inverts the input voltage, in my circuit this is effectively the voltage of pH7.0. I prefer having the voltage at pH7.0 to be the midpoint of the A/D range, My reasoning is you can use either pH4.0 or pH10.0 calibration fluid, and in fact use both. In any case it's not necessary.

Since I always intended to use it for 0-5V devices (both PIC's and the DS2450 take a 0-5V range) my circuit has an offset of 2.5V. At pH7.0 the probe has a 0V ouptut, so pH7.0 becomes 2.5V no matter what the gain of the first op-amp is, The pot R10 allows you to adjust (calibrate) this.

To change the offset voltage at pH 7.0, you can change R9 & R12. The 2.5V reference voltage from the LM385 is voltage divided by R9,R10&R12 (R10 allows for calibration). My voltage divider is a simple 1/2 voltage with the vaules in my posted circuit = 1.25V. This is fed into the non-inverting input of the second op-amp which has a gain of 2 so finishes back at 2.5v, this sounds counter-intuitive but it allows for calibration using R10 at pH7.0 from a stable voltage reference (LM385). I found other designs that voltage divided the supply V+ were prone to drift and unstable pH readings due to the supply not being stable enough for the mV calibration required.

Now if you are planning to use a DS2450, this is pretty much useless above 8bit resolution, so there are only 256(8bit = 256) sampling points over the 0-5V range or 5V/256 = 0.0195V resolution.

No matter what you do, you need at least a range of 3pH units to allow for calibration (pH 7.0 & pH4.0, or pH7.0 & pH10.0). Op-Amp accuracy drops, as well as hitting limits when you get close to the voltage rails, so I strongly recommend keeping within 0.5v of each rail for your intended range, preferably within 1V.


Time for an example:

If your water ranges between pH 6.0 & pH 8.5, you will need to have a range of pH6.0 & pH10.0 at a minumum to allow for calibration. I recommend you keep pH6.0 above 0.5V and pH10.0 below 4.5V for accuracy, even better would be to keep withing 1V of the rail so you want pH6.0 = 1V and pH10.0=4V.

So what gain do you need?:

Ph10.0-pH6.0= 4 pH units over 3V, the probe puts out 0.236V over this pH range (see above), and you need 3V

So 3.0V/0.236V = 12.7

If you leave R3 at 33K, and change R2 to 360K you can calculate the adjustment range using R4 at both the 0k and 100K points

(((360,000 + 0)/33,000)+1) = 11.9
(((360,000 + 100,000)/33,000)+1) = 13.9

You also need to change the offset so pH7.0 = 1.75V (based on 4pH units / 3 volts = 0.75V per pH, and pH6.0=1.0V)

To do this you can change R9 to 100k, which will divide the reference voltage from the LM385 down to approx 0.89v and the gain of the second op-amp will bring this up to 1.78V, R10 will have more than sufficient adjustment to calibrate pH7.0 to 1.75V

What resolution will this provide if you use a DS2450?

DS2450 resolution is 0.0195V from above, and our example provides 0.75v per pH unit so 0.75/0.0195 = 38.46 sample points per pH or to epress this in pH units it would be 1/38.46 or .026pH, remember this is resolution NOT accuracy, I have no idea how accurate my circuit is.... :shock:

Gilles
Fri Apr 04, 2008, 05:50 AM
Wow DIY this is absolutely perfect information! I'll think i have to read this twice! Do you have a same solution for the conductivity electrode? (see my post in BadInferno's topic)

Bad Inferno
Fri Apr 04, 2008, 10:11 AM
welcome back junkie ! work is no excuse for discus or DIYing

rob

DIY
Fri Apr 04, 2008, 12:17 PM
Wow DIY this is absolutely perfect information! I'll think i have to read this twice! Do you have a same solution for the conductivity electrode? (see my post in BadInferno's topic)

Thaks Gilles, I used you as the example so hopefully it helps! and I reckon it'll take more than twice to understand my rambling. My excuse is I typed it in a hurry :oops: :oops:

I haven't tried building a conductivity circuit myself and don't really have a need to but I've pm'd you a link to someone elses conductivity circuit project.


welcome back junkie ! work is no excuse for discus or DIYing

rob

Thanks Rob, and yeah - you're right of course :lol:

C4Vette
Fri Apr 04, 2008, 12:37 PM
I haven't tried building a conductivity circuit myself and don't really have a need to but I've pm'd you a link to someone elses conductivity circuit project.


Can you please post or pm that link?
I've been looking for schematics but could not find any.

thanks, Ed

DIY
Fri Apr 04, 2008, 12:51 PM
Hopefully I'm not doing anything wrong by posting here :roll:

http://www.octiva.net/projects/ppm/

Better yet, looks like he keeps his wiki more up to date

http://blea.ch/wiki/index.php/PPM_Meter

Bad Inferno
Fri Apr 04, 2008, 08:22 PM
great link to conductivity pages....its the DIY probes that is the most difficult to get reliable continuous operation. If it drifts and probes need cleaning not worth the trouble. My conductivity changes very little and only really good if you every dose meds/salt treatment or maybe ferts as you can monitor the effcets and see how long it takes to come back to "normal". Although thinking about it, living in melbourne we do not have to use RO water, probably one ofthe better water sources in the world thus conductivity from the tap is about 200 micro siemens.

jl7854
Fri Dec 12, 2008, 02:32 AM
Hi all,

This looks like a great project to try. Does anyone still have the Eagle files for this.

Thanks
Jon

piperpilot
Wed Jan 21, 2009, 02:50 AM
DIY, You still around to answer a few questions. I have tried to duplicate your effort here without success. Here is what I am seeing:

- First stage op-amp working great. Measuring output correctly at pin 6 for both PH4 and PH10, 1.45V & -.145V

- Second Stage Op-Amp not working as expected for PH10. PH 4 outputs correctly.

First off...I am noticing only -4.68V coming off the V- of the ICL7660...in researching this chip...it seems like a voltage drop based on load of the circuit is expected. Is this -4.68V OK for the negative rail on the OP-Amp? One change I did make to your circuit is I switched C4 & C5 to 10uF as I am trying to convert to SMT components. Could this be causing this problem?

Since the PH4 seems to work correctly, I am starting to believe it is a problem with the negative input to the 2nd op-amp that is causing the problem but I'm not sure. If I probe at Pin2 of the 2nd Op-Amp I am getting .756V when the other side of R1 is -1.45ish.

Any suggestions? I am gonna try to find some SMT 22uF caps to exactly match your schematic but that is gonna take a few days to get here. Looking for a quick answer of what I might be doing wrong.

BTW...model numbers of the chips I am using if it matters:

Intersil CA3140EZ
Intersil ICL7660CPA

Thanks,
PiperPilot

ChrisG_UK
Sat Jul 18, 2009, 10:01 AM
Does anyone have a copy of DIY's schematic? It doesn't seem to be attached here. Where has it gone? I would love to have a go at this. Many thanks.

ChrisG_UK
Sat Jul 18, 2009, 10:04 AM
Ok, scrub that request. It seems the images only appear when you are logged in. My apologies!

Bad Inferno
Fri Jul 31, 2009, 11:58 AM
Just built this cct, works great thanks DIY. I plan on doing an ORP version.

Although did fall into some traps, all self inflicted of course!

Some tips
1. Make sure the LM385BZ2.5 provides the 2.5V ref. (The device I recieved, although ordered correctly, was the standard version and not the special BZ2.5V fixed output). You can use the std version LM385 just need a couple of resistors to double its 1.24V output.

2. The two amps are NOT the same. The first stage CA3140 is high impedance with a CA3130 as the final stage.

3. Play with the (probe) input capacitor so as to match your probe. Having this cap too high will provide a very slow response. Too low and the output will fluctuate.

I made mine on a strip board, sometime I'll get around to posting the layout.

rob

piperpilot
Fri Jul 31, 2009, 12:17 PM
Thanks for the Post Rob as well as the PM. You are abosolultely correct, I have been racking my brain over this for months and it turns out my attention to detail in reading the schematic was not there. I was using the 3140 for both stages. I went as far as replacing the 2nd stage op-amp with a traditional TL081 but thats when my voltage problems came in.

I'll have to rebuild my original design using the 3130 and see if all is well.

BTW...what model probe and cap value did you use? I've been working with the Milwaukee Instruments MA911B/2 model. I too am looking to build an ORP version once I get this one stable. For that, I have an MA912B/2 sitting here. The ORP version should be really simple with just a buffer op amp in the first stage and nothing more really.

PiperPilot

Bad Inferno
Sat Aug 01, 2009, 12:14 AM
DIYJunkie sent me the two op amp spec sheets. I think the CA3140 was used as it can swing both - and + which is how a pH probes output works. However the CA3140 has a max output of +3V however can swing down to -VE. The CA3130 is really designed for a positive output and can nearly output up to the +VE supply voltage however clamps at -1.5V in the neg direction. Thus the two different types of AMP's, I think the input impedance in both amps is similar.

Now for ORP beacuase the probe only puts out 0-500mv we should be able to use the CA3130 for both stages. However we may need to offsat the output stage by -1V. Thus 0-4V output equals 100 - 500 mv.

Bad Inferno
Sat Aug 01, 2009, 05:56 AM
http://img.photobucket.com/albums/v319/rjconway/PHAmpr0futurlecboard.jpg
http://img.photobucket.com/albums/v319/rjconway/phamp.jpg

odium
Wed Nov 04, 2009, 10:28 PM
What probe are you using to hook to your circuit?

Bad Inferno
Thu Nov 05, 2009, 08:54 AM
Milwalkie