Long story short, I have a simple weather station with a BME-280 and a GY-49 wired to a Wemos D1 Mini and all power up by a 18650 battery, see schematic.
I decided to try the new Blynk Edgent to be able to easily update the firmware and all worked great. I successfully update the esp a couple of times until yesterday, when I tried another update but it failed with the error “firmware mismatch” or something similar - unfortunately I deleted the shipment without thinking.
At this point you’d think that there is nothing wrong, just make another shipment with the firmware to update.
The issue is that after this fact the Wemos seemed to not connect to Blynk anymore, so I removed it from the weather station and when I connected to the computer I noticed that in the serial monitor it prints this:
09:21:18.830 → ets Jan 8 2013,rst cause:2, boot mode:(7,7)
09:21:18.830 →
09:21:18.830 → waiting for host
By searching on google it seems like the GPIO15 is pulled high, which prevents the esp to boot.
I’ve no idea what to do and if the Wemos is recoverable. If I manually short the GPIO15 to GDN it seems to boot correctly, but it’s a bad idea. I tried a pulldown with a 1k resistor but it didn’t work.
The code:
#define BLYNK_TEMPLATE_ID "My_template"
#define BLYNK_DEVICE_NAME "My_device"
#define BLYNK_FIRMWARE_VERSION "1.0.5"
#define BLYNK_PRINT Serial
// #define BLYNK_DEBUG
// #define APP_DEBUG
#define USE_WEMOS_D1_MINI
#include "BlynkEdgent.h"
// Pins:
#define voltageAnalogPin A0
// Virtual pins:
// V0 = Temperature
// V1 = Humidity
// V2 = Pressure
// V3 = Luminosity
// V4 = Battery Voltage
// V5 = Battery Raw Voltage (analogRead)
// V6 = Dew point
// GY-49
#include <Wire.h>
#include <Max44009.h>
// BME280
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
bool statusBME;
bool statusGY;
Max44009 myLux(0x4A);
Adafruit_BME280 bme;
BlynkTimer timer;
float dewPointFormula(float temp, float humidity){
float dewPoint;
dewPoint = (237.3*(log(humidity/100) + ((17.27*temp)/(237.3+temp)))) / (17.27-(log(humidity/100)-((17.27*temp)/(237.3+temp))));
return dewPoint;
}
void SendData(){
if(statusBME){
float temperature = bme.readTemperature();
float humidity = bme.readHumidity();
float pressure = (bme.readPressure() / 100.0F)+30.77;
float dewPoint = dewPointFormula(temperature, humidity);
Blynk.virtualWrite(V0, temperature);
Blynk.virtualWrite(V1, humidity);
Blynk.virtualWrite(V2, pressure);
Blynk.virtualWrite(V6, dewPoint);
}
if(statusGY){
float illuminance = myLux.getLux();
if(illuminance >= 0){
Blynk.virtualWrite(V3, illuminance);
}
else{
String desc = "GY49 error: " + String(illuminance);
Blynk.logEvent("error_on_data_reading", desc);
}
}
float rawVoltage = analogRead(voltageAnalogPin);
float voltage = (rawVoltage/1024)*5.1 ;
if(voltage < 3.65){
Blynk.logEvent("battery_voltage_low");
}
Blynk.virtualWrite(V5, rawVoltage);
Blynk.virtualWrite(V4, voltage);
ESP.deepSleep(300e6);
}
void setup()
{
// Serial.begin(115200);
BlynkEdgent.begin();
// If the timer interval is too low ( < ~10 seconds) blynk does not have the time to start the firmware update before the esp goes in deep sleep
timer.setInterval(10000L, SendData);
Wire.begin();
Wire.setClock(100000);
delay(150);
statusBME = bme.begin(0x76);
statusGY = myLux.isConnected();
if(!statusBME){
Blynk.logEvent("sensor_offline", "BME280");
}
if(!statusGY){
Blynk.logEvent("sensor_offline", "GY49");
}
}
void loop() {
BlynkEdgent.run();
timer.run();
}