Go Down

Topic: pH sensor code (Read 4130 times) previous topic - next topic


I'm looking for a program code that will work with the arduino uno to control an Atlas Scientific pH sensor. I don't need it to do anything but output a pH reading. I'm having problems getting the sample code the Atlas Scientific website has to work. I was wondering if anyone has suggestions to get their sample code to work or has a program of their own? Thanks!


I'm having problems getting the sample code the Atlas Scientific website has to work.

Who is better than the manufacturer of the probe to develop the code? If you are having problems with their code, you might consider contacting them, or post the code here and explain what problems you are having.
The art of getting good answers lies in asking good questions.


Please post example code:

The Atlas pH stamp will take a minimum 262 millis from receipt of command untill it will respond with the pH reading.  If the debug led's are enabled the lag will double. By default the pH Stamp module uses the following serial settings: 38400, 8, N, 1.


// Send Single Read Command To Stamp

// Give stamp time to do it's thing

// Read the stamp data

float myPH = Serial3.parseFloat();

Hope this helps, if you need more info, just post question


Dec 10, 2012, 04:29 am Last Edit: Dec 10, 2012, 04:32 am by seanz2003 Reason: 1
Their example code works fine for me on the mega, uno, and pro mini. what issues are you having?


At this point it might be wiring. I've got the wire going from TX on the pH microchip to the TX pin on the Arduino and the same with the RX pin. I've also tried to upload it with the two switched. I can upload the program fine, but nothing will print on the serial monitor. The baud rate and carriage return settings are correct as well. This is going to be used in a biodiesel process so the only thing attached to the arduino is this sensor


Arduino TX Pin to pH Stamp RX pin
Arduino RX Pint to pH Stamp TX pin


Serial3 is for the mega not the UNO try using Serial.



//here's the sample code im using thee only modifications i did was add the delay's at the end just in case it needed it.

#include <SoftwareSerial.h>
#define rxpin 0
#define txpin 1
SoftwareSerial myserial(rxpin, txpin);
String inputstring = "";
String sensorstring = "";
boolean input_stringcomplete = false;
boolean sensor_stringcomplete = false;
void setup(){
void serialEvent() {
char inchar = (char)Serial.read();
inputstring += inchar;
if(inchar == '\r') {input_stringcomplete = true;}
void loop(){
if (input_stringcomplete){
inputstring = "";
input_stringcomplete = false;
while (myserial.available()) {
char inchar = (char)myserial.read();
sensorstring += inchar;
if (inchar == '\r') {sensor_stringcomplete = true;}
if (sensor_stringcomplete){
sensorstring = "";
sensor_stringcomplete = false;


Code: [Select]
#include <SoftwareSerial.h>
#define rxpin 0
#define txpin 1
SoftwareSerial myserial(rxpin, txpin);

Why are you doing software serial on the hardware serial pins? You can't do both.
The art of getting good answers lies in asking good questions.


paulS..... what u mean cannot do that? that is effect the value?

i done exactly with this project... but the value is display 8 output at one time... like i attach...


what u mean cannot do that?

There is nothing ambiguous about the statement "You can not do that". If you don't understand that pins 0 and 1 can be used by the HardwareSerial instance (Serial) OR by the SoftwareSerial instance (mySerial), but not by both, I can't help you.
The art of getting good answers lies in asking good questions.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131