Go Down

Topic: pH monitoring with Atlas Scientific pH stamp (Read 4 times) previous topic - next topic

robtillaart

The second one shows that you can synchronize on the char 13 (which is a newline)

now using double buffering -something like this. data is collected in val array and if full it is copied for use into buffer.
Code: [Select]

unsigned long lastTime = 0;

int count = 0;
char val[6];
char buffer[6];

void setup()
{
  Serial.begin(....);
  lastTime = millis();
}

void loop()
{
  if (pH.available() >0)
  {
    char incharPH = (char)pH.read();
    if (inharPH == 13)
    {
      val[count] = 0;
      count = 0;
      strcpy(buffer, val);
    }
    val[count] = inCharPH;
  }

  if (millis() -1000 > lastTime)
  {
    Serial.println(buffer);
    lastTime += 1000;
  }

   // rest of code
}


Quote
I saw on the datasheet that the sensor could be calibrated using one of the various commands.

No time to dive into that now, sorry ...
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

aelkhalil

No problem, this is already a lot of help. thanks so much :)
I'm going to try to get the same logic to work on the EC stamp

pjsquared

This board has a continuous and on demand mode.  Send it an "E" command to terminate continuous. Send it a "C" command to get a value periodically say every 10 seconds. Calibration has to be performed with a 7 and 4 or 7 and 10 standard. Do the 7 first as this fixes the intercept then do 4 as this fixes the slope.

You may also want to consider using analog ports rather than serial when you have more than one sensor (pH and EC). These are some options.

http://webpages.charter.net/tdsmeter/

http://www.phidgets.com/products.php?category=6&product_id=1130_0

You could add a temp sensor on yet a another analog port but the accuracy required for hydro use may not justify it unless you will be controlling envrionmental equipment.

aelkhalil

Hi pjsquared,

I moved the conversation to here:
http://arduino.cc/forum/index.php/topic,98850.0.html

Quote
This board has a continuous and on demand mode.  Send it an "E" command to terminate continuous. Send it a "C" command to get a value periodically say every 10 seconds. Calibration has to be performed with a 7 and 4 or 7 and 10 standard. Do the 7 first as this fixes the intercept then do 4 as this fixes the slope.


I have been trying to communicate with the board by typing the commands in the serial monitor but so far nothing...
I don't know how I did it, but a few days ago, I managed to switch off the LED (on datasheet is says to enter L0 to turn off the LEDs and L1 to turn them back on), but I still cannot manage to either turn the LED on, or reset the board.

the only way I can get a read is by resetting the arduino and unplugging/ replugging the GND on the stamp

Go Up