Go Down

Topic: Atlas scientific ph/orp stamp RS232 (Read 6471 times) previous topic - next topic

lince

Mar 27, 2011, 07:22 pm Last Edit: Mar 27, 2011, 07:25 pm by lince Reason: 1
Hello, I have a problem with this stamp https://www.atlas-scientific.com/00_other/pHStampManual.pdf. I try print in it for ask and get answer with comand serial1.print("c\r) but seems not work, because the stamp has got two leds red (power on) and green( recive and send dates ) and the green led does nothing.
Please anyone can help me please.

PaulS

We need to know how you have the device connected to the Arduino. Post a clear picture.

We need to know what code you are using on the Arduino, too.

lince

hello pauls thank you very much for request me.
I use that code i see in a post you were talking about this stamp:
#include <NewSoftSerial.h>

NewSoftSerial ORP(10, 11);
#include <stdio.h>


void setup()
{
Serial.begin(9600);
ORP.begin(9600);

}

void loop()
{
  ORP.print("l1\r" );
 
{
  char inData_ORP[24];
  char string_ORP[8];
  int index =0;
  float ORP_val = 0.0;
  Serial.println("read()c");
  delay(750);
  while (Serial.available() > 0 && index < 24)
    {
      inData_ORP[index] = ORP.read();
      index++;   
    }
    inData_ORP[index] = '\0';
    sscanf(inData_ORP, "%*s %s", string_ORP);
    ORP_val = atof(string_ORP);
    // Serial.print("Sensor output: [");
    // Serial.print(inData_ORP);  Serial.println("]");
    Serial.print("ORP value: ");
    Serial.println(ORP_val);
  }
}
i have conect tx and rx of the stamp to pins(10,11 arduino)
i have this  in serial monitor:
sensor output:  [probechcheck probecheck]
read (26.0)c

i could use serial1.begin but i try and no works
I think the stamp no works becouse the control leds of the stamps are turn off all the time
i try tu print to the stamp ("c\r), to print for the stamp request but the leds contro do not turn on
the stamp has got five control keys:

TT.TT
Take temperature dependent reading.
25 C°
L1
Enables debugging LEDs
Enabled
L0
Disables debugging LEDs
Disabled
R
Takes one PH reading
N/A
C
Takes continuous PH readings every .5 seconds
N/A
E
Stops all readings. Enter standby/quiescent mode.
N/A
i do not what i am doing wrong

AND THE END OF TRANSMISION:
THE END OF A TRANSMITION. OK= END<CR> NOT OK = END<CR><LF>


this is the official page:   https://www.atlas-scientific.com/00_other/pHStampManual.pdf
thank you very much

PaulS

The only connections between the Arduino and the stamp that you describe are the RX/TX lines. What about power and ground? Where's the picture?

lince

Sorry for the picture, i have not picture. And excuse me for my english i am from spain
the conexion of the stamp are
ph stamp

RX---------------------------------------TX ARDUINO
TX---------------------------------------RX  ARDUINO
GND------------------------------------GND arduino
VCC-------------------------------------3.3v arduino
PRB-------------------------------------to inside probe wire arduino
GND-------------------------------------to outside probe wire and GND arduino

PaulS

Code: [Select]
  ORP.print("l1\r" );
This should be in setup(), not loop. It may need to end with \n, rather than \r.

This is the only command you send to the device.

Code: [Select]
while (Serial.available() > 0 && index < 24)
    {
      inData_ORP[index] = ORP.read();
      index++;   
    }

If there is data in one buffer, read from the other buffer. How's that working for you? Not too well, I'd guess.

PaulS

Quote
i could use serial1.begin but i try and no works

Does this mean that you have an Arduino with multiple serial ports? The only one that has multiple serial ports is the Mega, and NewSoftSerial may not work on the Mega. It depends whether you downloaded the official NewSoftSerial library, or the one modified to work on some pins on the Mega (and whether you are using the correct pins).

lince

#7
Mar 28, 2011, 09:33 pm Last Edit: Mar 28, 2011, 09:36 pm by lince Reason: 1
hello pauls thank you for your understanding and your patience with me.
I have arduino Mega
now i connect the stamp to (18,19) arduino pins and can make work the stamp with this code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);

#include <stdio.h>

