using atlas scientific’s water pH and EC sensors with a v2 controller

Imagine that you had numerous remote locations that required monitoring of pH, EC, OPR, DO, temperature, flow rates and ambient light levels. Supposing you wanted to compare the different sites, visualize the results in real time, analyse them for trends or errors and create notifications.

Our v2 smart controller board and platform will perform these kind of tasks easily. The v2 controller platform has the following properties that makes it suitable for this task, such as it:

  • comes pre-installed with all the software to support many common sensors including many water quality sensors from Atlas-Scientific
  • requires only a WIFI or other network connection to send and visualize this data remotely
  • creates beautiful interactive sensor images that change color making it easy to read sensor values
  • beautiful customizable graphs for visualizing and comparing readings from different sites for real time trends
  • configurable alters and notifications
  • so easy to use one does not need engineering skills.

An image of the v2 smart controller board, icons and graphs showing some visualizations are shown below

photo 1

phectemplight
phIcons
In this tutorial we will go through the process of collecting and visualizing data from  a UART based atlas-scientific pH and EC sensor. it should be easy to extend the same concepts to include OPR, and DO sensors as well. the v2 controller has 3 on board serial ports and 2 i2c ports available for this. A functional overview of this process is shown below:
 

connecting EC kits

The schematic for wiring an EC  sensor to the v2 controller through UART 3  is shown below:

atlasTds1This example shows how the EC kit is wired to the v2 controller on UART3. The Tx goes to the Rx on the stamp and the Rx goes to the Tx. The v2 controller has custom firmware build that supports the EC sensor on UART3. As soon as a EC sensor is found UART3, the output from the v2 controller will include entries for ec, tds and salinity in the output json file.  these are highlighted in green in the example below.

connecting pH kits

Similarly, the pH sensors from atlas-scientific are supported on UART2. The circuit schematic for this is shown below:

The output json file will hav entries for pH once an atlas pH sensor kit is found in UART2 as highlighted in red  below

atlasPh1

raw sensor data json output

The json file format is explained more here. the snippet below show entries from the  pH and EC  which are auto generated as soon as atlas-scientific  pH and/or EC sensors are found on UART2 and UART3 respectively.

    “D43”:0,

    “D44”:1,

    “D49”:0,

    “A0”:395.00,

    “A1”:719.00,

    “A15”:425.00,

    “nutrientTemp”:19.81,

    “ph”:2.63,

    “ec”:1628,

    “tds”:879,

    “salinity”:0,

    “flow_rate_sensor”:0.00,

    “rtc”:”2000/8/6 19:45:22″

    }

Of course either sensor can be used on it’s own or both together at the same time.

temperature compensation

pH and EC vary with temperature. Atlas-scientific recommends using temperature compensation for accurate sensor readings. This is very easy with the v2 controller as it has some pins with dedicated hardware and software for 1-wire sensors. Connecting a 1-wire sensor in pin D26 as shown in this posting and inserting the temperature probe into the test solution is all that is required for temperature compensation with the atlas-scientific sensors.

the raw data entry for the temperature pin is ‘nutrientTemp’ as shown above json string in blue.

connecting the atlas sensors to the v2 controller

The v2 UART connection header is shown below.

uartCloseup4

the v2 board with atlas pH, EC and temperature sensor connected is shown below:

v2AtlasBoard

a closer view of the UART connections is shown below:

v2atlasUartConnection

the sensing end of the probes are shown below:

v2atlasProbes

checking your sensor data remotely

Power up your v2 controller and ensure that it is has a unique hostname and that it is connected to your wifi network. Check that your controller is sending data by checking that it shows up as an active device  in this active device  listing typically shown below: (highlighted devices are offline)

deviceListingClicking the middle visualization field will give raw json of the latest record for the device if you have not opted into visualization tools. else it should give you some visualization of some form either sensor icons, animations or graphs.

visualizing atlas-scientific pH and EC sensor data

To see better v2 visualizations, you have to opt in by registering your device by clicking on the first column in the device listing table. This should bring screen as shown below as shown in the screen below:.

deviceDetails

This is still under development so for the moment, only your unique device name is required in the ‘name’ field.  Then submit (this will redirect to a Google maps screen not being used at the moment).

mapping your sensors to pins

Click on the following url so we can now map our  water quality sensors. a typical example is show below:mappingSensors

There are two drop down menus, one that shows all pn types received and the other sensors supported by the v2 platform. The pH sensor pin will shows up as ph and this is mpped to pH sensors. EC sensor shows up as ec and this is mapped to the tds sensor type. temperature compensation appears as nutrientTemp and this is mapped to temperature_sensors and finally a a photocell sensor is mapped to pin A9. These pin-sensor mappings are shown in the image above.

interactive sensor icons

see your mapped sensors as interactive images at this jade url  this is shown below, remember to change the last part to  your device name. the colors of the icons change based on the data values

sensorIconss

the following are typical icon images for pH and EC that will show based on the actual sensor readings

atlasPHECicons

changing sensor setpoints

 Sensor set points allow us to determine which sensors values are out of scope. the messages are used for alerting and also controlling the sensor icons showed above.
to access this click on the sensor name in the sensor pin mapping pages described above
sensorSetPoints

graphing atlas pH and EC sensors

visualizing by plotting data points against a time series is easy and flexible on the v2 controller platform. graphing is done using graphana which allows us to trend our sensors, compare reading with other remote sensors, and to be able to make deductions by extrapolating into the future.

to graph our pH and EC data start by click on this grafana url . the following window should open

grafana1click on the graph title then ‘edit’ as shown

grafana2next will will select our series (v2 controller name) and value(sensor pin name) in two steps as shown below.

grafana3

select your controller by typing in the first few characters of your controller as shown below. the click on it when you find it in the drop down list.

selectingGrafanaSeries

next select the data from the pH sensor by typing the first letter ‘p’ in the value field as shown below:

selectingGrafanaValue

you should be presented with a graph of your pH sensor readings. my last 6 hour readings are shown below:

phGrafana

then i noticed that the pH was dropping ( not by much but the visualizations are sensitive enough to show this from 8.62-8.54. i also realized that the ambient temperature was raising. so i clicked on the back to dashboard link and decided to plot the temperature against the pH. i did this by adding the temperature sensors in a new panel at the point shown below

addNewGrafanaPanel

the now temperature readings are shown in new panel against pH as shown below over a 24 hour period. the graphs are cleaned up by closing unused panels.

phTempGrafana

i just learned for myself that pH raises with temperature … on a hot californian day – visualizations are so fun.

EC data can be added the same way on by adding a new panel and loading the EC data.