Pages: [1]   Go Down
Author Topic: pH sensor code  (Read 1332 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Serial3.begin(38400);

// Send Single Read Command To Stamp
Serial3.print('R');
Serial3.print(13);

// Give stamp time to do it's thing
delay(300);

// Read the stamp data

float myPH = Serial3.parseFloat();

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



Logged

Inland Empire, California, US
Offline Offline
Sr. Member
****
Karma: 6
Posts: 299
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Their example code works fine for me on the mega, uno, and pro mini. what issues are you having?
« Last Edit: December 09, 2012, 10:32:25 pm by seanz2003 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 52
Posts: 2395
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Mark
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

//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(){
Serial.begin(38400);
myserial.begin(38400);
inputstring.reserve(5);
sensorstring.reserve(30);
}
void serialEvent() {
char inchar = (char)Serial.read();
inputstring += inchar;
if(inchar == '\r') {input_stringcomplete = true;}
}
void loop(){
if (input_stringcomplete){
myserial.print(inputstring);
inputstring = "";
input_stringcomplete = false;
}
while (myserial.available()) {
char inchar = (char)myserial.read();
sensorstring += inchar;
if (inchar == '\r') {sensor_stringcomplete = true;}
}
if (sensor_stringcomplete){
Serial.print(sensorstring);
sensorstring = "";
sensor_stringcomplete = false;
delay(1000);
}
delay(1000);
}
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...


* new.JPG (23.61 KB, 742x602 - viewed 45 times.)
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Pages: [1]   Go Up
Jump to: