Wemos D1 Mini - pauloromeira/Sonoff-Tasmota GitHub Wiki

Flashing Wemos with Tasmota

Follow these steps to flash a Wemos D1 Mini with Tasmota firmware and add the following lines at the end of platformio.ini:

[env:wemos-d1-mini]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=1000
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
extra_scripts = pio/strip-floats.py

; *** Serial Monitor options
monitor_baud = 115200

; *** Upload Serial reset method for Wemos and NodeMCU
upload_resetmethod = nodemcu
upload_speed = 115200
;upload_port = COM6

; *** Upload file to OTA server using SCP
;upload_port = user@host:/path
;extra_scripts = pio/strip-floats.py, pio/sftp-uploader.py

; *** Upload file to OTA server using HTTP
;upload_port = domus1:80/api/upload-arduino.php
;extra_scripts = pio/strip-floats.py, pio/http-uploader.py

From the Menu -> PlatformIO -> Run Other Target... (F7) and choose PIO Upload (wemos-d1-mini), this compiles tasmota and uploads the firmware to the Wemos device connected to usb.

Configure Tasmota for WEMOS

Generic Module

In the Configuration -> Configure Module page, select Module Type: "18 Generic" (releases before 5.12.0 this was called "Wemos D1 Mini"). After Saving the settings, the WEMOS reboots with the Generic configuration.

SHT30 Shield High Precision Humidity & Temperature (I2C)

From the Wemos SHT30 shield specs the SDA pin on the SHT30 shield is connected to D2 and the SCL pin to D1.

Note: v1.0.0 is retired, but v2.0.0 has the same pining.

In the Configuration -> Configure Module page, select the following:

  • D2 GPIO4 : 06 I2C SDA
  • D1 GPIO5 : 05 I2C SCL

After reboot of the device the temperature and humidity are displayed.

DHT22 (DHT21, AM2301, AM2302, AM2321) Shield Humidity & Temperature (single pin)

Like the Wemos DHT11 shield specs the DATA OUT pin of Wemos DHT22 is connected to D4 of the Wemos.

Note: this is ONLY for v1.0.0 of the DHT11 shield, since v2.0.0 uses I2C and pinned differently.

In the Configuration -> Configure Module page, select the following:

  • D4 GPIO2 : 02 AM2301

After reboot of the device the temperature and humidity are displayed.

DHT11 Shield Humidity & Temperature (single pin - retired)

From the Wemos DHT11 shield specs the DATA OUT pin is connected to D4 of the Wemos.

Note: this is ONLY for v1.0.0 of the DHT11 shield, since v2.0.0 uses I2C and pinned differently.

In the Configuration -> Configure Module page, select the following:

  • D4 GPIO2 : 01 DHT11

After reboot of the device the temperature and humidity are displayed.

PIR Motion Sensor - HC-SR501 (single pin)

PIR sensors allow you to sense motion, almost always used to detect whether a human has moved in or out of the sensors range. See PIR Motion Sensor for more information.

Connecting the PIR to a Wemos Mini D1.

Wemos PIR
GND GND
5V POWER (VCC)
D5 (gpio14) OUTPUT

In the Configuration -> Configure Module page, select the following:

  1. Module Type : 18 Generic
  2. D5 GPIO14 Sensor : 09 Switch1
  3. D6 GPIO12 Relay1 : 17 Relay1

After reboot of the device the displays the status of relay1 aka switch1.

TSL2561 Luminosity Sensor (I2C)

The TSL2561 luminosity sensor is an advanced digital light sensor, ideal for use in a wide range of light situations. See TSL2561 luminosity sensor for more information.

Note: before the TSL2561 can be used with Tasmota, make sure it's enabled. To enable it, remove the forward slashes before this line before you compile and upload tasmota to your Wemos device.

#define USE_TSL2561   // Add I2C code for TSL2561 sensor using library Joba_Tsl2561 (+2k3 code)

Connecting the TSL2561 to a Wemos Mini D1.

