The wiring of this project is extremely simple as all components use the i2c interface, making use of four pins only. As both the OLED display and the BME280 sensor make use of this interface, the wiring is as follows:

VCC (on the sensor/OLED) - 3.3V (on the microcontroller)

GND - GND

SCL - D1

SDA - D2

More information about the code and wiring is shown in this video: 

The project code is as follows:

#include <ESP8266WiFi.h>
#include <time.h>
#include <U8x8lib.h>
#include "DFRobot_BME280.h"
#include "Wire.h"

const char* ssid = "Wifi";              
const char* password = "Password";      

const char* NTP_SERVER = "ch.pool.ntp.org";
const char* TZ_INFO    = "GMT+0BST-1,M3.5.0/01:00:00,M10.5.0/02:00:00";  // enter your time zone (https://remotemonitoringsystems.ca/time-zone-abbreviations.php)

tm timeinfo;
time_t now;
long unsigned lastNTPtime;
unsigned long lastEntryTime;

U8X8_SH1106_128X64_NONAME_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);   // OLEDs without Reset of the Display

typedef DFRobot_BME280_IIC    BME;    // 
BME   bme(&Wire, 0x77);   // select TwoWire peripheral and set sensor address
#define SEA_LEVEL_PRESSURE    1015.0f

void printLastOperateStatus(BME::eStatus_t eStatus) // show last sensor operate status
{
  switch(eStatus) {
  case BME::eStatusOK:    Serial.println("everything ok"); break;
  case BME::eStatusErr:   Serial.println("unknow error"); break;
  case BME::eStatusErrDeviceNotDetected:    Serial.println("device not detected"); break;
  case BME::eStatusErrParameter:    Serial.println("parameter error"); break;
  default: Serial.println("unknow status"); break;
  }
}

void setup()
{
  u8x8.begin();
  Serial.begin(115200);
  WiFi.begin(ssid, password);

  int counter = 0;
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(200);    
    if (++counter > 100) 
      ESP.restart();
  }

  configTime(0, 0, NTP_SERVER);
  // See https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv for Timezone codes for your region
  setenv("GMT0BST,M3.5.0/1,M10.5.0", TZ_INFO, 1);

  if (getNTPtime(10)) 
  {  
    // wait up to 10sec to sync
  } 
  else 
  {
    ESP.restart();
  }
  showTime(&timeinfo);
  lastNTPtime = time(&now);
  lastEntryTime = millis();
    
  bme.reset();
  Serial.println("bme read data test");
  while(bme.begin() != BME::eStatusOK) {
    Serial.println("bme begin faild");
    printLastOperateStatus(bme.lastOperateStatus);
    delay(2000);
  }
  delay(100);
}

void loop()
{
  getNTPtime(10);
  showTime(&timeinfo);
  delay(1000);
  
  float   temp = bme.getTemperature();
  uint32_t    press = bme.getPressure();
  float   alti = bme.calAltitude(SEA_LEVEL_PRESSURE, press);
  float   humi = bme.getHumidity();

  char temp_buff[5]; char hum_buff[5]; char pres_buff[9];
  char cel_buff[11] = "C";
  char per_buff[11] = "%";
  char pa_buff[11] = " Pa";

  dtostrf(temp, 3, 1, temp_buff);
  strcat(temp_buff, cel_buff); 
  dtostrf(humi, 3, 0, hum_buff);
  strcat(hum_buff, per_buff);
  dtostrf(press, 5, 0, pres_buff);
  strcat(pres_buff, pa_buff);
  
  u8x8.setFont(u8x8_font_artossans8_r);
  u8x8.setCursor(0,2);
  u8x8.print("Temp: ");
  u8x8.setCursor(6,2); 
  u8x8.print(temp_buff);
  u8x8.setCursor(0,4);
  u8x8.print("Hum: "); 
  u8x8.setCursor(6,4);
  u8x8.print(hum_buff);
  u8x8.setCursor(0,6);
  u8x8.print("Pres: "); 
  u8x8.setCursor(6,6);
  u8x8.print(pres_buff);
}

bool getNTPtime(int sec) 
{
  {
    uint32_t start = millis();
    do
    {
      time(&now);
      localtime_r(&now, &timeinfo);
      delay(10);
    } while (((millis() - start) <= (1000 * sec)) && (timeinfo.tm_year < (2016 - 1900)));
    
    if (timeinfo.tm_year <= (2016 - 1900)) 
        return false;  // the NTP call was not successful
  }
  return true;
}

void showTime(tm *localTime) 
{
  char time_output[30];
  
  u8x8.setFont(u8x8_font_artossans8_n);
  u8x8.setCursor(0,0);
  sprintf(time_output, "%02d:%02d", localTime->tm_hour, localTime->tm_min);
  u8x8.print(time_output);
  
  u8x8.setFont(u8x8_font_artossans8_r);
  u8x8.setCursor(7,0);
  sprintf(time_output, "%02d/%02d/%02d", localTime->tm_mday, localTime->tm_mon + 1, localTime->tm_year - 100);
  u8x8.print(time_output);
}

Amazing opportunities...

Read more »