Spreadsheet data going wonky

Good Morning,

The backstory on my project is that I'm trying to build a hydroponic garden and would like to have my sensor data posted to a spreadsheet at regular intervals.

The first challenge I ran into was that the TDS sensor I had picked up didn't want to work when installed on the NodeMCU 1.0 (ESP8266) I wanted to use. As a workaround I connected the TDS sensor to an Arduino Uno (that can read the sensor without issue). The Uno is Serial connected to the NodeMCU, in order to upload the data to the spreadsheet.

I've noticed a trend where the data will upload to the spreadsheet normally for about 20 rows and then it is like a buffer gives out or something, and instead of getting results like ###.## they start skewing, and the decimal starts roaming.

181.43 ppm
183.15 ppm
183.15 ppm
181.43 ppm
81.431 ppm
.43181 ppm
3181.4 ppm
81.431 ppm
.15181 ppm
3181.4 ppm
etc

Looking at the Serial Monitors:
On the NodeMCU, the tdsTransfer value is showing the same skewed values (above) that are being posted to the spreadsheet, however when I look at the Arduino Uno's tdsTransfer data, it is still posting correctly formatted data. (###.##)

(This is why I think the problem is with the NodeMCU's code, and not with the Uno)

Below is the sketch that I'm using for the NodeMCU. ( I'm repurposing a tutorial that I found for posting Temperature and Humidity data to a google sheet)

#include <ESP8266WiFi.h>
#include "HTTPSRedirect.h"
#include "DebugMacros.h"


int h ;                                                        //int will ned to change to float for mustard? dstTransfer
int t ;                                                        //int will ned to change to float for mustard?
char tdsTransfer[7];                                           // 6+1 characters reserved for tdsTransfer

String sheetHumid = "";
String sheetTemp = "";



const char* ssid = "NETWORK";                //replace with our wifi ssid
const char* password = "PASSWORD";         //replace with your wifi password

const char* host = "script.google.com";
const char *GScriptId = "SCRIPT"; // Replace with your own google script id
const int httpsPort = 443; //the https port is same

// echo | openssl s_client -connect script.google.com:443 |& openssl x509 -fingerprint -noout
const char* fingerprint = "";

//const uint8_t fingerprint[20] = {};

String url = String("/macros/s/") + GScriptId + "/exec?value=Temperature";  // Write Teperature to Google Spreadsheet at cell A1
// Fetch Google Calendar events for 1 week ahead
String url2 = String("/macros/s/") + GScriptId + "/exec?cal";  // Write to Cell A continuosly

//replace with sheet name not with spreadsheet file name taken from google
String payload_base =  "{\"command\": \"appendRow\", \
                    \"sheet_name\": \"Data\", \
                       \"values\": ";
String payload = "";

HTTPSRedirect* client = nullptr;

// used to store the values of free stack and heap before the HTTPSRedirect object is instantiated
// so that they can be written to Google sheets upon instantiation

