Weather station blynk 2.0

void setup() {
.
.

timer.setInterval(5000L, SensorRead);
.
.

}

void SensorRead() {
SensorValue = analogRead(analogInPin);
  voltage = (((sensorValue * 3.3) / 1024) * 2 + calibration1);//multiply by two as voltage divider network is 100K & 100K Resistor
  Serial.print("Analog Value = ");
  Serial.print(sensorValue);
  Serial.print("\t Output Voltage = ");
  Serial.print(voltage);
}

void loop(){
  Blynk.run();
  Timer.run();
}

ok I have read the article and it is not very clear to me but in short I have to make sure that the void loop is as clean as possible but creating these timers does not help me because this code runs only once due to deep sleep and I need it just a little delay for the multiplexer and deep sleep again I don’t know where I would put Blynk.virtualWrite
and deep sleep but in reality the code worked on its own without problems only the accuracy of the detected voltages which does not depend on blynk I presume

timer.setInterval(30000L, Sleep); \\ adjust as you need



void(Sleep){
 ESP.deepSleep(9e+8);`
}

If you’re using deep sleep then you shouldn’t be using timers, and most of your code should probably be in void setup or BLYNK_CONNECTED, but it’s impossible to advise because you haven’t provided enough detail about what you are trying to achieve. You won’t get any real assistance from me until you do as I suggested…

Pete.

I think I have found the main problem the adc of the esp 8266 when the wifi si in use goes crazy and gives values ​​in a scale that increases so a possible solution is to take an external adc that would not only increase the analog ports but would go connected with i2c could this be a viable solution?
but in my country I can not find the ADS1115 and the ones I find are practically fake instead of being ADS1115 are ADS1015 so 12 bits instead of 16. does anyone know if the ADS1015 could be good?

I think you’re going down the wrong route.

Post a schematic of your exiting setup, plus the other info I asked for in post #14, along with a summary of what it is that this project is meant to do, and you could save yourself a lit of time and effort.

Pete.

2 Likes

If you are sure that the problem comes from the ESP8266, better buy an ESP32 for $6 or less

fair to say but here the cost 12 euros not so cheap btw from what i read the esp 32 is eaven worst when using wifi 6 analog in are disabled and the adc is less accurate if i remember

i found the problem i practically noticed that the humidity recorded by my dht 11 was 95% which is very strange as the measurement range is only up to 90% so i unsoldered it and tried it with in another node mcu and the test sketch dht and kept giving 95% so I think it is damaged so I bought one i2c the HDC1080 which from what I have seen is accurate enough this would also solve the voltage problem for me and I would no longer have to use the external adc we will see. …