is it could be that my arduino IDE is wrongly setting?
Serial Monitor certainly needs to be 115200.
Try reflashing the sketch again.
Which IDE version are you using? I have 1.8.8.
same here 1.8.8
In the IDE under tools set erase flash to âAll Flash Contentsâ and flash a blank sketch. Then change the settings back to erase âOnly Sketchâ and flash my latest sketch again.
Good at least the sketch is âworkingâ. You need to check the DHT11 etc.
i checked all my sensor and they working using DHTtester code, i wonder what would seem the problem
should i change my sensor? or my nodemcu?
You shouldnât have to change either. I think without Blynk your DHTtester sketch runs OK.
At the moment I canât work out why adding Blynk is a problem.
Do any Blynkers have a DHT11 that they can test a sketch with?
iam planning to change the dht11 to dht22
Sounds to me like thereâs some newbie mistake happening here.
Iâm reading this on an iPhone (sat in a very nice, and hot, beach bar in Thailand by the way ) so following the ins-and-outs of the thread is tricky. Has the OP posted his DHT test code, and does it use the same DHT pins, library etc as is being used in the other code?
Also, if this is lashed-up on a breadboard then thereâs every chance that there are some dodgy connections in there somewhere.
A more forensic approach to the fault-finding process would no doubt reveal the problem, but thatâs not really possible with the OPâs obvious lack of experience and language issues.
Pete.
Yes iam actually very fresh newbie in programming . Iam sure the connection is right. Btw iam not using breadboard just straight jumper wire connection. I already download the library for blynk and the dht sensor. What do you mean that library being used in another code?
A freezing 8 degrees here in the Eastern med.
Yes we have the DHTtester sketch and we are using the same pins when we add Blynk.
Still warmer than Blighty though.
Currently 31° and Factor 50 here!
Pete.
After changing all the jumper wire to new one and i using below code , it is functioning correctly! Unfortunately the serial monitor still showing " Failed to read from DHT sensor".
Iam planning to put LED widget as notification when the relay module is on and Button widget for manually operate the relay.
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxx";
char pass[] = "xxx";
#define DHTPIN 0 // D3
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
float setpoint = 0;
bool relaystatuschanged = false;
const int relayPin = 5; // D1;
BLYNK_WRITE(V0)// slider widget
{
setpoint = param.asFloat();
relaystatuschanged = true;
}
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if ((isnan(h)) || (isnan(t))) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, t);
Blynk.virtualWrite(V6, h);
if((setpoint < t) && (relaystatuschanged == true))
{
digitalWrite(relayPin, 0); // assuming relay is active HIGH
relaystatuschanged = false;
}
if((setpoint > t) && (relaystatuschanged == true))
{
digitalWrite(relayPin, 1); // assuming relay is active HIGH
relaystatuschanged = false;
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
dht.begin();
pinMode(relayPin, OUTPUT);
// Setup a function to be called every second
timer.setInterval(5000L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}```
Can you describe what you mean by this as I find it hard to believe it is anything like âworkingâ if the DHT is failing to read a temperature.