Wemos TSL2561
GND GND
3.3V VCC
D2 (gpio04) SDA
D1 (gpio05) SCL

In the Configuration -> Configure Module page, select the following:

  1. Module Type : 18 Generic
  2. D2 GPIO04 : 06 I2C SDA
  3. D1 GPIO05 : 05 I2C SCL

After reboot of the device the displays the TSL2561 Illuminance.

DH1750 Luminosity Sensor (I2C)

The BH1750 is a digital ambient light sensor module which uses I2C to communicate. The BH1750 provides you with a digital value in lux (Lx) over a range of 1 - 65535 lx. See Digital 16bit Serial Output Type Ambient Light Sensor IC for more information.

Connecting the DH1750 to a Wemos Mini D1.

Wemos DH1750
GND GND
5V VCC
D3 (gpio0) SDA
D4 (gpio2) SCL

In the Configuration -> Configure Module page, select the following:

  1. Module Type : 18 Generic
  2. D3 GPIO0 : 06 I2C SDA
  3. D4 GPIO2 : 05 I2C SCL

After reboot of the device the displays the DH1750 Illuminance.

WS2812B RGB Shield (single pin)

From the Wemos ws2812b shield specs the DATA pin is connected to D2 of the Wemos.

In the Configuration -> Configure Module page, select the following:

  • D2 GPIO4 : 07 WS2812

After reboot of the device the dark-bright slider and toggle button are displayed to control the led.

VEML6070 UV Sensor (I2C)

"This little sensor is a great way to add UV light sensing to any microcontroller project. The VEML6070 from Vishay has a true UV A light sensor and an I2C-controlled ADC that will take readings and integrate them for you over ~60ms to 500ms." See VEML6070 UV Sensor for more information.

Note: before the VEML6070 can be used with Tasmota, make sure it's enabled. To enable it, remove the forward slashes before this line before you compile and upload tasmota to your Wemos device.

#define USE_VEML6070   // Add I2C code for VEML6070 sensor (+0k5 code)

Connecting the VEML6070 to a Wemos Mini D1.

Wemos VEML6070
GND GND
3.3V VCC
D3 (gpio0) SDA
D4 (gpio2) SCL

In the Configuration -> Configure Module page, select the following:

  1. Module Type : 18 Generic
  2. D3 GPIO0 : 06 I2C SDA
  3. D4 GPIO2 : 05 I2C SCL

After reboot of the device the displays the VEML6070 UV light intensity.

BME280 Temperature, Humidity and Pressure Sensor (I2C)

"BME280 sensor, an environmental sensor with temperature, barometric pressure and humidity" See BME280 Temperature, Humidity and Pressure Sensor for more information.

Note: before the BME280 can be used with Tasmota, make sure it's enabled. To enable it, remove the forward slashes before this line before you compile and upload tasmota to your Wemos device.

#define USE_BMP   // Add I2C code for BMP085/BMP180/BMP280/BME280 sensor (+4k code)

Connecting the BME280 to a Wemos Mini D1.

Wemos BME280
GND GND
3.3V VCC
D3 (gpio0) SDA
D4 (gpio2) SCL

In the Configuration -> Configure Module page, select the following:

  1. Module Type : 18 Generic
  2. D3 GPIO0 : 06 I2C SDA
  3. D4 GPIO2 : 05 I2C SCL

After reboot of the device the displays temperature, humidity and pressure measured by the BME280.

HC-SR04 Ultrasonic Sensor

"This is the HC-SR04 ultrasonic ranging sensor. This economical sensor provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit." See HC-SR04 Ultrasonic Sensor for more information.

Connecting the HC-SR04 to a Wemos Mini D1.

Wemos HC-SR04
GND GND
5V VCC
D6 (gpio12) Trig
D7 (gpio13) Echo

In the Configuration -> Configure Module page, select the following:

  1. Module Type : 18 Generic
  2. D6 GPIO12 : 69 SR04 Tri
  3. D7 GPIO13 : 70 SR04 Ech

After reboot of the device the displays the HC-SR04 distance.