Reef Discussion

Rob

Member
Apr 26, 2012
743
424
The atlas device is connected via a ttl level serial connection, 1 transmit and 1 receive (thus 2 pins). You send it ascii message (r = read data) and it responds with the value x.xx. The other nice thing with it you can set the temperature compensation direct to the device.
So the Atlas devices gives you the true value of pH and transmits this value via a serial connection, no formatting required. Its not a voltage signal. Each Atlas device needs two pins tx & rcv unless you have a serial mutliplexor.

Atlas have arduino code on there web site so getting the value into the embedded arduino should be do able. Its how we then move this data to create a ninja object.
 

Neillw

Member
Sep 26, 2013
1,173
184
I got the Atlas conductivity/salinity probe going,
Altas.jpg

This is my code:

*
Code to make Atlas Scientific Salinity Probe run on ninja-block
Copyright (C) 2013 Neill Wainwirght AKA Neill.w
For non comerical use only.
Created for the awsome dudes and dudetts of http://www.thereefuge.com.au/

*/




#include <SoftwareSerial.h>
#include <aJSON.h>
#include <math.h>
#define rxpin 2
#define txpin 3


SoftwareSerial mySerial(rxpin, txpin);

String stampmode = "C";
String enter = "\r";
String inputstring = "";
String sensorstring = "";
boolean input_stringcomplete = false;
boolean sensor_stringcomplete = false;
int valueR, valueG, valueB;
//have we received all the data from the Atlas Scientific product


void setup(){
Serial.begin(9600);
mySerial.begin(38400);
inputstring.reserve(5);
sensorstring.reserve(30);
mySerial.print (stampmode);
mySerial.print (enter);
//set aside some bytes for receiving data from Atlas Scientific product
}



void serialEvent() {
char inchar = (char)Serial.read();
inputstring += inchar;
if(inchar == '\r') {input_stringcomplete = true;}
}



void loop(){ //here we go....

if (input_stringcomplete){
mySerial.print(inputstring);
inputstring = "";
input_stringcomplete = false;



while (mySerial.available() > 0) {
valueR = mySerial.parseInt();
valueG = mySerial.parseInt();
valueB = mySerial.parseInt();


if (mySerial.read() == '\r') {sensor_stringcomplete = true;}



if (sensor_stringcomplete){
doJSONData("0", 0, 1, valueR);
sensorstring = "";
sensor_stringcomplete = false;
}
}
}

void doJSONData(char * strGUID, int intVID, int intDID, int numDATA)
{
aJsonObject* root = aJson.createObject();
if (root == NULL)
{
Serial.println("error root");
return;
}

aJsonObject* device = aJson.createArray();
aJson.addItemToObject(root,"DEVICE", device);

aJsonObject* guid1 = aJson.createObject();
aJson.addItemToArray(device, guid1);
aJson.addStringToObject(guid1, "G", strGUID);
aJson.addNumberToObject(guid1, "V", intVID);
aJson.addNumberToObject(guid1, "D", intDID);
aJson.addNumberToObject(guid1, "DA", numDATA);

char* string = aJson.print(root);
if (string != NULL)
{
Serial.println(string);
}

aJson.deleteItem(root);
free(string);
}
 

Attachments

Last edited:

Joele

Member
Apr 24, 2013
276
91
Melbourne
Firstly awesome thanks... so that is salinity, ph next.. I am still waiting for my stuff to arrive so not starting yet.

Couple of questions, is this the code that allows us to install it as a driver or however ninja block lets you plug into their interface?

Sorry as I am still waiting on my ninja block to be shipped so I am not 100% on how we take arduino code that I would write in Arduino IDE (the well documented part) and massage that into their system/web interface (which is installed as a driver? or module?), how does that work?

You have set the rxpin as 2 and the txpin as 3, so is this plugged just into those pins on the arduino (which I think is inaccessible on the ninja block?) how does that translate to the micro usb ports they use on their ninja block that they told me you have to plug things through.. This is all the stuff I am having trouble understanding (before having the device) as I can find little to no documentation about it..
 
Last edited:

Sam Parker

Moderator
May 6, 2013
4,802
2,397
Geelong
Awesome work, feeling confident enough to order a salinity probe and a ph probe now! Thanks so much for helping out! You guys are simply awesome :worship
 

Rob

Member
Apr 26, 2012
743
424
I think ph and orp are two great measurements of tank health, I think orp over salinity, just my opinion and really have no substance behind it although salinity can easily be tested week by week although orp is a good indicator something is going wrong
 

Sam Parker

Moderator
May 6, 2013
4,802
2,397
Geelong
why not all three :)

But yes, I'm with you - salinity isn't going to change on its own all that much (unless something goes wrong with your ATO...)
 

Rob

Member
Apr 26, 2012
743
424
I did have trouble with orp and to some extent ph when I was running an ATI powermodule T5 fixture with the atlas probes. This light (T5's) induced a voltage into the tank which screwed with the measurements. I tried grounding the tank but still did not work. Changed my T5's to DIY LED's and everything is fine now. There is info on the net about flouro tubes inducing a voltage into the tank. Generally its things like heaters and pump which can cause this induced voltage however in my case it was my lights.

If you want easy stuff to monitor and cheap why not monitor the ATO RO flow into the tank. Monitoring this over time ver temp etc could be quite good. I have just purchased a couple of these flow meters for my raspberrypi 1wire inputs, although it will probably take another 3 months for me to get around to install these.: http://www.futurlec.com.au/Flow_Sensor.jsp
 

Rob

Member
Apr 26, 2012
743
424
These flow meters might not be SW safe however for RO topoff they are OK. In saying that I do plan to integrate one into my ATO and one in my SW water change line.
 

Neillw

Member
Sep 26, 2013
1,173
184
The only reason I did salinity is because I already had it on hand (using it for ATO control in my automatic water changer project)

If someone wants to shout me any other probes I can do them to :p
Should be pretty darn easy to add any of the other atlas probes now, would just need to tweak my code a bit.

Someone with an actual ninja block should try adding my code to the ninjas Arduino before everyone runs out to buy probes. I installed the Ninja client on my raspberry Pi, and used an Arduino.
Mainly because $200 for a Ninja block seems like a ripoff when you can build the same thing for $45 using a Pi + Arduino
 
Last edited:

Sam Parker

Moderator
May 6, 2013
4,802
2,397
Geelong
I'm happy to try adding the code, I might just need some step by step instructions on how to do so :)

If it works (i'm sure it will) what do we need from atlas for each sensor? Just the sensor, or the circuit they sell too. (don't worry, I won't buy it till the code works :P)
Cheers,
Sam
 

Joele

Member
Apr 24, 2013
276
91
Melbourne
I'm happy to try adding the code, I might just need some step by step instructions on how to do so :)
And here lies the hard part, I have an arduino now and using the arduino IDE to work with it is pretty basic, it is kinda cool, and working with the Atlus Scientific from the IDE will take very little effort. I am confident I could get it working from a Pi too (have one somewhere). But the ninjablock itself involves a certain level of customization it seems as they no longer use the basic tx/rx pins spots on the arduino but have their own usb connections and seem very reluctant to provide documentation or help on how to use this stuff..

Adding that code exactly as it is probably will not work for you with the ninjablock as there is a little more involved

If it works (i'm sure it will) what do we need from atlas for each sensor? Just the sensor, or the circuit they sell too. (don't worry, I won't buy it till the code works :p)
I think you will just need the stamp, the BNC connector and the probe. Like in the kit..

https://www.atlas-scientific.com/product_pages/kits/ph-kit.html

Which circuit did you mean?

I am pretty confident we can work this out if they at least provide some basic direction, but as you see they did not answer me, once I get the device itself I will know more. I still suggest no one buys too much just yet..

From my perspective I have no fear buying the probes etc as worse comes to worse I can use it with a R.Pi which is well documented and just save the data to my NAS (mysql) database from the python app that I can use to query the sensor then quickly write a pretty windows app to graph etc everything.. I will do my best to work out the ninjablock as I like the idea of a nice self contained device that other people can buy and although not cheap still very cheap compared to the commercial alternatives..
 
Last edited:

Rob

Member
Apr 26, 2012
743
424
Just a word of caution here as the $$$ start to add up. This is a very cool project monitoring data and I've done it for 10 + years on my aquarium using industrial instrumentation. BTW I work for an automation company...You could find yourself spending 50% of what a "real" controller would end up costing and only provide monitoring and some non critical 240 switching. Having built my own controllers / monitors etc etc and now having a profilux, with wireless vortech control, LED's, ATO, water changes, temperature control web server and a commercial 240VAC powerbar it might only end up being another $500.00 on top of what you will end up spending on a tank monitor. Thus keep a cap on costs and have a budget, although reefing and budgeting are mutually exclusive :)

Now back to Atlas sensors discussion. Before we go further we just need to double check that ph,orp and conductivity can in fact all be connected simultaneously. I have a recollection when I asked atlas a few years ago (as the devices are not galvanically isolated and they share a common) you may have to power down the conductivity sensor when taking ph/orp readings.

Hello Rob
The Atlas Scientific PH-3 and ORP-3 units can work in the same aquarium and can operate simultaneously without a problem. It is only E.C. the will cause a problem. However, the is easily correct for. You just don’t take the readings at the same.


Let me know if you need any more help.

All the best

Laz

Customer support

Atlas Scientific
 

Neillw

Member
Sep 26, 2013
1,173
184
Hi @Rob,
Funny, my day job is also in automation and control. :)
The limitation with probes is that they can not be simultaneously read.
They work fine if you read them one after another I believe, it is a limitation of the bit banged serial library it is using
(SoftwareSerial.h)

EDIT: Just noticed your comment re EC, thanks for the heads up mate, I did not know that.
 
Last edited:

Joele

Member
Apr 24, 2013
276
91
Melbourne
Hi Joele,
Dont think its goint to be hard at all,
The Ninja block is just a beglebone/pi with an arduino straped to it (with a 433mz radio)
The "USB ports" are just a standard arduino pin outs
http://help.ninjablocks.com/customer/portal/articles/960441-ninja-cape-arduino-pinouts
The existing arduino on the ninjabock just needs to have the code added to it and the rx/tx pins changed to say, 14/17
ahh ffs that is what I was asking them for and getting no response.. LMAO, thanks, simple they are just using the mini-usb cables and of course want you to buy another $18 overpriced board but not really needed..

P.S. what is "A6" and "A7" are they still labels for standard usable arduino ports? Are they not Analogue only, so we have very few digital ports left?

what you say makes sense actually 14 and 17, but then on usb connection 2 and 3 I thought A6 and A7 were not usable in this way?
 
Last edited:

Joele

Member
Apr 24, 2013
276
91
Melbourne
Just a word of caution here as the $$$ start to add up. T... Thus keep a cap on costs and have a budget, although reefing and budgeting are mutually exclusive :)
I understand but I enjoy building things myself, I wouldn't be restoring broken down imported pinball machines (my other hobby at the moment) if I had any common sense when it came to cost efficiency..

Now that is also why I agree not too many people should be buying stuff yet, I am happy to try options out once the dust is settled we will know what is needed and what is not and hopefully then we can do it more efficiently..