Offline
Newbie
Karma: 0
Posts: 3
|
 |
« on: December 09, 2012, 05:12:43 pm » |
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
Brattain Member
Karma: 316
Posts: 35593
Seattle, WA USA
|
 |
« Reply #1 on: December 09, 2012, 06:17:40 pm » |
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
Newbie
Karma: 0
Posts: 30
|
 |
« Reply #2 on: December 09, 2012, 10:19:33 pm » |
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
Full Member
Karma: 1
Posts: 181
|
 |
« Reply #3 on: December 09, 2012, 10:29:23 pm » |
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
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #4 on: December 10, 2012, 11:29:16 pm » |
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
Newbie
Karma: 0
Posts: 30
|
 |
« Reply #5 on: December 10, 2012, 11:30:08 pm » |
Arduino TX Pin to pH Stamp RX pin Arduino RX Pint to pH Stamp TX pin
|
|
|
|
|
Logged
|
|
|
|
|
Poole, Dorset, UK
Offline
God Member
Karma: 8
Posts: 678
|
 |
« Reply #6 on: December 11, 2012, 07:58:16 am » |
Serial3 is for the mega not the UNO try using Serial.
Mark
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 3
|
 |
« Reply #7 on: December 12, 2012, 03:23:11 pm » |
//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
Brattain Member
Karma: 316
Posts: 35593
Seattle, WA USA
|
 |
« Reply #8 on: December 12, 2012, 03:27:00 pm » |
#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
|
|
|
|
|
|