arduino ph ,orp atlas

I wrote a piece of code for these stamps (pH and ORP). They work well. Give it a try and if you get it better publish here.
I have the two stumps connected with a Duemilanove for the last two months and it performs well. It is a different approach, reading the value over the serial port (digital signal) rather than analog.

cheers,
MaLi

<code>

#include NewSoftSerial.h>

NewSoftSerial LCD(2, 3); // LCD
NewSoftSerial ORP(4, 5); // ORP stamp
NewSoftSerial pH(6, 7);

int ORP_val = 0;
float pH_val = 0.0;

void setup()
{
Serial.begin(9600);
LCD.begin(9600); // LCD
ORP.begin(9600); // ORP stamp
pH.begin(9600); // pH stamp

LCD.print("?f");
LCD.print("?c0");

}

void loop(void)
{

char inData_ORP[12];
char string_ORP[8];

ORP.println("read()c");
delay(750);


if (ORP.available() > 0)
{
for (int i=0;i<13;i++) {
inData_ORP = char(ORP.read());
}
}
sscanf(inData_ORP, "%*s %s ", string_ORP);
ORP.flush();
if (atoi(string_ORP) != 0) {
ORP_val = atoi(string_ORP);
}

Serial.print("Sensor output: [");
Serial.print(inData_ORP);
Serial.println("]");
LCD.print("?y2");
LCD.print("?x00");
LCD.print("ORP value: ");
LCD.println(ORP_val);

char inData_pH[12];
char string_pH[8];

pH.println("read(26.5)c");
delay(750);

if (pH.available() > 0)
{
for (int i=0;i<13;i++) {
inData_pH = char(pH.read());
}
}
sscanf(inData_pH, "%*3c%s ", string_pH);
pH.flush();
if (atoi(string_pH) != 0) {
pH_val = atof(string_pH);
}

Serial.print("Sensor output: [");
Serial.print(inData_pH);
Serial.println("]");
LCD.print("?y0");
LCD.print("?x00");
LCD.print("pH value: ");
LCD.println(pH_val);

}

</code>
 
Last edited:
Hey where can i find one of these stamps, im setting up my nect salt water tank and i want to do it completely DIY....
link?
 
Mali,

Could you post a pic of how these stamps are connected to you controller?Right now i've purchased one of each and am going by way tx/rx.But if you have them connected to the other pins i'd like to see how.....thanks.
 
Hay liquidarts

I was just at there website, I see they posted sample code that uses a virtual TX pin.
So, they are using the hardware RX/TX to communicate with the stamp and then they are outputting the data on the virtual TX pin. It's rather simple code. Give it a look.:beer:
 
Yeah but Marian's coding above uses pins 4,5,6,7 and not the TX/RX

That's because I used the NewSoftSerial library and not the standard serial pins (Rx/Tx). Duemillanove has only one serial port, so if you have multiple stamps the above mentioned library comes handy.

BTW, I have tested Mega as well and it looks like for some reasons that I don't understand the stamps don't work with the built in hardware serial ports. Again, NewSoftSerial came really handy.

hope it helps,
Marian
 
According to the ebay website MaLi they say you can connect more than one UART using the 74HC4052, Dual 4-channel analog multiplexer/demultiplexer with the coding they provide in their PDF document on it.Since I don't have all my boards yet i'm really bumming in actually figuring out the hardware side for now.
 
The 74HC4052 is simply being used as switch. It simply connects 1 serial device at a time (when told) to its common I/O pins.

I am curious to see how well the atlas PH product works with no means for calibration or temperature compensation. Of course you can do it in software, but that is more code to write, and they say their product does not need it.
 
The 74HC4052 is simply being used as switch. It simply connects 1 serial device at a time (when told) to its common I/O pins.

I am curious to see how well the atlas PH product works with no means for calibration or temperature compensation. Of course you can do it in software, but that is more code to write, and they say their product does not need it.

Bean,

your instinct is right; I have tested two different brands of pH probes (AquaticLife and Sybon - both very good though) and there was a 0.2 pH difference (if my memory serves me well :headwally:) on just reading the signal. There is definitely a need for a small equation and calibration for perfect results. I had a few lines time by time with Jordan at Atlas and I believe their statement is valid for the probe they sell. So, in other words no calibration if you buy their pH probe as well. I suspect they have the calibration programmed.

Nevertheless, I found these stamps to be the easiest way to add pH and ORP functionality to Arduino.


hope it helps,
Marian
 
That's because I used the NewSoftSerial library and not the standard serial pins (Rx/Tx). Duemillanove has only one serial port, so if you have multiple stamps the above mentioned library comes handy.

BTW, I have tested Mega as well and it looks like for some reasons that I don't understand the stamps don't work with the built in hardware serial ports. Again, NewSoftSerial came really handy.

hope it helps,
Marian

From their data sheet I expect you need to convert their signal to true RS232 signals:

TX "“ TX output delivers asynchronous serial data in RS232 format, except voltages are 0-Vcc. The output is (up to five) ASCII digits representing the PH and ending with a carriage return (ASCII 13). Example:
4.60<CR>
The baud rate is: 38400, 8 bits, no parity, with one stop bit. If standard voltage level RS232 is desired, connect an RS232 converter such as a MAX232.
 
I just looked at there website.
The probes are single junction, it says that on there probes page.
As far as temperature compensation. I just got there pH stamp, they do temperature compensation. It's actually kinda easy. You just enter in a temperature and it returns a temperature compensated reading.
 
I just looked at there website.
The probes are single junction, it says that on there probes page.
As far as temperature compensation. I just got there pH stamp, they do temperature compensation. It's actually kinda easy. You just enter in a temperature and it returns a temperature compensated reading.

... correct. read(26.5)c translates into:" read pH at 26.5 Celsius continuous"

cheers,
Marian
 
Back
Top