Hello. I have a problem with reach data to ntc10k temperature sensor on blynk.
I reach some data, but is completely wrong, and is no constant (i reach 30 degrees, a second later -20 degrees, for example)
There is my code. Honestly, I dont know what i do wrong…
Thank you so much for help :)))
#define BLYNK_TEMPLATE_ID "TMPL-3eq93fZ"
#define BLYNK_DEVICE_NAME "test"
#define BLYNK_AUTH_TOKEN "39aYTJHdg5kfgHYamwZL3siPqJl2Nrv_"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Tenda_11EB10";
char pass[] = "faraparola";
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V1, millis() / 1000);
}
void sensorDataSend()
{
int ThermistorPin = 32;
int Vo;
float A = 10000;
float logC, C, T ;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
float c4 = 1.009249522e-03, c5 = 2.378405444e-04, c6 = 2.019202697e-07;
Vo = analogRead(ThermistorPin);
C = A * (1023.0 / (float)Vo - 1.0);
logC = log(C);
T = (1.0 / (c1 + c2*logC + c3*logC*logC*logC));
T = T - 273.15;
Blynk.virtualWrite(V1, T);
}
void setup()
{
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
// Setup a function to be called every second
timer.setInterval(5000L, sensorDataSend);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}