pH Meter to Arduino to LCD help please.

HI,

Can anyone give me some help on how would i be able to read my sensor signal (positive to negative voltage) or program my arduino to directly read the values I get from my sensor? How can I input my sensor signal into the arduino to display my results? I plugged my OP-AMP Output directly to the "Analog IN 1" and I tried running it to hyperterminal to see does it work and I have failed as it does not work. I am fairly new at this some guidance would be great.
Thanks.

So i made my pH meter sensor and calculated everything. (I got the reading from a voltmeter)
In pH 10 it gives a value of -144.72mV(-0.144.72mV)
In pH 7 it gives a value of 12.48mV(0.01248V)
in pH 4 it gives a value of 169.48mV(0.169V)

From 0 to 7 pH = 52.4mV
I am using pH 7 as a reference and every 52.4mV it increases by 1 pH.
I want to input pH = ((sensorValue / 52.4mV)-7) into the arduino program.

From 7 to 14 pH = -64.16mV
I want to input pH = ((sensorValue / 64.16mV)-7) into the arduino program.

//Program I tried and apparantly you cant do this directly.
#include <LiquidCrystal.h>

LiquidCrystal lcd(12,11,5,4,3,2);

int sensorPin = 1;

void setup()
{
Serial.begin(9600);
lcd.begin(16,2);
lcd.print ("pH Meter");
}

void loop()
{
Serial.println(analogRead(sensorPin));
delay (2000);
lcd.setCursor(0,1);
lcd.print("pH Value:");
lcd.print(analogRead(sensorPin));
}

How have you wired this up. The arduino can't read negitave voltages. Where is your ground connection between the arduino and the op amp?
What do you actually see, it faild is not good enough.

Hi Man.

Im working with pH sensors too :D. My sensors are ISFET, what are yours ?. Due to negative voltages cannot be read, im additioning a DC level with op amps. I have good readings with that. But now i have one problem... Arduino is reading weird things from the op amp :/, i already have the ground connected.

i already have the ground connected.

Yes but how is the rest of it connected up.
If you want specific advice about a circuit you have to post the schematic of what you have made.

Arduino is reading weird things from the op amp

No the arduino is reading exactly the right thing, if it appears to you to be weird then it probably is not a good circuit you have made. This is either the design or the implementation, without a schematic I can't tell you which.

Hello Mike.

Thank you for your help. A said that arduino is reading weird things because i measured the output of the opamp with a multimeter and i get.. 200mV. When i put this output into the A0 of my Arduino, i get big diferents values oscillating The Schematic Image is attached. I have a sensor representated by the transistor, then a conditioning circuitry. The output comes from an opamp and all devices has the same GND with the sources. What i am doing is to wire the output to the A0 input pin and the Gnd of the circuit to the GND pin of my Arduino.I am wondering if the problem comes from impedances coupling or something else that i cant see :(.

Thank you again.
Dgarizado.

Schematic.png

Well the schematic is a bit blurred but I can see you are feeding it with a split supply. Therefore there is nothing to prevent the output feeding into the arduino going negative and damaging the analogue input.
Also the schematic does not show what input on the arduino you are connecting it to.

When i put this output into the A0 of my Arduino,

Your software as posted initially is reading analogue input 1, that is marked A1 you might not be reading the correct pin.

Finally the 741 is not a very good op amp by today,s standard. It struggles to work off +/- 5V and you will not get anywhere close to rail to rail output from it.

Thank you mike.

Sorry for the blurry image ;(. I configured the software for read the analog A0, the output im reading is the last amplifier (from Left to Rigth), that phase agregates a DC necesary for send the signal away of negatives values. I measured other voltages sucesfully with the arduino(For examplo the sources voltages), but reading the output of the opamp is a problem :(. What do you think i can do?, can i use other device that "regulates" the voltage of the arduino? may i "couple the impedances" ?. What do you think? :slight_smile: .

Thank you.

Dgarizado.

It could be you have some oscillation on the signal which will make the multimeter reading wrong. Have you looked at it on a scope?

Hello mike.

Thank you again :D. Yes, the problem is an oscilation, problably an AC 60 Hz noise comming from the power supllies, maybe. I did this for now, i took a number of measurrements, every 10 miliseconds, then i calculated the mean of these values, the result is the value that my multimeter is matching. Now i have the value in the Arduino :D.

Now i have one question about interrupts, can i do that in this post ?, if yes this is my dude:

I now how to use the attach interrupt function and some limitations that we have in the function called by the interrupt. My dude is ... i will post a little code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int pin = 13;
volatile int estado = LOW;
void setup()
{
  pinMode(pin, OUTPUT);
  pinMode(2,INPUT);
   lcd.begin(16, 2);
  digitalWrite(2,HIGH);//pullup
  attachInterrupt(0, myfunc, LOW);
  Serial.begin(9600); 
}

void loop()
{
  estado = LOW;
  digitalWrite(pin, estado);
  
  delay(100); 
}

void myfunc()
{
  estado = HIGH;
  digitalWrite(pin, estado);
lcd.setCursor(1,0);
  lcd.print("INTERR");
 digitalWrite(pin,estado);
}

I dont know how is the life cycle of the interrput... i mean, i am wondering if the function called by the interrupt acts as a loop function while the "interrupt pin" is low (for my example) or the things in the "interrupt function"(myfunc in my example) are done just one time and the processor "waits" for the "interrupt pin" go to HIGH.

I would fix the op amp properly, an unstable circuit is very bad. Start of by adding decoupling capacitors as close to the op amp as you can get it.

If you trigger an upinterrupt off a level and the level is still low when the interrupt service routine (ISR) finishes then it will be called again. Normally you use the rising or falling edge to trigger the interrupt.

@FreshlySqueezed

So i made my pH meter sensor and calculated everything. (I got the reading from a voltmeter)
In pH 10 it gives a value of -144.72mV(-0.144.72mV)
In pH 7 it gives a value of 12.48mV(0.01248V)
in pH 4 it gives a value of 169.48mV(0.169V)

I read the tread and the post. You need to re-design the op-amp circuit.

An analog pin received a min voltage of 0 V to max voltage of 5 V. So you need to build a circuit using op-amp to "convert" the input voltage to a proper output voltage.

Let see... let take the extreme values : lower point --> ph 10 = -144.72 mV ---> 0 V
higher point --> ph 1 = 326.68 mV --- > 5 V

Assuming the values ( ph ) are linear, so use the linear formula ==> y = m * x + b

x is the input voltage, y is the output voltage m is a slope. And let figure out a formula using op-amps. Op-amps are Analog Computer. It can multiply a value, add and substract.

So the linear formula is : y = ( 10.60670344 * x ) + 1.53500212

So V out = 10.0607 X V in + 1.535 V The 10.6067 is the Amplification factor.

hello, I am looking for ISFET based ph sensor online, it is not available in local market. please suggest me some sites.