void setup()
{
Serial1.begin(9600);
lcd.begin(20,4);
lcd.print("empezamos");

}

void loop()
{

 delay(1000);
char inData_ph[24];
char string_ph[8];
int index =0;
float ph_val = 0.0;
Serial1.println("read()c");

delay(750);
while (Serial1.available() > 0 && index < 24)
  {
    inData_ph[index] = Serial1.read();
    index++;  
  }
  inData_ph[index] = '\0';
  sscanf(inData_ph, "%*s %s", string_ph);
  ph_val = atof(string_ph);
  // Serial.print("Sensor output: [");
  // Serial.print(inData_ORP);  Serial.println("]");
  lcd.print("ph valor: ");
 lcd.print(ph_val);
}  

I gets ph valor about 6.74 6.78 in a ph 7 test solution
i think it is not exactly becouse the stamp temperature default valor is 25º
but i can not print any command for turn on the leds, for change the default temperature valor and change the continuos reading for only one read with the comand R<CR>

I try with:
Serial1.print("R\r");
Serial1.print(82,13);
Serial1.println("R\r");
Serial1.println(82,13)
with this:
char envio[3]={'R',13,0};
Serial.print(envio);
and so with all six commands
I try lot of ways but i can not print the command.

I change the baude rate Serial1.begin(9600); and do not work .
The oficcial page say that :The baud rate is: 38400, 8 bits, no parity, with one stop bit.
but in the code that i have now workin , if I put baude rate 38400 and so not work
Why work only with baude rate 9600?
sorry for so many questions.
Thank you very much

PaulS

Code: [Select]
Serial1.println("read()c");
You are sending this to the stamp, on every pass through loop. It doesn't know what to do with that "command".

lince

you have all reason, but if i  use this code becouse it is the only way that i get ph valors,
if i use this one :
#include <LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);
void setup()
{
Serial1.flush();
Serial1.begin(38400);
lcd.begin(20,4);
Serial1.print('C',BYTE);
Serial.print(13,BYTE);
Serial1.print('l1',BYTE);
Serial.print(13,BYTE);
}