void setup() {
  delay(1000);
  Serial.begin(9600);
  Serial.println();
  Serial.print("Connecting to wifi: ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  // Use HTTPSRedirect class to create a new TLS connection
  client = new HTTPSRedirect(httpsPort);
  client->setInsecure();
  client->setPrintResponseBody(true);
  client->setContentTypeHeader("application/json");
  Serial.print("Connecting to ");
  Serial.println(host);          //try to connect with "script.google.com"

  // Try to connect for a maximum of 5 times then exit
  bool flag = false;
  for (int i = 0; i < 5; i++) {
    int retval = client->connect(host, httpsPort);
    if (retval == 1) {
      flag = true;
      break;
    }
    else
      Serial.println("Connection failed. Retrying...");
  }

  if (!flag) {
    Serial.print("Could not connect to server: ");
    Serial.println(host);
    Serial.println("Exiting...");
    return;
  }
// Finish setup() function in 1s since it will fire watchdog timer and will reset the chip.
//So avoid too many requests in setup()

  Serial.println("\nWrite into cell 'A1'");
  Serial.println("------>");
  // fetch spreadsheet data
  client->GET(url, host);
  
  Serial.println("\nGET: Fetch Google Calendar Data:");
  Serial.println("------>");
  // fetch spreadsheet data
  client->GET(url2, host);

 Serial.println("\nStart Sending Sensor Data to Google Spreadsheet");

  
  // delete HTTPSRedirect object
  delete client;
  client = nullptr;
}

void loop() {


  Serial.readBytes (tdsTransfer,6);     // read first 6 bytes

  h = 123456 ;                                              // Reading temperature or humidity takes about 250 milliseconds!
  t = 999999 ;                                           // Read temperature as Celsius (the default)
  if (isnan(h) || isnan(t)) {                                                // Check if any reads failed and exit early (to try again).
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }

//*-* This is where the data is put together
// *-* for upload to spreadsheet
  Serial.print("Humidity: ");  Serial.print(h);
  sheetHumid = String(h) + String("%");                                         //convert integer humidity to string humidity
  Serial.print("%  TDS: ");  Serial.print(tdsTransfer);  Serial.println(" uploaded ");
  sheetTemp = String(tdsTransfer) + String(" ppm");

  static int error_count = 0;
  static int connect_count = 0;
  const unsigned int MAX_CONNECT = 20;
  static bool flag = false;

  payload = payload_base + "\"" + sheetTemp + "," + sheetHumid + "\"}";

  if (!flag) {
    client = new HTTPSRedirect(httpsPort);
    client->setInsecure();
    flag = true;
    client->setPrintResponseBody(true);
    client->setContentTypeHeader("application/json");
  }

  if (client != nullptr) {
    if (!client->connected()) {
      client->connect(host, httpsPort);
      client->POST(url2, host, payload, false);
      Serial.print("Sent : ");  Serial.println("Temp and Humid");
    }
  }
  else {
    DPRINTLN("Error creating client object!");
    error_count = 5;
  }

  if (connect_count > MAX_CONNECT) {
    connect_count = 0;
    flag = false;
    delete client;
    return;
  }

//  Serial.println("GET Data from cell 'A1':");
//  if (client->GET(url3, host)) {
//    ++connect_count;
//  }
//  else {
//    ++error_count;
//    DPRINT("Error-count while connecting: ");
//    DPRINTLN(error_count);
//  }

  Serial.println("POST or SEND Sensor data to Google Spreadsheet:");
  if (client->POST(url2, host, payload)) {
    ;
  }
  else {
    ++error_count;
    DPRINT("Error-count while connecting: ");
    DPRINTLN(error_count);
  }

  if (error_count > 3) {
    Serial.println("Halting processor...");
    delete client;
    client = nullptr;
    Serial.printf("Final free heap: %u\n", ESP.getFreeHeap());
    Serial.printf("Final stack: %u\n", ESP.getFreeContStack());
    Serial.flush();
    ESP.deepSleep(0);
  }
  
  delay(3000);    // keep delay of minimum 2 seconds for google sheet
}

Any and All assistance will be greatly appreciated!
Many Thanks in Advance!
DtB

A) you seem to be working with some fixed values of h and t. Why is that ?

B) you have a delay(3000) in the loop which may interfere with the serial connection from the Uno.
If you want to send to google only every 3 seconds or so, wrap the sending part in something like:

  static uint32_t lastSendAtMs = millis() ;
  If ( millis() - lastSendAtMs > 3000 ) { // 3 seconds 
     lastSendAtMs = millis() ;
 
   // your sending code here

  }

Post also the Uno code.

1 Like

Thank you very much for the prompt reply! :smiley:

A) The original code was using a DHT sensor (which I do not have) to populate the 'h' and 't' values.
I used those numbers as easy to recognize default values, when I first tested the code that uploads the data to the spreadsheet, so I could see where and how it populates.

B) I tried your suggestion. Unfortunately, I am still having the same problem.
(snip from Serial monitor below)

11:52:34.593 -> TDS: 183.15 uploaded
11:52:34.593 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
11:52:37.629 -> Success

11:52:40.650 -> TDS: 183.15 uploaded
11:52:40.650 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
11:52:43.969 -> Success

11:52:46.984 -> TDS: .43181 uploaded
11:52:46.984 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
11:52:49.593 -> Success

11:52:52.622 -> TDS: 5181.4 uploaded
11:52:52.622 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
11:52:55.329 -> Success

Here is the sketch I'm using for the Uno.


#include <EEPROM.h>
#include "GravityTDS.h"

#define TdsSensorPin A0
GravityTDS gravityTds;

float temperature = 25, tdsValue = 0;
//  float tdsTransfer;      // Created for TDS data hand-off
char tdsTransfer [20];      // Buffer big enough for 10 characters

