ESP8285 i2c Pins

No, nothing …

Cut and paste this on top of your loop() and downwards. It could be a problem with Stream.

//////////////////////////////////////////////////////////////////
void loop()
{
  Blynk.run();
  timer.run(); // Initiates BlynkTimer
}

//////////////////////////////////////////////////////////////////




void readSensor()

{
   float temp(NAN), hum(NAN), pres(NAN);

   BME280::TempUnit tempUnit(BME280::TempUnit_Celsius);
   BME280::PresUnit presUnit(BME280::PresUnit_Pa);

   bme.read(pres, temp, hum, tempUnit, presUnit);

   Serial.print("Temp: ");
   Serial.print(temp);
   Serial.print("°"+ String(tempUnit == BME280::TempUnit_Celsius ? 'C' :'F'));
   Serial.print("\t\tHumidity: ");
   Serial.print(hum);
   Serial.print("% RH");
   Serial.print("\t\tPressure: ");
   Serial.print(pres);
   Serial.println("Pa");
   Blynk.virtualWrite(V1, pres/100.0);  // write pressure to V1 value display widget
   Blynk.virtualWrite(V2, temp);        // write temperature to V2 value display widget
   Blynk.virtualWrite(V3, hum);         // write humidity to V3 value display widget
   //delay(1000);
}

@Costas Managed to make things better by changing this:

timer.setInterval(3000L, readSensor); // every 3s

to this:

timer.setInterval(1000L, readSensor); // every 1s

Its on more than its off now …

That’s not a fix and 3s is better than 1s for sensor reading. 1s is almost never needed.

1 Like

No, still the same.

Strange that the app is bad and no problems showing in Serial Monitor like reconnects etc.

Post a copy of the cloned QR code image.

Is it doing the same for you, on and off ?

I am running your sketch with the super WeMos D1 Mini and a BME280 and it’s fine.

No disconnects here.

Only change I have is my circuit is wired up as:

Wire.begin(4, 5); // D2 and D1

Try Wire.begin(4, 5); with pin connections to 10 and 13 respectively for SDA and SCL (on the 01M).

The only pins that work are 2, 15
Have tried 4, 5 and lots of others already.
I’m now trying a basic Blynk sketch to make sure the 8285 is ok.

Do you mean physical pins 2 and 15 or GPIO 2 and 15?

@Costas
I’ve loaded a basic Bltnk sketch to the 8285 and its working fine so the problem must be in the sketch you made, any idea’s ?

@Shadeyman what about this?

Maybe the IDE doesn’t do a pin translation for the ESP8285.

Sorry, should have been a bit more clear, GPIO 2 and 15.

Then wouldn’t that effect the basic sketch thats running now?

“Float” is that what holds the data until the next update? Could that be the cause?

And you have the sensor connected to physical pins 14 and 6, right?

Basic sketch doesn’t have any digital pins so no.

No the data is held in 3 variables pres, temp and hum of data type float. Not an issue.

AFAIK Blynk doesn’t have an ESP8285 board and your QR was for a ESP8266. This might be the problem.

Since the App setting is only for Digital and Analog pin layout (as controlled directly from the App), just put this command in the sketch to disable that function in the library. Then you could technically use any device setting in the App… with vPins of course.

#define BLYNK_NO_BUILTIN

Correct or not @Shadeyman ?

Sorry guys had to drop the wife off, she’s working tonight.

I think its the app on my phone?

I created a simple sketch with 6 vitual pins, loaded it onto the 8285 and altered the app on me phone to view all 6 pins.

The first three go on and off, the last three are as they should be, permanently on. :confounded:

Here, see for your selves.

@Costas It was the Blynk app on my phone.
Your sketch works perfectly, the problem was with theBlynk Project in the app on my phone. I’ve completely deleted the project and quickly made another, your sketch works perfectly, so does this little 8285.

1 Like

Hi guys, thanks for all your help, we got there in the end. :+1:

Its now working as it should. Not really sure what caused the issues in the Blynk app, was probably something i did.

Anyway here’s a couple of pics of the little beasty and the the now stable reading on my phone. :hugs:

Time for me to get some sleep.

2 Likes