Shop OBEX P1 Docs P2 Docs Learn Events
pH Sensor Interface — Parallax Forums

pH Sensor Interface

atrobinsatrobins Posts: 4
edited 2010-12-24 12:25 in Accessories
I have been working on a Saltwater Fish Tank controller for several months now. My latest addition to the project is a pH Sensor. I have built the pH circuit below.

http://blea.ch/wiki/images/2/24/PH-sch.jpg

Everything seems to work properly with the circuit as when i check the output with a volt meter I get the proper voltage between 0 and 5 volts for the pH of the tested solution. My plan was to use a PCF8591 A/D Converter to convert and send this signal to a BS2p using I2C communication as this seems to be a well documented chip and sample code was available. This is where my problem comes in. I am using the sample code avalable in the BS2p Plus Pack Kit.

www.parallax.com/dl/docs/cols/nv/vol3/col/nv79.pdf

The results I am getting are very unstable. For example with the voltmeter I read a constant 2.88V. The debug screen from the sample code produces a voltage ranging from 2.5V to 3.1V that changes every time the code reads from the A/D Converter. I am stuck! I have tried everything I can think of from loose connections to common grounds to tinkering with the code. When I bought the PCF8591 Chip I got two. I have tryed both with the same results. Does anyone have any sugestions as to where I may be missing something. Thanks in advance for any help.

Comments

  • RickBRickB Posts: 395
    edited 2010-12-23 08:16
    You might have a very noisy signal that the voltmeter averages out due to its slow response. Disconnect the adc input from the opamp output and wire it to a pot as shown in the diagram on page 60 of the article (page 4 of the pdf). If the readings are stable then you have a problem with the sensor interface. Is this battery powered or line powered? You might have 60 or 120 Hz on your signal. You could have ground loop problems. An accurate wiring diagram of your setup would be very helpful. Do you have a scope?

    Rick
  • ercoerco Posts: 20,257
    edited 2010-12-23 09:05
    Yes, it does sound like a noisy signal that might require you to add a filter capacitor to make a useable signal.

    Or, as Will Smith might say in Bad Boys 3, "POP A CAP IN ITS RAGGEDY Smile!"

    Sorry, I couldn't resist.
  • FranklinFranklin Posts: 4,747
    edited 2010-12-23 11:20
    Also remember i2c was designed for VERY short distance communication originally to other devices on the same board.
  • atrobinsatrobins Posts: 4
    edited 2010-12-23 13:19
    Thanks again for the replys. RickB I started with your sugestion and taking readings off of a pot are stable. The pH circuit is powered off a 24V AC/DC converter. I do not have a scope to check the circuit. Below is my actual build diagram.

    scan0003.jpg


    The filter cap erco recomended may be an option but I'm not sure what size and where to add it on the circuit.

    Thanks agan and let me know what you think.
    1024 x 774 - 47K
  • RickBRickB Posts: 395
    edited 2010-12-23 17:16
    You have completely misunderstood what your power supply should look like. It is so wrong I don't even know where to start. You must have + and - voltages with respect to ground. If your power supply actually is wired according to your diagram it should be on fire. STOP and educate yourself about bi-polar power supplies before you go any further.
  • ercoerco Posts: 20,257
    edited 2010-12-23 18:38
    Merry Christmas and Happy Holidays, RickB!
  • RickBRickB Posts: 395
    edited 2010-12-23 20:02
    If you don't have any means to construct an ac powered bi-polar supply, use two 9 volt batteries. This will eliminate any ac ripple problems and provide the plus and minus voltages you need. For the time being don't worry about the lack of regulation or current drain. They will will work well enough to provide meaningful results until you build a real power supply. This is not the only way to solve the problem, but it will get the show on the road. OK, your turn.
  • atrobinsatrobins Posts: 4
    edited 2010-12-24 05:32
    I will try batteries as up until now the only other source I have tried is wiring two 12 volt AC/DC converters together to produce the +- voltages and I get the same results from the stamp. I know the power supply in my diagram looks non traditional but it works. Since I have a 24v source the 12v regulators acts as a voltage spliter. Because it will output 12v, if you make the output the reference to the + and - inputs on a 24v power supply it produces +12v and -12v with reference to the output. I got the idea when I wired up the two 12v converters as this is virtually the same thing. I do realize that this will only work correctly to power the opamp if the source is 24v. Any other thoughts on the cap filter?
  • atrobinsatrobins Posts: 4
    edited 2010-12-24 10:33
    I tried hooking up the 2 9v batteries. The fluctuation in the readings is still there although not quite as significant. They range from 1.9 to 1.7 volts. Anyone have any other suggestions? Thanks again.
  • RickBRickB Posts: 395
    edited 2010-12-24 12:25
    Your 7812 is NOT regulating both sides of the supply. If you measure the voltage with a low ac range of your voltmeter, you will get a reading depending on how well filtered the 24 volt supply is. (is it regulated inside?).The fact that adc output improved when using batteries indicates this. Since you don't have a scope, use the voltmeter on a low ac range to measure the output of the second opamp. If it is clean, you will see nearly 0 volts.

    Look at these links to see what others have done. One of them is a single supply version.

    http://www.66pacific.com/ph/phschematic.htm

    http://www.electro-tech-online.com/attachments/electronic-projects/21692d1218729019-ph-amplifier-micro-ph_amplifier.pdf

    Notice the bypass caps at the opamp power supply pins, the filtering at probe input, and the much larger cap in the feedback path of the second opamp. The ph probe output impedance and the opamp input impedance are very high and very susceptible to noise pickup. Don't do this on a breadboard and expect it to work well. What form is this circuit in?

    For now, stay with the batteries until other problems are eliminated.

    Rick
Sign In or Register to comment.