void setup()
{
  Serial.begin(9600);
  gravityTds.setPin(TdsSensorPin);
  gravityTds.setAref(5.0);                //reference voltage on ADC, default 5.0V on Arduino UNO
  gravityTds.setAdcRange(1024);           //1024 for 10bit ADC;4096 for 12bit ADC
  gravityTds.begin();                     //initialization
}

void loop()
{
  //temperature = readTemperature();        //add your temperature sensor and read it
  gravityTds.setTemperature(temperature);   // set the temperature and execute temperature compensation
  gravityTds.update();                      //sample and calculate
  tdsValue = gravityTds.getTdsValue();      // then get the value
dtostrf  (tdsValue, 5, 2, tdsTransfer);     // Leave room for too large numbers!

// Serial.println(tdsTransfer) ;            // Serial.Print and Serial.write glitch when both used for same variable
 Serial.write (tdsTransfer );             // Serial.Print and Serial.write glitch when both used for same variable
//  Serial.println ("") ;
  delay(1000);   
}

Thanks again for taking the time to help! :smiley:
DtB

OK. Please now show the updated ESP8266 sketch.

1 Like

Thank you very much! :smiley:
Here is the updated sketch

// Copied from spreadsheetV2BKP as fresh copy to troubleshoot tdsTransfer glitches.


#include <ESP8266WiFi.h>
#include "HTTPSRedirect.h"
#include "DebugMacros.h"


int h ;                                                        //int will ned to change to float for mustard? dstTransfer
int t ;                                                        //int will ned to change to float for mustard?
char tdsTransfer[7];                                           // 6+1 characters reserved for tdsTransfer

String sheetHumid = "";
String sheetTemp = "";



const char* ssid = "NETWORK";                //replace with our wifi ssid
const char* password = "PASSWORD";         //replace with your wifi password

const char* host = "script.google.com";
const char *GScriptId = "GOOGLE"; // Replace with your own google script id
const int httpsPort = 443; //the https port is same
// echo | openssl s_client -connect script.google.com:443 |& openssl x509 -fingerprint -noout
const char* fingerprint = "";

//const uint8_t fingerprint[20] = {};

String url = String("/macros/s/") + GScriptId + "/exec?value=Temperature";  // Write Teperature to Google Spreadsheet at cell A1
// Fetch Google Calendar events for 1 week ahead
String url2 = String("/macros/s/") + GScriptId + "/exec?cal";  // Write to Cell A continuosly

//replace with sheet name not with spreadsheet file name taken from google
String payload_base =  "{\"command\": \"appendRow\", \
                    \"sheet_name\": \"Data\", \
                       \"values\": ";
String payload = "";

HTTPSRedirect* client = nullptr;

// used to store the values of free stack and heap before the HTTPSRedirect object is instantiated
// so that they can be written to Google sheets upon instantiation

