Ah yes that will be the difference between my two screenshots.
Easy enough to check
Just drop this code into your void setup()
and assign a display widget to vPin
ā¦ adjust timing if desired and watch the results over time & conditions.
The data will be a negative number, with the smaller the number (towards 0) meaning the stronger the signal. e.g. My ESP-01 is the furthest away from router and the weakest signal, but still respectable -61 to -64.
// Timed Lambda Function - RSSI display
timer.setInterval(4500L, []() {
Blynk.virtualWrite(vPin, WiFi.RSSI());
}); // END Timer Function
Thanks all for the observations on the differences in scale, which I had not seen - I assumed the scales were carried over too, which of course they were not.
Thanks too for the observations on NaNs etc, but I was trying to avoid screwing up my minimum and maximum observations if the sensor goes haywire. In this project, it is important to know the real maximum and minimum temperatures (and less so humidities), as they are important in monitoring that a control system is working as intended.
The good news is I got a new Lolin Nodemcu today. The bad news is it was dead on arrival. At least, although I could connect to the serial chip, no lights lit up, and any attempt to talk to the ESP8266 failed - not just programming it, but any contact with esptool.
However, back to good news - I did manage to find a spare Wemos D1 (not mini, not R2 but R1 - original), and have put the revised code below into that, having appropriately changed the pins used for SDA and SCK.
To avoid any issue with the button, as pointed out by Costas, the code has now been cleaned up as follows (I also changed units to hPa to avoid the need to divide by 100). (Other parts omitted, as unchanged, apart from pin assignments).
int resetLimits = 0; // flag to say if limits need to be reset
BME280I2C bme; // Default : forced mode, standby time = 1000 ms
// Oversampling = pressure Ć1, temperature Ć1, humidity Ć1, filter off,
BME280::TempUnit tempUnit(BME280::TempUnit_Celsius);
BME280::PresUnit presUnit(BME280::PresUnit_hPa);
BlynkTimer timer;
WidgetLED led(V10);
float t, tmin, tmax, h, hmin, hmax, p;
BLYNK_WRITE(V0) { resetLimits = 1; } // Button to reset limits
BLYNK_WRITE(V1) { hmin = param.asFloat(); } // For data coming from server
BLYNK_WRITE(V2) { hmax = param.asFloat(); }
BLYNK_WRITE(V3) { tmin = param.asFloat(); }
BLYNK_WRITE(V4) { tmax = param.asFloat(); }
void sendSensor()
{
bme.read(p, t, h, tempUnit, presUnit);
if (isnan(p) || isnan(t) || isnan(h)) {
Serial.println("Failed to read from sensor!");
led.setColor(RED);
return;
}
led.setColor(GREEN);
Blynk.virtualWrite(V5, h);
Blynk.virtualWrite(V6, t);
Blynk.virtualWrite(V9, p);
if(h<hmin || isnan(hmin) || resetLimits == 1) { hmin=h; Blynk.virtualWrite(V1, h); }
if(h>hmax || isnan(hmax) || resetLimits == 1) { hmax=h; Blynk.virtualWrite(V2, h); }
if(t<tmin || isnan(tmin) || resetLimits == 1) { tmin=t; Blynk.virtualWrite(V3, t); }
if(t>tmax || isnan(tmax) || resetLimits == 1) { tmax=t; Blynk.virtualWrite(V4, t); }
resetLimits = 0; // clear any request to reset limits
}
So, now we can wait and see how long that runs for. Iām hoping at this point it will be fine, given that others were not having problems with their long running code. Iāll let you all know what happens in due course.
Iām curious what youāre using ESPtool for in this scenario?
What happens if you connect the ESP to your PC, open the Arduino IDE and select the correct COM port, open the serial monitor and choose 74880 baud then press the reset button on the MCU?
Pete.
I was ONLY using esptool as an alternative to Arduino to give me some debugging clue as to what the device was doing and why I couldnāt program it with Arduino. I had already tried the āserial monitor with 74880 baud and resetā routine, and itās as dead as a dodo. I got no response from any debugging approaches I tried. After 1/2 hour I gave up. Given that it costs Ā£2, itās hardly worth wasting a lot of effort on it. Iām certainly not going to get the scope outā¦
When you power it up, is it broadcasting an SSID?
No, the new one does not broadcast an SSID. I hadnāt thought of checking that, but it is indeed further evidence that it is dead. Anyway, letās not get too distracted by the dead one. Thatās another story for another day.
PS I did hook the dead one up to an external power supply just in case, but that didnāt help either.
The (tidied up) code has been running OK for 18 hours so far on the Wemos D1. Iāll report further in a few days, or if it locks upā¦
Bugs in ESP8266 Arduino core, would you believe that ESP8266 Arduino Core Bug - hostname and DHT22 etc ?
Maybe we should all ask Arduino for our money back
My BME sensors arrived yesterday so Iāve set-up a couple of NodeMCU 1.0ās running @ralphrmartinās original BME code (not the tidied-up version as I didnāt want any ambiguity about the changes).
One is in the spare room and the other on the loft and theyāve been running since 20:15 yesterday. Iāll keep an eye on them over the next week or so and see if they continue working okay.
Pete.
Nice one @PeteKnight
My clone of the project has been running for 3 days without any problems. Not even a reset from the ESP which you can expect with a sub $5 product.
Mine has also been running for over 2.5 days now without issue. However, before it was failing repeatably after about 4.5 days.
Reading that bug report you pointed to, this seems to be hitting the nail on the head:
āProposal 2 does fix the dhcp hostname issue, and the DHT22 seems to be happy, too. Iām betting something was referencing the non-initialized hostname and clobbering stuff. Iāll close this issue once the fix is merged into master, or you can, whenever.ā
Anyway, thanks everyone for the community support, which I do appreciate.
@ralphrmartin we are just trying to wind you up.
I think we all welcome bug reports as it makes the system better for everyone but thereās a right way and your way
And there is a right way to respond too. Moving my topic from āBugs and Issuesā to āI need help with my sketchā is rather insulting, if you ask me.
are you now convinced I am wound up enough?!
Thatās standard practise until something is shown to be a problem as it takes developers away from developing the project.
In your case there was never an indication that there was a problem with Blynk.
And no-one gave me any indication there was anything wrong with my project eitherā¦
Check the thread again.
That came AFTER my project was moved, and as we have seen, was a red herringā¦
By the way, if you want a REAL, definite bug in blynk, rather than the ESP libraries - when I open my project in my (android) phone, the superchart normally just sits there showing āloadingā, more or less indefinitely, yet if I switch to a different time period and back again immediately, the chart shows up straight away. Thereās clearly a logic error somewhere thereā¦