     received_from_sensor = ecSerial.readBytesUntil(13, EC_data, 48);
     EC_data[received_from_sensor] = 0; // Null terminate the data by setting the value after the final character to 0.
 
-  }
-
-  if ((EC_data[0] >= 48) && (EC_data[0] <= 57)) { // Parse data, if EC_data begins with a digit, not a letter (testing ASCII values).
-
-    parse_data();
-
-  }
-
-  //output readings to serial monitor. A whole mess of if/else statements to keep numbers formatted correctly
-  Serial.print(now.year(), DEC);
-  Serial.print('/');
-
-  if (now.month() < 10) {
-
-    Serial.print(0);
-    Serial.print(now.month(), DEC);
-
-  }
-
-  else {
-
-    Serial.print(now.month(), DEC);
-
-  }
-
-  Serial.print('/');
-
-  if (now.day() < 10) {
-
-    Serial.print(0);
-    Serial.print(now.day(), DEC);
-
-  }
-
-  else {
-
-    Serial.print(now.day(), DEC);
-
-  }
-
-  Serial.print("  ");
-
-  if (now.hour() < 10) {
-
-    Serial.print(0);
-    Serial.print(now.hour(), DEC);
-
-  }
-
-  else {
-
-    Serial.print(now.hour(), DEC);
-
-  }
-
-  Serial.print(':');
-
-  if (now.minute() < 10) {
-
-    Serial.print(0);
-    Serial.print(now.minute(), DEC);
-
-  }
-
-  else {
-
-    Serial.print(now.minute(), DEC);
-
-  }
-
-  Serial.print(':');
-
-  if (now.second() < 10) {
-
-    Serial.print(0);
-    Serial.print(now.second(), DEC);
-
-  }
-
-  else {
-
-    Serial.print(now.second(), DEC);
-
-  }
-
-  Serial.print("  ");
-  Serial.print(pressure_abs);
-  Serial.print("  ");
-  Serial.print(tempA);
-  Serial.print("  ");
-  Serial.print(tempB);
-  Serial.print("  ");
-  Serial.print(tempC);
-  Serial.print("  ");
-  Serial.println(EC);
-
-  //output readings to data file. A whole mess of if/else statements to keep numbers formatted correctly
-  File dataFile = SD.open("datalog.txt", FILE_WRITE);
-
-  if (dataFile) {
-
-    dataFile.print(now.year(), DEC);
-    dataFile.print('/');
+    if ((EC_data[0] >= 48) && (EC_data[0] <= 57)) { // Parse data, if EC_data begins with a digit, not a letter (testing ASCII values).
+
+      parse_data();
+
+    }
+
+    // Read the temperature sensors.
+    if (millis() - tempADelayStartTime > requiredMesurementDelay) { // wait for conversion to happen before attempting to read temp probe A's value;
+      tempA = sensors.getTempCByIndex(0);
+      sensors.requestTemperaturesByIndex(0);  // request temp sensor A start mesuring so it can be read on the following loop (if enough time elapses).
+      tempADelayStartTime = millis();  // mark when we made the request to make sure we wait long enough before reading it.
+    }
+
+    if (millis() - tempBDelayStartTime > requiredMesurementDelay) { // wait for conversion to happen before attempting to read temp probe B's value;
+      tempB = sensors.getTempCByIndex(1);
+      sensors.requestTemperaturesByIndex(1);  // request temp sensor B start mesuring so it can be read on the following loop (if enough time elapses).
+      tempBDelayStartTime = millis();  // mark when we made the request to make sure we wait long enough before reading it.
+    }
+
+
+    if (millis() - tempCDelayStartTime > requiredMesurementDelay) { // wait for conversion to happen before attempting to read temp probe C's value;
+      tempC = sensors.getTempCByIndex(2);
+      sensors.requestTemperaturesByIndex(2);  // request temp sensor C start mesuring so it can be read on the following loop (if enough time elapses).
+      tempCDelayStartTime = millis(); // mark when we made the request to make sure we wait long enough before reading it.
+    }
+
+    sensor.readSensor(); //read pressure sensor
+    pressure_abs = sensor.pressure();
+
+    DateTime now = rtc.now(); //check RTC
+
+    //output readings to serial monitor. A whole mess of if/else statements to keep numbers formatted correctly
+    Serial.print(now.year(), DEC);
+    Serial.print('/');
 
     if (now.month() < 10) {
 
-      dataFile.print(0);
-      dataFile.print(now.month(), DEC);
-
-    }
-
-    else {
-
-      dataFile.print(now.month(), DEC);
-
-    }
-
-    dataFile.print('/');
+      Serial.print(0);
+      Serial.print(now.month(), DEC);
+
+    }
+
+    else {
+
+      Serial.print(now.month(), DEC);
+
+    }
+
+    Serial.print('/');
 
     if (now.day() < 10) {
 
-      dataFile.print(0);
-      dataFile.print(now.day(), DEC);
-
-    }
-
-    else {
-
-      dataFile.print(now.day(), DEC);
-
-    }
-
-    dataFile.print("  ");
+      Serial.print(0);
+      Serial.print(now.day(), DEC);
+
+    }
+
+    else {
+
+      Serial.print(now.day(), DEC);
+
+    }
+
+    Serial.print("  ");
 
     if (now.hour() < 10) {
 
-      dataFile.print(0);
-      dataFile.print(now.hour(), DEC);
-
-    }
-
-    else {
-
-      dataFile.print(now.hour(), DEC);
-
-    }
-
-    dataFile.print(':');
+      Serial.print(0);
+      Serial.print(now.hour(), DEC);
+
+    }
+
+    else {
+
+      Serial.print(now.hour(), DEC);
+
+    }
+
+    Serial.print(':');
 
     if (now.minute() < 10) {
 
-      dataFile.print(0);
-      dataFile.print(now.minute(), DEC);
-
-    }
-
-    else {
-
-      dataFile.print(now.minute(), DEC);
-
-    }
-
-    dataFile.print(':');
+      Serial.print(0);
+      Serial.print(now.minute(), DEC);
+
+    }
+
+    else {
+
+      Serial.print(now.minute(), DEC);
+
+    }
+
+    Serial.print(':');
 
     if (now.second() < 10) {
 
-      dataFile.print(0);
-      dataFile.print(now.second(), DEC);
-
-    }
-
-    else {
-
-      dataFile.print(now.second(), DEC);
-
-    }
-
-    dataFile.print("  ");
-    dataFile.print(pressure_abs);
-    dataFile.print("  ");
-    dataFile.print(tempA);
-    dataFile.print("  ");
-    dataFile.print(tempB);
-    dataFile.print("  ");
-    dataFile.print(tempC);
-    dataFile.print("  ");
-    dataFile.println(EC);
-    dataFile.close();
-
-  }
-
-  delay(50);
+      Serial.print(0);
+      Serial.print(now.second(), DEC);
+
+    }
+
+    else {
+
+      Serial.print(now.second(), DEC);
+
+    }
+
+    Serial.print("  ");
+    Serial.print(pressure_abs);
+    Serial.print("  ");
+    Serial.print(tempA);
+    Serial.print("  ");
+    Serial.print(tempB);
+    Serial.print("  ");
+    Serial.print(tempC);
+    Serial.print("  ");
+    Serial.println(EC);
+
+    //output readings to data file. A whole mess of if/else statements to keep numbers formatted correctly
+    File dataFile = SD.open("datalog.txt", FILE_WRITE);
+
+    if (dataFile) {
+
+      dataFile.print(now.year(), DEC);
+      dataFile.print('/');
+
+      if (now.month() < 10) {
+
+        dataFile.print(0);
+        dataFile.print(now.month(), DEC);
+
+      }
+
+      else {
+
+        dataFile.print(now.month(), DEC);
+
+      }
+
+      dataFile.print('/');
+
+      if (now.day() < 10) {
+
+        dataFile.print(0);
+        dataFile.print(now.day(), DEC);
+
+      }
+
+      else {
+
+        dataFile.print(now.day(), DEC);
+
+      }
+
+      dataFile.print("  ");
+
+      if (now.hour() < 10) {
+
+        dataFile.print(0);
+        dataFile.print(now.hour(), DEC);
+
+      }
+
+      else {
+
+        dataFile.print(now.hour(), DEC);
+
+      }
+
+      dataFile.print(':');
+
+      if (now.minute() < 10) {
+
+        dataFile.print(0);
+        dataFile.print(now.minute(), DEC);
+
+      }
+
+      else {
+
+        dataFile.print(now.minute(), DEC);
+
+      }
+
+      dataFile.print(':');
+
+      if (now.second() < 10) {
+
+        dataFile.print(0);
+        dataFile.print(now.second(), DEC);
+
+      }
+
+      else {
+
+        dataFile.print(now.second(), DEC);
+
+      }
+
+      dataFile.print("  ");
+      dataFile.print(pressure_abs);
+      dataFile.print("  ");
+      dataFile.print(tempA);
+      dataFile.print("  ");
+      dataFile.print(tempB);
+      dataFile.print("  ");
+      dataFile.print(tempC);
+      dataFile.print("  ");
+      dataFile.println(EC);
+      dataFile.close();
+
+    }
+
+  }
+
+  // Tip: For a slower overall logging frequency, set the EC_SAMPLING_FREQUENCY variable rather than adding a delay (this will avoid the possibility of garbled ec sensor readings)
 
 }
 

byte received_from_sensor = 0; // How many characters have been received.
byte string_received = 0; // Whether it received a string from the EC circuit.

void setup () {

  // comment the following three lines out for final deployment
#ifndef ESP8266
  while (!Serial);   //for Leonardo/Micro/Zero
#endif

  Serial.begin(9600);

  sensor.initializeMS_5803(); // Initialize pressure sensor

  sensors.begin();  // Intialize the temperature sensors.
  sensors.setResolution(TEMP_SENSOR_RESOLUTION);  // Set the resolution (accuracy) of the temperature sensors.
  sensors.requestTemperatures(); // on the first pass request all temperatures in a blocking way to start the variables with true data.
  tempA = sensors.getTempCByIndex(0);
  tempB = sensors.getTempCByIndex(1);
  tempC = sensors.getTempCByIndex(2);
  sensors.setWaitForConversion(false);  // Now tell the Dallas Temperature library to not block this script while it's waiting for the temperature mesurement to happen

  ecSerial.begin(9600); // Set baud rate for conductivity circuit.

  do {

    ecSerial.write('i');  // Tell electrical conductivity board to reply with the board information by sending the 'i' character ...
    ecSerial.write('\r'); // ... Finish the command with the charage return character.
    received_from_sensor = ecSerial.readBytesUntil('\r', EC_data, 30); // Wait for the ec circut to send the data before moving on...
    EC_data[received_from_sensor] = 0; // Null terminate the data by setting the value after the final character to 0.

  } while (EC_data[1] != 'I'); // Keep looping until the ecSerial has sent the board info string (also indicating it has booted up, I think...)

  Serial.print("EC Board Info (Format: ?I,[board type],[Firmware Version]) -> "); Serial.println(EC_data);
  
  delay(10);
  ecSerial.write('C');  // Tell electrical conductivity board to continously ("C") transmit mesurements ...
  ecSerial.write(',');  //
  ecSerial.print(EC_SAMPLING_FREQUENCY);    // ... every x seconds (here x is the EC_SAMPLING_FREQUENCY variable)
  ecSerial.write('\r'); // Finish the command with the carrage return character. 
  
  received_from_sensor = ecSerial.readBytesUntil('\r', EC_data, 10); // keep reading the reply until the return character is recived (or it gets to be 10 characters long, which shouldn't happen)
  EC_data[received_from_sensor] = 0; // Null terminate the data by setting the value after the final character to 0.
  Serial.print("EC Frequency Set Sucessfully? -> "); Serial.println(EC_data);

}

void loop () {

  //Read electrical conductivity sensor
  if (ecSerial.available() > 0) {