void setup() {
  delay(1000);
  Serial.begin(9600);
  Serial.println();
  Serial.print("Connecting to wifi: ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  // Use HTTPSRedirect class to create a new TLS connection
  client = new HTTPSRedirect(httpsPort);
  client->setInsecure();
  client->setPrintResponseBody(true);
  client->setContentTypeHeader("application/json");
  Serial.print("Connecting to ");
  Serial.println(host);          //try to connect with "script.google.com"

  // Try to connect for a maximum of 5 times then exit
  bool flag = false;
  for (int i = 0; i < 5; i++) {
    int retval = client->connect(host, httpsPort);
    if (retval == 1) {
      flag = true;
      break;
    }
    else
      Serial.println("Connection failed. Retrying...");
  }

  if (!flag) {
    Serial.print("Could not connect to server: ");
    Serial.println(host);
    Serial.println("Exiting...");
    return;
  }
// Finish setup() function in 1s since it will fire watchdog timer and will reset the chip.
//So avoid too many requests in setup()

  Serial.println("\nWrite into cell 'A1'");
  Serial.println("------>");
  // fetch spreadsheet data
  client->GET(url, host);
  
  Serial.println("\nGET: Fetch Google Calendar Data:");
  Serial.println("------>");
  // fetch spreadsheet data
  client->GET(url2, host);

 Serial.println("\nStart Sending Sensor Data to Google Spreadsheet");

  
  // delete HTTPSRedirect object
  delete client;
  client = nullptr;
}

void loop() {

  static uint32_t lastSendAtMs = millis() ;
  if ( millis() - lastSendAtMs > 3000 ) { // 3 seconds 
     lastSendAtMs = millis() ;

// *-*
  static int error_count = 0;
  static int connect_count = 0;
  const unsigned int MAX_CONNECT = 20;
  static bool flag = false;

  h = 123456 ;                                              // Reading temperature or humidity takes about 250 milliseconds!
  t = 999999 ;                                           // Read temperature as Celsius (the default)
  if (isnan(h) || isnan(t)) {                                                // Check if any reads failed and exit early (to try again).
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }



//*-* This is where the data is put together
// *-* for upload to spreadsheet
  Serial.readBytes (tdsTransfer,6);     // read first 6 bytes
    Serial.flush();
  Serial.print("TDS: ");  Serial.print(tdsTransfer);   Serial.flush(); Serial.println(" uploaded ");
  Serial.print("Holder: ");  Serial.print(h);
  sheetHumid = String(h) + String("%");                                         //convert integer humidity to string humidity
  sheetTemp = String(tdsTransfer) + String(" ppm");





  payload = payload_base + "\"" + sheetTemp + "," + sheetHumid + "\"}";

  if (!flag) {
    client = new HTTPSRedirect(httpsPort);
    client->setInsecure();
    flag = true;
    client->setPrintResponseBody(true);
    client->setContentTypeHeader("application/json");
  }

  if (client != nullptr) {
    if (!client->connected()) {
      client->connect(host, httpsPort);
      client->POST(url2, host, payload, false);
      Serial.print("Sent : ");  Serial.println("Temp and Humid");
    }
  }
  else {
    DPRINTLN("Error creating client object!");
    error_count = 5;
  }

  if (connect_count > MAX_CONNECT) {
    connect_count = 0;
    flag = false;
    delete client;
    return;
  }

//  Serial.println("GET Data from cell 'A1':");
//  if (client->GET(url3, host)) {
//    ++connect_count;
//  }
//  else {
//    ++error_count;
//    DPRINT("Error-count while connecting: ");
//    DPRINTLN(error_count);
//  }

  Serial.println("POST or SEND Sensor data to Google Spreadsheet:");
  if (client->POST(url2, host, payload)) {
    ;
  }
  else {
    ++error_count;
    DPRINT("Error-count while connecting: ");
    DPRINTLN(error_count);
  }

  if (error_count > 3) {
    Serial.println("Halting processor...");
    delete client;
    client = nullptr;
    Serial.printf("Final free heap: %u\n", ESP.getFreeHeap());
    Serial.printf("Final stack: %u\n", ESP.getFreeContStack());
    Serial.flush();
    ESP.deepSleep(0);
    }
  }
  delay(3000);    // keep delay of minimum 2 seconds for google sheet
}

Did I insert your code in the wrong spot?

DtB

Yes because it also affected the Serial.read operation. Not only that, you left the delay(3000) statement in the code. I've tried to correct it but neither compiled nor tested it.

// Copied from spreadsheetV2BKP as fresh copy to troubleshoot tdsTransfer glitches.


#include <ESP8266WiFi.h>
#include "HTTPSRedirect.h"
#include "DebugMacros.h"


int h ;                                                        //int will ned to change to float for mustard? dstTransfer
int t ;                                                        //int will ned to change to float for mustard?
char tdsTransfer[7];                                           // 6+1 characters reserved for tdsTransfer

String sheetHumid = "";
String sheetTemp = "";



const char* ssid = "NETWORK";                //replace with our wifi ssid
const char* password = "PASSWORD";         //replace with your wifi password

const char* host = "script.google.com";
const char *GScriptId = "GOOGLE"; // Replace with your own google script id
const int httpsPort = 443; //the https port is same
// echo | openssl s_client -connect script.google.com:443 |& openssl x509 -fingerprint -noout
const char* fingerprint = "";

//const uint8_t fingerprint[20] = {};

String url = String("/macros/s/") + GScriptId + "/exec?value=Temperature";  // Write Teperature to Google Spreadsheet at cell A1
// Fetch Google Calendar events for 1 week ahead
String url2 = String("/macros/s/") + GScriptId + "/exec?cal";  // Write to Cell A continuosly

//replace with sheet name not with spreadsheet file name taken from google
String payload_base =  "{\"command\": \"appendRow\", \
                    \"sheet_name\": \"Data\", \
                       \"values\": ";
String payload = "";

HTTPSRedirect* client = nullptr;

// used to store the values of free stack and heap before the HTTPSRedirect object is instantiated
// so that they can be written to Google sheets upon instantiation

void setup() {
  delay(1000);
  Serial.begin(9600);
  Serial.println();
  Serial.print("Connecting to wifi: ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  // Use HTTPSRedirect class to create a new TLS connection
  client = new HTTPSRedirect(httpsPort);
  client->setInsecure();
  client->setPrintResponseBody(true);
  client->setContentTypeHeader("application/json");
  Serial.print("Connecting to ");
  Serial.println(host);          //try to connect with "script.google.com"

  // Try to connect for a maximum of 5 times then exit
  bool flag = false;
  for (int i = 0; i < 5; i++) {
    int retval = client->connect(host, httpsPort);
    if (retval == 1) {
      flag = true;
      break;
    }
    else
      Serial.println("Connection failed. Retrying...");
  }

  if (!flag) {
    Serial.print("Could not connect to server: ");
    Serial.println(host);
    Serial.println("Exiting...");
    return;
  }
  // Finish setup() function in 1s since it will fire watchdog timer and will reset the chip.
  //So avoid too many requests in setup()

  Serial.println("\nWrite into cell 'A1'");
  Serial.println("------>");
  // fetch spreadsheet data
  client->GET(url, host);

  Serial.println("\nGET: Fetch Google Calendar Data:");
  Serial.println("------>");
  // fetch spreadsheet data
  client->GET(url2, host);

  Serial.println("\nStart Sending Sensor Data to Google Spreadsheet");


  // delete HTTPSRedirect object
  delete client;
  client = nullptr;
}

void loop() {

  static uint32_t lastSendAtMs = millis() ;


  // *-*
  static int error_count = 0;
  static int connect_count = 0;
  const unsigned int MAX_CONNECT = 20;
  static bool flag = false;

  h = 123456 ;                                              // Reading temperature or humidity takes about 250 milliseconds!
  t = 999999 ;                                           // Read temperature as Celsius (the default)
  if (isnan(h) || isnan(t)) {                                                // Check if any reads failed and exit early (to try again).
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }



  //*-* This is where the data is put together
  // *-* for upload to spreadsheet
  Serial.readBytes (tdsTransfer, 6);    // read first 6 bytes
  Serial.flush();
  Serial.print("TDS: ");  Serial.print(tdsTransfer);   Serial.flush(); Serial.println(" uploaded ");
  Serial.print("Holder: ");  Serial.print(h);
  sheetHumid = String(h) + String("%");                                         //convert integer humidity to string humidity
  sheetTemp = String(tdsTransfer) + String(" ppm");


  if ( millis() - lastSendAtMs > 3000 ) { // 3 seconds
    lastSendAtMs = millis() ;


    payload = payload_base + "\"" + sheetTemp + "," + sheetHumid + "\"}";

    if (!flag) {
      client = new HTTPSRedirect(httpsPort);
      client->setInsecure();
      flag = true;
      client->setPrintResponseBody(true);
      client->setContentTypeHeader("application/json");
    }

    if (client != nullptr) {
      if (!client->connected()) {
        client->connect(host, httpsPort);
        client->POST(url2, host, payload, false);
        Serial.print("Sent : ");  Serial.println("Temp and Humid");
      }
    }
    else {
      DPRINTLN("Error creating client object!");
      error_count = 5;
    }

    if (connect_count > MAX_CONNECT) {
      connect_count = 0;
      flag = false;
      delete client;
      return;
    }

    //  Serial.println("GET Data from cell 'A1':");
    //  if (client->GET(url3, host)) {
    //    ++connect_count;
    //  }
    //  else {
    //    ++error_count;
    //    DPRINT("Error-count while connecting: ");
    //    DPRINTLN(error_count);
    //  }

    Serial.println("POST or SEND Sensor data to Google Spreadsheet:");
    if (client->POST(url2, host, payload)) {
      ;
    }
    else {
      ++error_count;
      DPRINT("Error-count while connecting: ");
      DPRINTLN(error_count);
    }

    if (error_count > 3) {
      Serial.println("Halting processor...");
      delete client;
      client = nullptr;
      Serial.printf("Final free heap: %u\n", ESP.getFreeHeap());
      Serial.printf("Final stack: %u\n", ESP.getFreeContStack());
      Serial.flush();
      ESP.deepSleep(0);
    }
  }
  // delay(3000);    // keep delay of minimum 2 seconds for google sheet
}
1 Like

:smiley: You are AMAZING, my friend!
I'm over 400 lines uploaded to the spreadsheet and all of the data looks great! :smiley:
Can I buy you a cup of coffee or something as a token of my thanks? :smiley:

I've noticed that something new has started to happen on the Serial Monitor.
I want to preface this by saying there doesn't seem to be any problems or delays in uploading the data to google. I don't have a stopwatch handy, but it seems to be going in every 3 seconds by the count in my head. :smiley:
Previously there was 1 "TDS" message and 1 "Holder" message prior to each "Success". Since updating, the number of messages prior to the "Success" seems to fluctuate. (see below) Any idea why that would have started happening?

13:45:45.711 -> TDS: 167.61 uploaded
13:45:45.761 -> Holder: 123456TDS: 167.61 uploaded
13:45:45.806 -> Holder: 123456TDS: 167.61 uploaded
13:45:45.898 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
13:45:49.309 -> Success

13:45:49.309 -> TDS: 165.88 uploaded
13:45:49.356 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
13:45:51.861 -> Success

13:45:51.861 -> TDS: 165.88 uploaded
13:45:51.909 -> Holder: 123456TDS: 167.61 uploaded
13:45:51.909 -> Holder: 123456TDS: 167.61 uploaded
13:45:51.953 -> Holder: 123456TDS: 167.61 uploaded
13:45:52.000 -> Holder: 123456TDS: 167.61 uploaded
13:45:52.000 -> Holder: 123456TDS: 165.88 uploaded
13:45:52.934 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
13:45:55.809 -> Success

13:45:55.809 -> TDS: 167.61 uploaded
13:45:55.809 -> Holder: 123456TDS: 167.61 uploaded
13:45:55.856 -> Holder: 123456TDS: 165.88 uploaded
13:45:55.949 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
13:45:58.229 -> Success

13:45:58.229 -> TDS: 167.61 uploaded
13:45:58.276 -> Holder: 123456TDS: 167.61 uploaded
13:45:58.276 -> Holder: 123456TDS: 167.61 uploaded
13:45:58.932 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
13:46:01.217 -> Success

13:46:01.217 -> TDS: 167.61 uploaded
13:46:01.264 -> Holder: 123456TDS: 167.61 uploaded
13:46:01.264 -> Holder: 123456TDS: 165.88 uploaded
13:46:01.920 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
13:46:04.767 -> Success

13:46:04.767 -> TDS: 167.61 uploaded
13:46:04.812 -> Holder: 123456TDS: 167.61 uploaded
13:46:04.812 -> Holder: 123456TDS: 167.61 uploaded
13:46:04.951 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
13:46:09.248 -> Success

13:46:09.248 -> TDS: 167.61 uploaded
13:46:09.293 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
13:46:11.999 -> Success

13:46:11.999 -> TDS: 167.61 uploaded
13:46:11.999 -> Holder: 123456TDS: 167.61 uploaded
13:46:12.045 -> Holder: 123456TDS: 165.88 uploaded
13:46:12.090 -> Holder: 123456TDS: 167.61 uploaded
13:46:12.090 -> Holder: 123456TDS: 167.61 uploaded
13:46:12.136 -> Holder: 123456TDS: 167.61 uploaded
13:46:12.185 -> Holder: 123456TDS: 167.61 uploaded
13:46:12.975 -> Holder: 123456POST or SEND Sensor data to Google Spreadsheet:
13:46:15.445 -> Success

DtB

OK. Thanks for that. Just hammer away at the "Likes" icon on the posts you found useful. That way I get a few "karma" points.

Your problem is now that the Uno transmits data every 1 second and your ESP8266 can handle it for transmission only once every 3 seconds. Increase the transmission intverval on the Uno to every 3500 ms (or more) and it should be OK.

Alternatively, you could move the following two print statement groups inside the inside the if statement which executes every 3 seconds:

Serial.print("TDS: ");  Serial.print(tdsTransfer);   Serial.flush(); Serial.println(" uploaded ");
Serial.print("Holder: ");  Serial.print(h);
1 Like

Thank you for the explanation, and ALL the help. :smiley:
I moved the print code as you suggested and it working like a dream!

Thank You so much! :coffee:
DtB

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.