Go Down

Topic: Using an Op-amp to collect microvoltages (Read 6758 times) previous topic - next topic

limjix

Hey guys,
I am doing a project where I obtain microvoltage readings from a pH probe and print them in the serial monitor.

Thing is I am stuck. I am basing my designs on http://www.66pacific.com/ph/simplest_ph.aspx
I am using a LMC662AIN. Datasheet found here http://www.farnell.com/datasheets/36804.pdf

I just can't seem to get a proper reading in the serial monitor.

Here is my idea:



I am basing my code on an ARDX project.
Here it is:
Code: [Select]
/*     ---------------------------------------------------------
*     |  Arduino Experimentation Kit Example Code             |
*     |  CIRC-10 .: Temperature :. (TMP36 Temperature Sensor) |
*     ---------------------------------------------------------
*   
*  A simple program to output the current temperature to the IDE's debug window
*
*  For more details on this circuit: http://tinyurl.com/c89tvd
*/

//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade
                        //(500 mV offset) to make negative temperatures an option

/*
* setup() - this function runs once when you turn your Arduino on
* We initialize the serial connection with the computer
*/
void setup()
{
  Serial.begin(9600);  //Start the serial connection with the copmuter
                       //to view the result open the serial monitor
                       //last button beneath the file bar (looks like a box with an antenae)
}

void loop()                     // run over and over again
{
float temperature = getVoltage(temperaturePin);  //getting the voltage reading from the temperature sensor
     
Serial.println(temperature);                     //printing the result
delay(1000);                                     //waiting a second
}

/*
* getVoltage() - returns the voltage on the analog input defined by
* pin
*/
float getVoltage(int pin){
return (analogRead(pin));
}


Here is the problem:
1. I get when there is no input(ie: the probe is not connected) the readings fluctuate from 0 then it goes until 1023. Which shouldn't be because nothing is connected. Then it just keeps reading 1023 for awhile then drops back down to 0. Fluctuates up and down.
2. I tried different configurations, but I can't seem to get a stable reading while connected to the pH probe. Theoretically, it should just fluctuate about a certain value right? Because there is no change to the condition of the pH probe.

Can someone please help? I am new to all this, and I am very keen on making my first project a success. Thanks!

Nantonos

#1
Nov 11, 2012, 06:40 am Last Edit: Nov 11, 2012, 06:45 am by Nantonos Reason: 1
Looks like a good choice of a rail to rail op-amp. But your feedback loop is screwy.

If you are running the op-amp as a unity gain buffer, output B would need to be connected to Inverting Input B. If you are using the op-amp to provide gain, (which seems more likely given the small levels of your input signal) you need a resistor between them; the value determines the gain. Also, the BNC connector has a signal and a ground. Is the BNC ground connected to your circuit ground?

You will probably need to have a separate 5V power supply. The Arduino one is full of digital noise. So disconect the lead to Arduino 5V and add 5V and GND from your regulated power supply. Keep the connection to Arduino GND however.

You may well find that an external ADC (such as an ADS1115) will give better results than the built-in one. Besides being lower noie and more linear, it also has a programmable gain amplifier and can oerate in differential mode. If your probe is giving signals which can swing negative as wel as positive (e.g if it outputs 0V and neutral pH) then you would want to use a diferential mode, with the second input referenced to Vcc/2 (use a couple of 1% low noise 5k resistors to make a voltage divider).

(These suggestions ae in order of priority, i.e. don't try any of the later ones unti you have sorted the first one out).

dc42

Your circuit looks OK to me, with inverting output B connected to output B (you can add gain later when you haver got it working). I suggest you add a 0.1uF decoupling capacitor between the op-amp V+ and V- pins.

With the ph probe disconnected, it is entirely normal to get random readings. The readings should become stable when you connect the probe. Do you have the outer connector of the BNC connector connected to ground, and the inner connector connected to the non-inverting input of the op-amp, without a lot of wire between them (a long wire here could pick up interference)?

One other possibility is that the op amp is oscillating due to the load being mostly capacitive. The datasheet warns about this. Try adding a 1K pullup or pulldown resistor at the op-amp output.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Grumpy_Mike

You also need to do something with the unused op-amp. You can not just leave the signals unconnected. Connect the output to the inverting input and connect the other input to ground.
You will need some gain in the other op-amp before you see any reading.

Docedison

The second amplifier could well be a gain block for the low level signals from the probe. Probably it will need to be. You should be able to get 1000 to 10000 voltage gains easily when driven by the low impedance of the buffer amp (the voltage follower) this means that very low resistance values can be used to keep the feedback resistor value lower (More sane as a 1M ohm input resistance would require a 10 M ohm feedback resistor for a gain of 10 and a gain to 100 could never be realized because the PCB leakage would exceed the feedback current available from a 100 M ohm resistor. There are several different things to be considered about using Op-Amps as dc gain blocks especially at the voltage and impedance (current available) from a PH Probe. I would make very very certain that the voltage for the op-Amp come from a clean well regulated source Switchers should drive linear regulators if switchers are the primary power source. The Power source must have a minimum of a 100 uF cap as well as a 1 uF and a .1uF and the .1uF cap should be right between the power pins of the Op-Amp. There are some very real possible issues here as the power source must have NO connection to GROUND whatsoever an isolated supply or batteries MUST be used if this device is intended to measure anything except a sample in an isolated ground container... like a test tube or beaker it WILL NOT FUNCTION AT ALL WELL if it's probe has any electrical connectivity to earth ground because any leakage current from the probe to ground will become a part of the measurement making returned information invalid... I spent several years designing soil conductivity moisture and Ph Meters remember Kirchhoff was there first and wrote the law about the sum of the currents.

Bob
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

dc42

Mike, according to the article the OP linked to, the probe output should be 59mV per ph unit, so he should be able to get readings for low ph values without amplification. On the other hand, the ph probe output is negative when the ph is higher than 7, so unless he adds an offset, he won't be able to measure high ph values.

Docedison, good point about either the measuring unit or the sample needing to be isolated from ground.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

dhenry

The original circuit is a follower (no gain) on dual rails. So it does not amplify the input signal. If the input signal is in the mv range, the output signal is in the mv range. For amplification of a small signal, it needs low offset voltage. It also requires the opamp to be unity gain stable.

Your set-up is not configured as the circuit you had quoted - no feedback look;

Your set-up is single rail - So it requires an opamp that can swing within mv of the ground  - check the datasheet for that.

You also want to make sure that your opamp is unity gain stable - check the datasheet for that.

I think that even if you fix the wiring, your circuit will not work, for swing, and for its high offset.

If you are looking for amplification, use dual rails.

If you are looking for impedance matching, 1) remember that your adc has very high input impedance (in many cases much higher than most opamp can offer), and 2) a jfet is a better choice for single rail applications.

