ESP8266 D1 Mini (Wemos) — Microcontroller NodeMCU — BME280 & Relay Ready

ESP8266 D1 Mini — WiFi Microcontroller (BME280 + Relay Example Included)

This small but powerful board features the ESP8266 SoC and is perfect for WiFi-connected sensor nodes, relay controllers, and Home Assistant integrations. It’s compatible with the Arduino IDE, PlatformIO, and ESPHome for easy integration into your projects.

Perfect for WiFi IoT sensors & controllers. This listing includes wiring & example code for connecting a BME280 (I²C temperature/humidity/pressure sensor) and a 4-channel 5V relay module.

SEO Title

ESP8266 D1 Mini Wemos — WiFi Dev Board — BME280 & Relay Example / IoT

Item specifics

BrandWemos / Generic
ModelD1 Mini (ESP8266)
WiFi802.11 b/g/n (ESP8266)
Flash4MB (typical)
Operating Voltage3.3 V
InterfaceUSB (micro), GPIO, I²C, SPI
ConditionNew
Compatible WithArduino IDE, PlatformIO, ESPHome

Key specs & features

Possible uses

Home Automation

  • Smart thermostat / humidity monitor (with BME280)
  • Relay-controlled lights, fans, and appliances
  • Scheduled or sensor-based switching (Home Assistant)

IoT & Monitoring

  • Environmental monitoring (temp / humidity / pressure)
  • Remote alerts and logging to MQTT / cloud
  • Data logging for greenhouses / server rooms

Maker & Hobby

  • Robotics control (low power signalling)
  • Camera triggers, time-lapse controllers
  • Prototype automation & sensor fusion

Industrial / Workshop

  • Relay-based control for pumps and small motors
  • Process sensing & remote reset controllers
  • Machine-peripheral automation

Wiring Diagrams (D1 Mini → BME280 + Relay Module)

Below are two diagrams: (A) D1 Mini wiring to the BME280 (I²C), and (B) D1 Mini wiring to a 4-channel relay module. Use the wiring notes after the diagrams.

Wiring notes:
  • BME280 uses I²C: SDA → D2 (GPIO4), SCL → D1 (GPIO5). Power BME280 with 3.3V VCC (do not use 5V unless your breakout has an onboard regulator).
  • Relay module coil (JD-VCC) usually needs 5V. If using opto-isolation, supply JD-VCC separately and follow the JD-VCC jumper instructions on the board.
  • Common ground: always connect D1 Mini GND to BME280 GND and relay module GND when using the same supplies.
  • ESP8266 GPIOs are 3.3V only — do not drive pins above 3.3V.

Code examples (collapsible)

Arduino (Arduino IDE) — BME280 read + Relay control
// Requirements:
//  - Install Adafruit BME280 library (Adafruit BME280 Library) and Adafruit Sensor
//  - Wire BME280 to I2C (SDA->D2 GPIO4, SCL->D1 GPIO5)
//  - Relays to D5 (GPIO14), D6 (GPIO12) etc. (active LOW typical)

#include 
#include 
#include 

#define BME_SDA D2 // GPIO4
#define BME_SCL D1 // GPIO5
Adafruit_BME280 bme; // I2C

const int RELAY1 = D5; // GPIO14
const int RELAY2 = D6; // GPIO12

void setup() {
  Serial.begin(115200);
  Wire.begin(BME_SDA, BME_SCL);
  if (!bme.begin(0x76)) { // try 0x76 then 0x77 depending on breakout
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1) delay(10);
  }
  pinMode(RELAY1, OUTPUT);
  pinMode(RELAY2, OUTPUT);
  // Many relay modules are ACTIVE LOW: HIGH = off, LOW = on
  digitalWrite(RELAY1, HIGH);
  digitalWrite(RELAY2, HIGH);
}

void loop() {
  float t = bme.readTemperature(); // °C
  float h = bme.readHumidity();    // %
  float p = bme.readPressure() / 100.0F; // hPa
  Serial.printf("T: %.2f °C  H: %.2f %%  P: %.2f hPa\n", t, h, p);

  // Example: turn relay on if temperature above threshold
  if (t > 28.0) {
    digitalWrite(RELAY1, LOW); // turn ON
  } else {
    digitalWrite(RELAY1, HIGH); // turn OFF
  }

  // Example toggling relay2 every 10s for demo
  digitalWrite(RELAY2, LOW); delay(200);
  digitalWrite(RELAY2, HIGH); delay(9800);

  delay(2000);
}
      
ESPHome YAML — BME280 sensor + 2 relay switches (ESP8266 D1 Mini)
esphome:
  name: d1mini_bme_relay
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "YOUR_SSID"
  password: "YOUR_PASSWORD"

# Enable logging and OTA
logger:
ota:
api:

i2c:
  sda: D2  # GPIO4
  scl: D1  # GPIO5
  scan: true

sensor:
  - platform: bme280
    temperature:
      name: "BME280 Temperature"
    pressure:
      name: "BME280 Pressure"
    humidity:
      name: "BME280 Humidity"
    address: 0x76

# Relays: many relay modules are ACTIVE LOW -> use inverted outputs
output:
  - platform: gpio
    pin: D5
    id: relay1_out
    inverted: true
  - platform: gpio
    pin: D6
    id: relay2_out
    inverted: true

switch:
  - platform: output
    name: "Relay 1"
    output: relay1_out
  - platform: output
    name: "Relay 2"
    output: relay2_out

# Optional automation: turn on Relay1 if temperature > 28C
automation:
  - alias: "Turn on Relay1 on high temp"
    trigger:
      - platform: numeric_state
        entity_id: sensor.bme280_temperature
        above: 28.0
    action:
      - switch.turn_on: relay1
      - delay: 10s
      - switch.turn_off: relay1

# Ensure relays off on boot
on_boot:
  then:
    - switch.turn_off: relay1
    - switch.turn_off: relay2
      

Safety notes & tips

Package & shipping