Pages: 1 [2]   Go Down
Author Topic: Using an Op-amp to collect microvoltages  (Read 1826 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
rail-to-rail output swing

R2R doesn't mean the opamp can swing to the rails. Just that it will swing sufficiently close to the rails. How close it can swing to the rails is specified in the datasheet.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys!

I have recently tested out my device.

My pH probe is getting readings of 0.39V in a 1M Hydrochloric Acid. However, When I move it to an alkali, it reads nothing.
I changed the ground and signal on the pH probe and it read for the alkali around 0.5V.
Any ideas on how to get this circuit to read negative voltages? Is it a bug in my code?

Code:
*     ---------------------------------------------------------
 *     |  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
           //converting from 10 mv per degree wit 500 mV offset
                                                  //to degrees ((volatge - 500mV) times 100)
 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) * .004882814); //converting from a 0 to 1023 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}

Also, is there a way to make it more sensitive to read up from 0 to 5V ?

Thanks!
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

To increase the sensitivity, use a couple of resistors to make the op amp provide gain, See the section "Non inverting amplifier" in http://en.wikipedia.org/wiki/Operational_amplifier_applications.

To read negative voltages, if you want to keep the probe grounded then you'll need to feed the op amp from a dual supply, e.g. +5V and -5V. You'll also need to shift the level to bring it into the 0 to 5V range. You can use the second op amp in the package to do that.

If you have a spare Arduino PWM pin, you can generate a low-current -3v supply from it using 2 diodes, 2 capacitors and a resistor. That should be enough for the op-amp.
Logged

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.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 604
Posts: 33439
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Any ideas on how to get this circuit to read negative voltages? Is it a bug in my code?
There is no bug in the code. You can't read negitave voltages on the arduino so you have to alter the voltages to make them all fall in the range of zero to five volts as seen by the arduino like dc42 said.
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2895
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What some people do to read negative voltages in a +5V only system is to use
a pullup-R to 5V on the measuring-node, and apply the negative voltage through
a series-R,


Vin -- SeriesR -- + -- pullupR -- +5V
                  |
                to ADC


To do this successfully, you would have to know the output-resistance [impedance] of
the probe. It would probably also be best to use this ckt with the opAmp in there
before the ADC.
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

One way to read negative voltages is to introduce a positive offset.

To increase sensitivity, you can use programmable gain amplifiers (like ad603 or regulator opamp + digital pot, or even a resistor network + mcu pins) where you can alter gains based on the input voltage.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

To expand on my reply #17, here is an outline schematic. The first op amp provides a high input resistance for the probe and amplifies the signal by a factor of 6. The following resistor network level shifts the signal but also attenuates it by a factor of 2/3. The second op amp amplifies it by a factor of 1.5 to restore the signal level and use the full range of the ADC.


* Scan 114.JPG (103.16 KB, 1653x1165 - viewed 26 times.)
Logged

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.

Pages: 1 [2]   Go Up
Jump to: