Vous êtes sur la page 1sur 30

Water Sensors: Saving the world through arduino-based water

sensors and makerspacing


Leah Leshchinsky, Lina Gonzalez, Faith Duffy, Philip Sottosanti, Bryan Chua, Charles Schweik

Public Policy 597M, University of Massachusetts Amherst


Amherst, Massachusetts 01003, USA
nd
Submitted December 22 , 2017
lleshchinsky@umass.edu, ltorresgonza@umass.edu, fduffy@umass.edu, psottosanti@umass.edu, bchua@umass.edu,
cschweik@pubpol.umass.edu

Attribution 3.0 Unported (CC BY 3.0)


You are free to:
● Share — copy and redistribute the material in any medium or format
● Adapt — remix, transform, and build upon the material
● for any purpose, even commercially.
Under the following terms:
● Attribution — You must give appropriate credit, provide a link to the
license, and indicate if changes were made. You may do so in any reasonable
manner, but not in any way that suggests the licensor endorses you or your use.

Introduction

This project is an Arduino based water pollution sensor that tests for pH, dissolved
oxygen, conductivity, and temperature of water. The goal is to have a single unit in which all four
of these sensors can operate at once, collecting data from some water source. This data will be
stored, allowing for compilation and analysis.

Background

Initially, this device was built by Professor Juan Camilio Cardenas and others at the
University de Los Andes in Bogota, Colombia, in an effort to collect preliminary pollution data in
rivers exposed to illegal gold mining and mercury. A main contributor to this effort was
Sebastian Arevalo Ribon. For the creators in Colombia, this project entailed building and
programming a device which would operate each sensor; likewise, it would interpret and convert
data collected from said sensors into an understandable output. They ordered the sensors to be
used for the project. Then, all of these components were integrated to create a single “water
sensor” to detect the four characteristics mentioned above.
A copy of the project, as well as this instructable, were created as part of a Makerspace
Leadership and Outreach course (PPA597M) taught by Professor Charlie Schweik at the
University of Massachusetts Amherst.

The goals for the UMass Amherst team were: (1) Translate documentation provided
from Colombia-in Spanish- to English; (2) Build the 4 sensor device; and (3) Test that device at
UMass; and (4) develop a two-campus (UMass - Los Andes) collaboration in this area following
commons-based peer production.

Process

For the team at UMass, using an Arduino based sensor meant that the code written by
the team in Colombia was not applicable. Thus, we needed to formulate code compatible with
Arduino which would operate the four sensors and output the necessary parameters. It is useful
to note that the equipment for this project was ordered based on a materials list provided by
Sebastian. The creators of these materials have a corresponding website (i.e. two of the
sensors came from a company called Atlas Scientific, which has a website). Located on these
sites is “Sample Code” for each sensor. These samples are simple Arduino code which operate
and interpret the sensors. Thus, by integrating these sample codes for all four sensors, we were
able to create a “rough draft” of code to operate the water sensor.

However, to run these codes together, it is necessary to make edits which allow them to
be compatible.
Once a working code is obtained, the build process can be ensued. Also located on the
website for some of the sensors are wiring diagrams. These are pictured below in Figures 1-4.

Figure 1: Four sensors wiring diagram


Figure 2: pH probe wiring diagram

Figure 3: Dissolved Oxygen probe wiring diagram


Figure 4: Conductivity probe wiring diagram

Using the above wiring diagrams, a complete unit in which all four sensors are
attached can be obtained. It may be helpful, in using the breadboard, to create entire rows
for pins which multiple sensors need to be connected to.

Helpful Tips

During the 2016 construction of this sensor, one prominent issue was the necessity of
an isolator. It is mentioned in the background information for some of these sensors that, if
using in conjunction with one or more other sensors, using an isolator is recommended. This
helps with data interference between probes as well as mitigating the possibility of “burning
out” one or more of the probes. We chose not to use one. As a result, the pH probe data chip
did, in fact, break, and we needed to purchase a new one. Using an isolator, or something of
the like, may be useful in the next construction.

This is a trial and error process just like anything else. We began by separately wiring
and testing each probe to ensure that: (a) they worked properly and (b) we could correctly
wire and operate the code. There will be a need to troubleshoot as you go!

Cost
Since we didn’t create our own device, the cost was a little bit higher than expected because
we had to buy the arduino and the different sensors. These sensors are expensive but they
are very important in the project . Colombia team created their own device and they plug the
different sensors, we used arduino based sensor. We believe that the cost of the sensor was
fair, and comparing to other sensors in the market that make the same thing as our, this
sensor is cheap.
Future Applications
Some possibilities for the future of this water sensor:
-testing and increasing accuracy
-integrating other testing parameters (what else, besides the four sensors
included, would be helpful in analyzing water quality?)

Compact Overview of Process

Process:
• Order materials
• Do some research to understand how the sensors work, what the goal is, how to get
there
• Gain familiarity with Arduino programming
• Test sensors:
-Try to wire each sensor individually
-Ascertain that they are working properly and that the code will run
-If possible, test them using simple methods such as placing in cold water or a warm
area (if applicable) to see if they pick up different readings
• Compile code

Materials:
● Arduino UNO
● Ph sensor with circuit
● Dissolved oxygen sensor with circuit
● Conductivity sensor
● Temperature sensor
● BNC Connector
● GPS receiver (optional)
● Cables
● Computer
Sensors:

Ph Sensor

A pH (potential of Hydrogen) probe measures the hydrogen ion activity in a liquid.the PH


sensor has a specific form of how to read the pH, at the tip of a pH probe is a glass
membrane. This glass membrane permits hydrogen ions from the liquid being measured to
diffuse into the outer layer of the glass, while larger ions remain in the solution. So, if we
have more hydrogen in the outer layer means that the pH< 7. If there are equal amount of
hydrogens in and out the layer of the glass this mean that the pH=7. If we have more
Hydrogens in the inner layer means that pH>7. When the pH is less than 7 is acidic solution,
PH greater that 7 is basic solution, and pH equal 7 is neutral solution.
pH safety:
Drinking water must have a pH value of 6.5-8.5 to fall within Environmental Protection Agency
(EPA) standards.
High-pH water has a slippery feel, tastes a bit like baking soda, and may leave deposits on
fixtures, according to the EPA website. Low-pH water, on the other hand, may have a bitter or
metallic taste, and may contribute to fixture corrosion.

Conductivity Sensor
Conductivity is the measure of a solution's ability to pass or carry an electric current. Water
conductivity sensors are used in water-quality applications to measure how well a solution
conducts an electrical current. This type of measurement assesses the concentration of ions in
the solution. If we get more ions in the solution,we have a greater conductivity.
Conductivity safety:

Ultra pure water 5.5 · 10-6 S/m


Drinking water 0.005 – 0.05 S/m
Seawater 5 S/m

Electrical conductivity is defined as the ratio between the current density (J) and the electric field
intensity (e) and it is the opposite of the resistivity (r, [W*m]):

s = J/e = 1/r

Water Class Electrical Salt Type of water


conductivity dS/m concentration
mg/l

Brine >45 >45 000 Seawater

Non-saline <0.7 <500 Drinking and irrigation water

Slightly saline 0.7 - 2 500-1500 Irrigation water

Moderately 2 - 10 1500-7000 Primary drainage water and


saline groundwater

Highly saline 10-25 7000-15 000 Secondary drainage water and


groundwater

Very highly 25 - 45 15 000-35 000 Very saline groundwater


saline

Dissolved Oxygen sensor

The dissolved oxygen sensor is used to determine changes in dissolved oxygen levels, one of
the primary indicators of the quality of an aquatic environment. Microbes play a key role in the
loss of oxygen from surface waters. Microbes use oxygen as energy to break down long-
chained organic molecules into simpler, more stable end products such as carbon dioxide,
water, phosphate and nitrate. As microbes break down the organic molecules, oxygen is
removed from the system and must be replaced by exchange at the air-water interface. Each
step above results in consumption of dissolved oxygen. If high levels of organic matter are
present in a water, microbes may use all available oxygen. This does not mean, however, that
the removal of microbes from the ecosystem would solve this problem. Although microbes are
responsible for decreasing levels of dissolved oxygen, they play a very important role in the
aquatic ecosystem. If dead matter is not broken down it will "pile up," much as leaves would if
they were not broken down each year.

1. Aeration of water - Under high pressure relatively large quantities of oxygen dissolve in
water. When the pressure is reduced, a proportionate weight of the gas escapes
(Henry's Law*).
2. Mineral content of water - The amount of minerals in water affects its ability to dissolve
oxygen. Distilled water can absorb more oxygen than well waters with higher mineral
content. Obviously sea water, for this same reason, holds less dissolved oxygen than
fresh water.
3. Excess nutrients lead to a common problem known as an “algal bloom.” This causes an
overproduction of algae, which limits sunlight reaching lower waters, and reduces
dissolved oxygen. Plants cannot live without sunlight, and as a consequence they will
die. The reduction of dissolved oxygen occurs as plants die and decay at the bottom of
the water.

Decreased DO levels may also be indicative of too many bacteria and an excess amount of
biological oxygen demand - BOD (untreated sewage, partially treated sewage, organic
discharges, anoxic discharges) which use up DO.

A third reason for decreased DO may be fertilizer runoff from farm fields and lawns. The same
fertilizer which was meant to make land plants grow better now makes the aquatic plants do the
same. If the weather becomes cloudy for several days, respiring plants will use much of the DO
while failing to photosynthesize. When the increased numbers of aquatic plants eventually die,
they support increasing amounts of bacteria which use large amounts of DO.
http://flintriver.org/blog/wp-content/uploads/2011/04/FR-GREEN-Notebook-041511-Dissolved-
Oxygen.pdf

Temperature Sensor
Temperature Sensor measure the amount of heat energy or even coldness that is generated by
an object or solution , allowing us to detect the temperature producing digital output in the
arduino operator.
Cool water is generally more palatable than warm water, and temperature will have an
impact on the acceptability of a number of other inorganic constituents and chemical
contaminants that may affect taste. High water temperature enhances the growth of
microorganisms and may increase problems related to taste, odour, colour and corrosion.

___________________________________________________________________________

Problems
Possible problems can arise from downloading your code and not realizing minor alterations
it may have made to your arduino. One example is your code changing pins to additional
RX/TX pins in order to fit all 4 sensors on your board. This problem will be obvious if your
code doesn’t run. Another challenge that may occur is frying a chip if you have too much
current running through it. It is also worth mentioning that problems in accuracy may arise in
having so many sensors simultaneously running, which may be remedied with the use of an
inline voltage isolator.
Figure 5: Arduino UNO and Breadboard
Appendix:
pH Code:
//An Arduino UNO was used to test this code.
//This code was last tested 6/2017

#include <SoftwareSerial.h> //we have to include the SoftwareSerial library, or else we can't use it
#define rx 2 //define what pin rx is going to be
#define tx 3 //define what pin tx is going to be

SoftwareSerial myserial(rx, tx); //define how the soft serial port is going to work

String inputstring = ""; //a string to hold incoming data from the PC
String sensorstring = ""; //a string to hold the data from the Atlas Scientific product
boolean input_string_complete = false; //have we received all the data from the PC
boolean sensor_string_complete = false; //have we received all the data from the Atlas Scientific product
float pH; //used to hold a floating point number that is the pH

void setup() { //set up the hardware


Serial.begin(9600); //set baud rate for the hardware serial port_0 to 9600
myserial.begin(9600); //set baud rate for the software serial port to 9600
inputstring.reserve(10); //set aside some bytes for receiving data from the PC
sensorstring.reserve(30); //set aside some bytes for receiving data from Atlas Scientific product
}

void serialEvent() { //if the hardware serial port_0 receives a char


inputstring = Serial.readStringUntil(13); //read the string until we see a <CR>
input_string_complete = true; //set the flag used to tell if we have received a completed string from
the PC
}

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


if (input_string_complete) { //if a string from the PC has been received in its entirety
myserial.print(inputstring); //send that string to the Atlas Scientific product
myserial.print('\r'); //add a <CR> to the end of the string
inputstring = ""; //clear the string
input_string_complete = false; //reset the flag used to tell if we have received a completed string from
the PC
}

if (myserial.available() > 0) { //if we see that the Atlas Scientific product has sent a character
char inchar = (char)myserial.read(); //get the char we just received
sensorstring += inchar; //add the char to the var called sensorstring
if (inchar == '\r') { //if the incoming character is a <CR>
sensor_string_complete = true; //set the flag
}
}

if (sensor_string_complete == true) { //if a string from the Atlas Scientific product has been received in its
entirety
Serial.println(sensorstring); //send that string to the PC's serial monitor
/* //uncomment this section to see how to convert the pH reading from a string to a
float
if (isdigit(sensorstring[0])) { //if the first character in the string is a digit
pH = sensorstring.toFloat(); //convert the string to a floating point number so it can be evaluated by
the Arduino
if (pH >= 7.0) { //if the pH is greater than or equal to 7.0
Serial.println("high"); //print "high" this is demonstrating that the Arduino is evaluating the pH as
a number and not as a string
}
if (pH <= 6.999) { //if the pH is less than or equal to 6.999
Serial.println("low"); //print "low" this is demonstrating that the Arduino is evaluating the pH as
a number and not as a string
}
}
*/
sensorstring = ""; //clear the string
sensor_string_complete = false; //reset the flag used to tell if we have received a completed string from
the Atlas Scientific product
}}
D.O. Code:
//This code was written to be easy to understand.
//Modify this code as you see fit.
//This code will output data to the Arduino serial monitor.
//Type commands into the Arduino serial monitor to control the D.O. circuit.
//This code was written in the Arduino 1.8.3 IDE
//An Arduino UNO was used to test this code.
//This code was last tested 6/2017

#include <SoftwareSerial.h> //we have to include the SoftwareSerial library, or


else we can't use it
#define rx 4 //define what pin rx is going to be
#define tx 5 //define what pin tx is going to be

SoftwareSerial myserial(rx, tx); //define how the soft serial port is going to work

String inputstring = ""; //a string to hold incoming data from the PC
String sensorstring = ""; //a string to hold the data from the Atlas Scientific
product
boolean input_string_complete = false; //have we received all the data from the PC
boolean sensor_string_complete = false; //have we received all the data from the Atlas
Scientific product
float DO; //used to hold a floating point number that is the DO

void setup() { //set up the hardware


Serial.begin(9600); //set baud rate for the hardware serial port_0 to 9600
myserial.begin(9600); //set baud rate for the software serial port to 9600
inputstring.reserve(10); //set aside some bytes for receiving data from the PC
sensorstring.reserve(30); //set aside some bytes for receiving data from Atlas
Scientific product
}

void serialEvent() { //if the hardware serial port_0 receives a char


inputstring = Serial.readStringUntil(13); //read the string until we see a <CR>
input_string_complete = true; //set the flag used to tell if we have received a
completed string from the PC
}

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

if (input_string_complete){ //if a string from the PC has been received in its


entirety
myserial.print(inputstring); //send that string to the Atlas Scientific product
myserial.print('\r'); //add a <CR> to the end of the string
inputstring = ""; //clear the string
input_string_complete = false; //reset the flag used to tell if we have received a
completed string from the PC
}

if (myserial.available() > 0) { //if we see that the Atlas Scientific product has sent a
character
char inchar = (char)myserial.read(); //get the char we just received
sensorstring += inchar; //add the char to the var called sensorstring
if (inchar == '\r') { //if the incoming character is a <CR>
sensor_string_complete = true; //set the flag
}
}
if (sensor_string_complete== true) { //if a string from the Atlas Scientific product has
been received in its entirety
Serial.println(sensorstring); //send that string to the PC's serial monitor
/* //uncomment this section to see how to convert the ORP
reading from a string to a float
if (isdigit(sensorstring[0])) { //if the first character in the string is a digit
DO = sensorstring.toFloat(); //convert the string to a floating point number so it
can be evaluated by the Arduino
if (DO >= 6.0) { //if the DO is greater than or equal to 6.0
Serial.println("high"); //print "high" this is demonstrating that the Arduino is
evaluating the DO as a number and not as a string
}
if (DO <= 5.99) { //if the DO is less than or equal to 5.99
Serial.println("low"); //print "low" this is demonstrating that the Arduino is
evaluating the DO as a number and not as a string
}
}
*/
sensorstring = ""; //clear the string
sensor_string_complete = false; //reset the flag used to tell if we have received a
completed string from the Atlas Scientific product
}
}
Conductivity Code:
//Analog input, analog output, serial output

// These constants won't change. They're used to give names


// to the pins used:
const int analogInPin = A0; // Analog input pin that the sensor output is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to

int sensorValue = 0; // value read from the sensor


int outputValue = 0; // value output to the PWM (analog out)

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 5000);
// change the analog out value:
analogWrite(analogOutPin, outputValue);

// print the results to the serial monitor:


Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(analogRead(1)* 5.00 / 1024, 2);

// wait 10 milliseconds before the next loop


// for the analog-to-digital converter to settle
// after the last reading:
delay(500);
}
Temperature Code:

int val;
int tempPin = A2;

void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;

Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);

/* uncomment this to get temperature in farenhite


Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();
*/
}

Example Code with GPS and all sensors combined:


#include <Time.h>
#include <TinyGPS++.h>
#include <SD.h>
#include <SoftwareSerial.h>
//TinyGPSPlus library

//Time library

/**************************************************************************/
/*!
Define the pins and make the Software Serial Ports
*/
/**************************************************************************/
#define DOtx 5 //define what Dissolved Oxygen pin tx is going to be
#define DOrx 4 //define what Dissolved Oxygen pin rx is going to be
SoftwareSerial DOserial(DOrx, DOtx); //define how the soft serial port works

#define PHtx 3 //define what PH pin tx is going to be


#define PHrx 2 //define what PH pin rx is going to be
SoftwareSerial PHserial(PHrx, PHtx); //define how the soft serial port works

#define GPStx 7 //define what GPS pin tx is going to be


#define GPSrx 6 //define what GPS pin rx is going to be
TinyGPSPlus gps; //the TinyGPS++ object
SoftwareSerial GPSserial(GPSrx, GPStx); //define how the soft serial port works

#define EC A0 //define what Electrical Conductivity pin rx is going to


be
#define TEMP A2 //define what Temperature pin tx is going to be
/**************************************************************************/
/*!
All the strings to hold sensor data
*/
/**************************************************************************/
String DOsensorstring = ""; //a string to hold the data
String PHsensorstring = ""; //a string to hold the data
String GPSsensorstring_loc = ""; //a string to hold the location data
String GPSsensorstring_date = ""; //a string to hold the date data
String ECsensorstring = ""; //a string to hold the data from the EC product
String TEMPsensorstring = ""; //a string to hold the data from the TEMP product

/**************************************************************************/
/*!
Booleans to confirm if a sensor response is received
*/
/**************************************************************************/
boolean DO_sensor_string_complete = false; //have we received all the data
boolean PH_sensor_string_complete = false; //have we received all the data
boolean GPS_sensor_string_complete = false; //have we received all the data
boolean EC_sensor_string_complete = false; //have we received all the data
boolean TEMP_sensor_string_complete = false; //have we received all the data

/**************************************************************************/
/*!
setup function
begin the serial ports
*/
/**************************************************************************/
void setup() {
Serial.begin(9600);
DOserial.begin(9600);
PHserial.begin(9600);
GPSserial.begin(4800);
SD.begin(10);
}

