unwanted data whw sending readings to thingspeak

Mckenzie Gibson on 10 Nov 2023
Latest activity Reply by Christopher Stapels on 11 Nov 2023

when I examine the data stream on an arduino ide I get a lot of "stuff" which I dont understand.
1 what does it mean?
2 how do I prevent it?
Christopher Stapels
Christopher Stapels on 10 Nov 2023
Is the problem that unwanted data shows up in your channel?
The only think I see in what you shared that seems ThingSpoeak related is this line:
ThingSpeak.setField(n+2, soilMoistureValue);
but that line doesnt write any data to ThingSpeak without the .writeFields command.
Tell us more about your hardware, and show the relevant parts of your code that interact with ThingSpeak. Then show us what you are observing (I think you have that here) then tell us what you would like to see.
Mckenzie Gibson
Mckenzie Gibson on 11 Nov 2023
Thanks for replying I hope this is what you asked for:-
soilMoistureValue = analogRead(SensorPin);
....
ThingSpeak.setField(n+1, ssoilMoistureValue);
int y = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
if (y == 200) {
Serial.println("Channel update successful.");
} else {
Serial.println("Problem updating channel. HTTP error code " + String(y));
}
Christopher Stapels
Christopher Stapels on 11 Nov 2023
Thats definitely more helpful, and looks fine except im not sure what the value of 'n' is in this context.
But back to the problem. My understanding is that you dont like the information you are seeing on the serial monitor. I assume the data is getting to the ThingSpeak channel exactly as you wish it to. That said, im not really sure why this is a problem, but it could make the serial monitor outpust slightly harder to view.
I cant imagine anything else about the ThingSpeak library that would give you those outputs on the serial monitor. Can you tell us anything more about your hardware? Is it an Arduino Uni with wifi or an ESP32 or something else?
Mckenzie Gibson
Mckenzie Gibson on 10 Nov 2023
I should have added an example
08:34:18.136 -> :wr 1 0
08:34:18.136 -> :wrc 1 1 0
08:34:18.136 -> :wr 2 0
08:34:18.136 -> :wrc 2 2 0
08:34:18.136 -> :wr 14 0
08:34:18.136 -> :wrc 14 14 0
08:34:18.263 -> :ack 23
08:34:18.357 -> :ack 201
08:34:18.404 -> :rn 308
08:34:18.404 -> :c0 1, 308
08:34:18.404 -> :close
08:34:18.404 -> Channel update successful.
08:34:18.404 -> ThingSpeak.setField(n+2, soilMoistureValue); 273
08:34:18.404 -> 2 soilmoisturepercent = 142%

Tags

No tags entered yet.