Go Down

Topic: Any success on Atlas Scientific pH sensor with Arduino Yun? (Read 2439 times) previous topic - next topic

jimmynyc

Hi, I am having trouble with connecting the Atlas Scientific pH sensor with a Arduino Yun. Anyone having success with connecting these two?

I am making a monitoring system that is connected to the internet (using Yun) and passing the data to a data.spark database. I tried to upload the documentation code (from Atlas Scientific website) to the Yun, but it doesn't work. I have been searching for sample codes online, but many people is also having problems using the pH sensor with the Yun. I also emailed the company, but they are not very helpful; they just told me that their products should work with every type of Arduino in the market.

Jim.


ShapeShifter

Perhaps you could include a link to the code you're trying to run? Or better yet, post the code.

And mention what exactly doesn't work?

Odds are very good that the code is written for a generic Arduino board with a WiFi Shield or an Ethernet Shield. (A dead giveaway of this is if the first few lines have #include "WiFi.h" or #include "Ethernet.h".) If that's the case, the code won't work with the Yun.

However, if the first few lines has #include "Bridge.h" then it is written for the Yun.

The Yun handles networking differently than other Arduinos. When using the WiFi Shield or Ethernet Shield, the sketch has to do all of the network setup and management. With the Yun, there is a powerful Linux processor that manages the network, so the sketch is simpler.

Here are some discussions that tell of some of the differences and required changes:

myggle

I spoke to one of the AS techs via email about this product regarding possibly multiplexing to connect several probes to a single stamp, and even though I didn't purchase anything from them yet, I found the tech most willing to help anyway possible within reason of course.  I hope you are able to resolve your issue, and if so, please share your experiences with the stamp's performance, but if not, have you considered using a different Arduino if that code is what you're used to?

jimmynyc

The code I am using can be found here:
https://www.atlas-scientific.com/_files/code/Arduino_pH_sample_code.pdf

I emailed the AS tech support regarding if the pH kit can work with the Yun, and I got a very outrageous reply from their CEO Jordan.

' What kind dumb ass question you askin me?? Does the tin man have a sheet metal cock?
 
If you device can read an RS232 signal through a UART  or an I2C signal it will work. It does not matter what the CPU is.
 
Son, in the world of microchips there are no capability issues. This ain't no MAC or PC compatible conversation, we on a whole different level.'

ShapeShifter

Well, while his phrasing and demeanor is definitely questionable, the content of his message is correct. Serial is serial and I2C is I2C. It's nothing esoteric.

The hardware is compatible. The code? Who knows?

So, back to the original questions... What problems are you having, and let's see your code? And how are you hooking it up?

jimmynyc

Here is the code, and nothing shows when I open the serial monitor.



#include <Bridge.h>

#include <AltSoftSerial.h>     
#define rx 8
#define tx 9

AltSoftSerial myserial(rx, tx);

char ph_data[20];
char computerdata[20];
byte received_from_computer=0;
byte received_from_sensor=0;
byte arduino_only=0;
byte startup=0;
float ph=0;
byte string_received=0;


void setup(){
    Bridge.begin();
    myserial.begin(38400);
}

 
void loop(){
  String pHval = "0.00";
  float pH = 0.00;
 
  do {
    myserial.print("C\r");
    delay (1000);
   
    if(myserial.available() > 0){
      received_from_sensor=myserial.readBytesUntil(13,ph_data,20);
      ph_data[received_from_sensor]=0;
      string_received=1;
      pHval = String (ph_data);
      pH=atof(ph_data);
    }   
  } while ((pH<2.00) || (pH>9.00)||sizeof(pHval)<4) ;
 
  Bridge.put("pH",pHval);
 
 }     

tasasaki

If "data.spark database" means Data.SparkFun.com, it's better to try pushing data with yun like the following.
https://learn.sparkfun.com/tutorials/pushing-data-to-datasparkfuncom/arduino-yn

The sample sketch tells you what you need playing with Data.SparkFun.com.

ShapeShifter

nothing shows when I open the serial monitor.
Great! It's working properly! Nothing shows on the serial monitor because nothing gets written to the serial monitor. There is no code there to write anything to it.

What were you expecting to see? And why?

The code reads a pH value, and stores it on the Bridge data store with the name "pH". To read it, use a web browser with the URL http://arduino.local/data/get/pH where "arduino" is the name you gave your Yun when you set it up. Depending on your computer and network setup, you may have to use your Yun's IP address instead arduino.local.

Go Up