void loop()
{

  delay(1000);
char inData_ph[24];
char string_ph[8];
int index =0;
float ph_val = 0.0;


delay(750);
while (Serial1.available() > 0 && index < 24)
   {
     inData_ph[index] = Serial1.read();
     index++;   
   }
   inData_ph[index] = '\0';
   sscanf(inData_ph, "%*s %s", string_ph);
   ph_val = atof(string_ph);
   // Serial.print("Sensor output: [");
   // Serial.print(inData_ORP);  Serial.println("]");
   lcd.print("ph valor: ");
  lcd.print(ph_val);

i have not get  valor,  i have:  ph valor =0.00
i do not know why.

and if i remove  :   Serial1.println("read()c");
from the code this not work, maybe somehow this  is like the command    r<CR> that it is necesary to get one ph read from the stamp, perhaps for transmission rate (9600) that the stamp recive the comand  that would be more (38400), i do not know why only works with this.
what can i do?
thanks

lince

Well nowthe stamp is working ok

Finally I could get in touch with the seller's and it is they had changed the manual for one of a new version by mistake before changing the product with a new commands
Thank you for all pauls i am very greatfull for your help.

cam

Hi Lince

Is there any chance you could display the code that worked.

I am have no end of trouble trying to get a value to display in the serial monitor using my Arduino Diecimila and the NewSoftSerial library.

lince

Hello cam.
What stamp have you got? exactly what version?
I have the 1.6 version and the commands to send the stamp  are :

                                   Serial.begin(9600);

for continuos readings : Serial.print("read()c");
                                 Serial.print(13,BYTE);
for only one read is:  Serial.print("read()");
                              Serial.print(13,BYTE);

if you have got the last version 2.0

                                  Serial.begin(38400)
for contiunuos readings :Serial.print("R");
                                   Serial.print(13,BYTE);
for single read :    Serial.print("R");
                          Serial.print(13,BYTE);
You can first try with  this code I: (do not use the NewsSoftserial
library)

void setup()
{
Serial.begin(9600);
}

void loop()
{
char inData_pH[24];
int index =0;
float pH_val = 0.0;
Serial.println("read(26.0)c");
delay(1000);
while (Serial.available() > 0 && index < 24)
   {
     inData_pH[index] = Serial.read();
     index++;
     inData_pH[index] = '\0';
   }
 
   Serial.print("Sensor output: [");
   Serial.print(inData_pH);  Serial.println("]");
  // pH_val = atof(inData_pH);
  // Serial.println(pH_val);
   
}


first load up the code to Arduino with the Stamp 2.disconnected
and when load it is done , unplegged the usb from Arduino.
After connect the Stamp to arduino on  0,1 pins (RX0,TX0).
and connect the usb to arduino.
This way first you can see if the Stamp work or not work.
good look.               

cam

Hi Lince,

I am not sure what version of the stamp I have.  I only received it about three weeks ago.

Thankyou so much for posting your code.  That works and I can see the value from the probe in the serial monitor.I spent the entire weekend trying to get it working and was getting a little frustrated with myself. Your code helped me out a lot.

I have the ORP stamp also however I have to buy a probe before I can test that one.

My next step is to get the char value to display on my Sparkfun 4-Digit 7 Segment display however I now need to work out how to convert the char to an integer before the display will accept the value I think.

Thankyou again.

Cam






ossama

This is very strange, I have never seen somehting like this

please help if you could

I get a response back from the ph stamp, i do get the ph but one of the characters is weird. looks like this

7.x4  (where is the x comming from?!?!?)

also when i unplug the ph probe, one would expect a reply from the stamp saying no probe

this is what i get

chÅck pòobÅ  and sometimes  cheÃk ðroÂe


here is my code

Code: [Select]

#include <NewSoftSerial.h>               //this will let the software take advantage of the "newsoftserial" library.                   

NewSoftSerial mySerial =  NewSoftSerial(7, 8);

char stamp_data[15];         
//this is where the data from the stamp is stored. The array is 15 char long because
//if no pH probe is connected, the message "check probe" is transmitted.
//Having an array that is too small will cause data corruption and could cause the Arduino to crash.
byte holding;                       
//used to tell us the number of bytes that have been received by the Arduino and are
//holding in the buffer holding
byte i;                 


void setup()

{
  mySerial.begin(38400);   
  Serial.begin(57600); 
delay(1000);
  mySerial.print("l0");           //the command "c" will tell the stamp to take continues readings
  mySerial.print(13,BYTE);       //ALWAYS end a command with <CR> (which is simply the number 13) or//(print("/r")
delay(1000);
  mySerial.print("r");           //the command "c" will tell the stamp to take continues readings
  mySerial.print(13,BYTE);       //ALWAYS end a command with <CR> (which is simply the number 13) or//(print("/r")
 
}

         
void loop() {                                       //main loop


if(mySerial.available() > 0) {        //if we see the more than three bytes have been received by the Arduino

    holding=mySerial.available();      //lets read how many bytes have been received
    for(i=1; i <= holding;i++){       //we make a loop that will read each byte we received
        stamp_data[i]= mySerial.read();     //and load that byte into the stamp_data array
    }

    for(i=1; i <= holding;i++){                      //we now loop through the array       
    Serial.print(stamp_data[i]);             //printing each byte we received  through the hardware UART
       }

       Serial.println("");                               //once we finished, we print a null char with the <CR><LF> command.
    mySerial.flush(); 
    }
}



also using different code as well i get weird looking characters


Code: [Select]

#include <NewSoftSerial.h>               //this will let the software take advantage of the "newsoftserial" library.                   

NewSoftSerial mySerial =  NewSoftSerial(7, 8);



void setup()
{
  mySerial.begin(38400);   
  Serial.begin(57600); 

}

void loop()
{
char inData_pH[24];
int index =0;
float pH_val = 0.0;
  mySerial.print("c");           //the command "c" will tell the stamp to take continues readings
  mySerial.print(13,BYTE);       //ALWAYS end a command with <CR> (which is simply the number 13) or//(print("/r")

delay(1000);
while (mySerial.available() > 0 && index < 5)
   {
     inData_pH[index] = mySerial.read();
     index++;
     inData_pH[index] = '\0';
   }

   Serial.print("Sensor output: [");
   Serial.print(inData_pH);  Serial.println("]");
  // pH_val = atof(inData_pH);
  // Serial.println(pH_val);
   
}




Go Up