pico

The op amp circuit you want for a pH probe actually involves three op amps, and is referred to an an instrumentation amplifier, or simply IA. Google it or check this out to have a read:

http://en.wikipedia.org/wiki/Instrumentation_amplifier
WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

limjix

#8
Nov 12, 2012, 03:05 am Last Edit: Nov 12, 2012, 03:09 am by limjix Reason: 1
Hey everyone!
Thanks for the suggestions, Ive tried most of it and I think I've got the solution already

Here is what I did,
This is most stable set up I have got so far.

One thing I did was connect the ground of the arduino to the BNC ground which happens to be the metal outer jacket of the BNC connector.
It seems by doing that, I got very consistent readings.

When the pH probe was still in its buffer solution of KCl, it read around 0.00 V for many readings but after awhile there is some fluctuation.
When I took the pH probe out of its buffer, the reading became like 0.08 +- 0.05 V
I will be testing this out in my school lab on Wednesday with acids and bases to calibrate it and find out whether it is accurate.

Any ideas on how to reduce the fluctuation even further and make it more accurate?

Also, I tried Mike's suggestion of connecting the Output A and Inverting Output A together and Non inverting output A with gnd.
My chip heated up for some reason. Any ideas ?

Another thing I did was to use a 9V battery supply for the power rail and it worked well. But when I changed it back to Arduino's 5V supply, I noticed the readings were more consistent.

Thanks guys!

MarkT


Your circuit looks OK to me, with inverting output B connected to output B (you can add gain later when you haver got it working). I suggest you add a 0.1uF decoupling capacitor between the op-amp V+ and V- pins.


No real need for high-speed decoupling (0.1uF ceramic) on a standard op-amp - these are slow devices compared to digital logic.  Something more like 100uF electrolytic or so somewhere close is fine to reduce noise levels on the supply (but check the manufacturers recommendations in the datasheet - they will have tested what works best)

[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

dc42



Your circuit looks OK to me, with inverting output B connected to output B (you can add gain later when you haver got it working). I suggest you add a 0.1uF decoupling capacitor between the op-amp V+ and V- pins.


No real need for high-speed decoupling (0.1uF ceramic) on a standard op-amp - these are slow devices compared to digital logic.  Something more like 100uF electrolytic or so somewhere close is fine to reduce noise levels on the supply (but check the manufacturers recommendations in the datasheet - they will have tested what works best)


They may be slow devices, but some types can be unstable without decoupling capacitors.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

dhenry

Opamps heat up for many reasons but typically due to overloading or oscillation. Oscillation can be caused by many reasons: poor decoupling, capacitive loads, parasitics, etc.

I would start with decoupling: putting a small ceramic (11n - 110n for example) between Vcc/gnd pins. I would also put a 1k resistor on the opamp's output line. I would put a large resistor (100k - 10k, depending on your sensor) from the non-inverting input to the ground to provide a current path for the input stage, in case your sensor is ac-coupled. If you do that, also put a similarly valued resistor between the output and the inverting input.

Quote
connecting the Output A and Inverting Output A together and Non inverting output A with gnd.
My chip heated up for some reason. Any ideas ?


That's a bad practice. If you want to terminate an opamp, terminate it with a resistor,  like 10k. Tying the output to gnd/vcc overloads the opamp.

oric_dan

Quote
Quote
connecting the Output A and Inverting Output A together and Non inverting output A with gnd.
My chip heated up for some reason. Any ideas ?

That's a bad practice. If you want to terminate an opamp, terminate it with a resistor,  like 10k. Tying the output to gnd/vcc overloads the opamp.


He apparently means Inverting 'Input' A, and indicates he's got it wired as a folllower-amp with the
noninverting input tied to gnd. That's ok.

OP needs to get his terminology STRAIGHTENED OUT!

The most common cause for those parts to overheat is being plugged in backwards.


Grumpy_Mike

As well as what  oric_dan(333) said:-

Quote
connecting the Output A and Inverting Output A together and Non inverting output A with gnd.
My chip heated up for some reason. Any ideas ?

Instead of connecting the input to ground, connect it to a mid point formed by two 1K resistors between rail and ground. That way the output will sit in the middle. It looks like the amp is not as rail to rail as you might have hoped.

Nantonos


It looks like the amp is not as rail to rail as you might have hoped.


First para of data sheet:

Quote
The LMC662 CMOS Dual operational amplifier is ideal for
operation from a single supply. It operates from +5V to +15V
and features rail-to-rail output swing in addition to an input
common-mode range that includes ground.

Go Up