/**************************************************************************/
/*!
main loop
parse input from serial
send commands to the appropriate sensor
check responses from sensors
*/
/**************************************************************************/
void loop() {
// put your main code here, to run repeatedly:
DOserial.listen();
while (DO_sensor_string_complete == false) {
checkDOinput();
}

PHserial.listen();
while (PH_sensor_string_complete == false) {
checkPHinput();
}

checkECinput();
checkTEMPinput();

GPSserial.listen();
while (GPS_sensor_string_complete == false) {
while (GPSserial.available() > 0) {
if (gps.encode(GPSserial.read())) {
checkGPSinput();
GPS_sensor_string_complete = true;
}
}
}

//only print GEOJSON if we have coordinates


/**************************************************************************/
/*!
All the sensors gave viable response, print GEOJSON

We want things in this format:

{"type":"Feature","geometry":{"type":"Point","coordinates":[<latitude>,<longitude>]},"properti
es":{"timestamp":<value>,"dissolvedOxygen":<value>,"temperature":<value>,"conductivity":<v
alue>,"ph":<value>}}

aka this format:

{"type":"Feature",
"geometry":{"type":"Point","coordinates":[<latitude>,<longitude>]},
"properties":{"timestamp":<value>,
"dissolvedOxygen":<value>,
"temperature":<value>,
"conductivity":<value>,
"ph":<value>}}
*/
/**************************************************************************/

if (GPS_sensor_string_complete == true) {
String output = "{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[";
output += 0;
output += "]},\"properties\":{\"timestamp\":\"";
output += 0;
output += "\"";
if (DO_sensor_string_complete == true) {
output += ",\"dissolvedOxygen\":";
output += DOsensorstring;
}
if (PH_sensor_string_complete == true) {
output += ",\"ph\":";
output += PHsensorstring;
}
if (EC_sensor_string_complete == true) {
output += ",\"conductivity\":";
output += ECsensorstring;
}
if (TEMP_sensor_string_complete == true) {
output += ",\"temperature\":";
output += TEMPsensorstring;
}
output += "}},";
Serial.println(output);
//write to SD card file
File aguaOut;
aguaOut = SD.open("AGUAOUT.TXT", FILE_WRITE);
aguaOut.println(output);
aguaOut.close();

reset();

/**************************************************************************/
/*!
Check to see if there's an input from the dissolved oxygen sensor
process DO sensor response
*/
/**************************************************************************/
void checkDOinput() {
if (DOserial.available() > 0) { //if we see that the Atlas Scientific product has sent a
//character
char inchar = (char)DOserial.read(); //get the char we just received
DOsensorstring += inchar; //add the char to the var called sensorstring
if (inchar == '\r' && DOsensorstring.toFloat() >= 0.0 && DOsensorstring.toFloat() < 101.0 ) {
//if the incoming character is a <CR>
DO_sensor_string_complete = true; //set the flag
}
}
}
/**************************************************************************/
/*!
Check to see if there's an input from the pH sensor
process pH sensor response
*/
/**************************************************************************/
void checkPHinput() {
if (PHserial.available() > 0) { //if we see that the Atlas Scientific product has sent a
//character
char inchar = (char)PHserial.read(); //get the char we just received
PHsensorstring += inchar; //add the char to the var called sensorstring
if (inchar == '\r' && PHsensorstring.toFloat() >= 0.0 && PHsensorstring.toFloat() < 14.1 ) {
//if the incoming character is a <CR>
PH_sensor_string_complete = true; //set the flag
}
}
}

/**************************************************************************/
/*!
Check to see if there's an input from the GPS sensor
Check validity of input
latitude, location
month, day, year
hour, minute, second, centisecond

return zeros for invalid output


*/
/**************************************************************************/
void checkGPSinput() {
GPSsensorstring_loc = random(-90, 90);
//GPSsensorstring_loc = gps.location.lat();
GPSsensorstring_loc += ",";
//GPSsensorstring_loc += gps.location.lng();
GPSsensorstring_loc += random(-180, 180);

if (gps.date.value() == 0) {
GPSsensorstring_date = month();
GPSsensorstring_date += day();
GPSsensorstring_date += year();
GPSsensorstring_date += " ";
GPSsensorstring_date += hour()-5;
GPSsensorstring_date += minute();
GPSsensorstring_date += second();
}
else {
GPSsensorstring_date = gps.date.value();
GPSsensorstring_date += " ";
GPSsensorstring_date += gps.time.value();
}
}

/**************************************************************************/
/*!
Get raw electrical conductivity from EC sensor
Nothing really to "check"
*/
/**************************************************************************/
void checkECinput() {
ECsensorstring = analogRead(EC);
if (ECsensorstring != "" && ECsensorstring.toFloat() >= 0.0 && ECsensorstring.toFloat() <
52000.0 ) {
EC_sensor_string_complete = true;
}
}

/**************************************************************************/
/*!
Get analogue temperature from TEMP sensor
Nothing really to "check"
*/
/**************************************************************************/
void checkTEMPinput() {
TEMPsensorstring = analogRead(TEMP);
if (TEMPsensorstring != "" && TEMPsensorstring.toFloat() <= 101.0 &&
TEMPsensorstring.toFloat() >= 0.0) {
TEMP_sensor_string_complete = true;
}
}

/**************************************************************************/
/*!
Reset values to original
*/
/**************************************************************************/
void reset() {
DOsensorstring = ""; //a string to hold the data from the DO Atlas Scientific
product
PHsensorstring = ""; //a string to hold the data from the PH Atlas Scientific
//product
GPSsensorstring_loc = ""; //a string to hold the location data from the GPS
GPSsensorstring_date = ""; //a string to hold the date data from the GPS
ECsensorstring = ""; //a string to hold the data from the EC product
TEMPsensorstring = ""; //a string to hold the data from the TEMP

DO_sensor_string_complete = false; //have we received all the data from the DO Atlas
//Scientific product
PH_sensor_string_complete = false; //have we received all the data from the PH Atlas
//Scientific product
GPS_sensor_string_complete = false; //have we received all the data from the GPS
EC_sensor_string_complete = false; //have we received all the data from the EC
TEMP_sensor_string_complete = false; //have we received all the data from the TEMP
}

Vous aimerez peut-être aussi