The Wemos D1 Mini is a board based on the ESP8266 ESP-12E module developed by the Wemos CC company. You can buy it between $3.50 and $5. As with all Arduino cards, you will also find many clones that works perfectly.
This small card is really very convenient to program and use. The programming can be done directly from the IDE Arduino or in Lua (using ESPlorer already presented in this article) by connecting it to the computer using a USB cable. On Mac OS X, it is recognized immediately on the port /dev/cu.wchusbserialfaxxxx . If you encounter any problems, you can manually install the CH340 drivers. You can retrieve it here. For Windows, you will also find the CH340 drivers here if needed.
Wemos D1 mini shields
Wemos (and other manufacturers) also developed learning / prototyping shields that connect to the board (the solder terminals are delivered with the card. You can choose the one you need at the time of the welding).
|Check shipping cost before buying||PIN|
|ESP8266 Wemos D1 Mini board|
|5V/3A micro-usb power supply
The ESP8266 is sensitive to the quality of the power supply (risk of crash). A good quality power supply is recommended.
|LiPo battery charger with micro USB connector.|
|Relai (1 output)||D1|
|DHT11 (not official shield): temperature / humidity sensor (read this tutorial)
Adafruit library : https://github.com/adafruit/DHT-sensor-library
|DHT22 (not official shield): temperature / humidity sensor. Tutorial : presentation of the shield, how to use with ESP Easy and Arduino code
Adafruit library : https://github.com/adafruit/DHT-sensor-library.
|SHT30: temperature and humidity sensor on I2C bus||D1 – SCL
D2 – SDA
|I2C SSD1306 monochrome OLED Display. How to use SSD1306 OLED display||D1 – SCL
D2 – SDA
|Micro SD card reader (ideal for making a mini data logger)|
|Double base. Lets you install a Wemos on a slot (and overlay a shields). A 2nd location allows to install a 2nd shields.|
|I2C Driver to drive 2 motors (15 VDC max.)||D1 – SCL
D2 – SDA
|DC Power 7-24VDC (1A max)|
RGB Led, WS2812B driver. Need Adafruit Neopixel library
All specials for Wemos official shields
Characteristics of the board
- 11 digital I/O
- Interruption/PWM/I2C/one-wire: available on all pins except the D0
- 1 analog input, limited to a voltage of 3.2V Max
- 4 Mbytes memory Flash
- CPU frequency : 80 MHz / 160 MHz
- Dimensions: 34.2 mm x 25.6 mm
- Weight: 10 g
|Pin (on the board)||Function||ESP8266 correspondence|
|A0||Analog input, max 3.3V input||A0|
|D3||IO, 10k Pull-up||GPIO0|
|D4||IO, 10k Pull-up, BUILTIN_LED||GPIO2|
|D8||IO, 10k Pull-down, SS||GPIO15|
Attention, like all ESP8266 modules, do not exceed a voltage of 3.3V on the IO.
All pins support interrupts, PWM, I2C communication and One-Wire except pin D0.
Warning. Do not exceed 3.3 Volts to power the card on pin 3V is worth destroying the card
Use the Wemos D1 mini with the Arduino IDE
The Wemos D1 Mini is used like all ESP8266 cards. First, configure the Arduino IDE. Open Preferences and add the repository to the esp8266 library.
Go to the map manager and look for esp8266, then click install.
In the list of cards, choose WeMos D1 R2 & Mini from the ESP8266 Modules list.
For my part I had to opt for an upload speed of 115200 baud. If you encounter problems, here are some ways:
- Make a Reset,
- Unplug and then reconnect the card,
- Remove the card from the mounting (especially when first used).
This map comes with a series of examples that you can download on github here. Place the directory in your Arduino folder and restart the IDE to refresh the list of examples. A section is dedicated to shields:
- 1 Button: Connected button
- DHT pro: for the DHT22
- DHT: for the DHT11
- Micro SD: SD card reader
- Relay: relay control 10A – 230V (alternating current) or 10A – 30V (direct current)
- WS2812B: driver for RGB LED headband
With regard to pin marking in the Arduino code, the reference of the pin indicated on the card can be used directly in the Arduino program (eg D2 instead of 4). If you want your program to work on either an Arduino or an ESP, it is best to continue using the Arduino references.
How to use interrupts
Compared to an Arduino Uno that has only 2 interrupts, an interrupt can be connected to all Wemos D1 Mini pins, except for pin D0 which is reserved for sleep mode.
Using the Arduino IDE, use the attachInterrupt and detachInterrupt functions as usual.
To attach an interrupt: attachInterrupt (interrupt, function, mode)
- Interrupt: Indicate the pin on which the interrupt is connected, for example 4 for pin D4 of the Wemos.
- Function: The function called when the interrupt is triggered
- Modes :
- LOW: Interrupt is triggered when the spindle is at the LOW level
- CHANGE: Interrupt triggers when the spindle changes state LOW / HIGH
- RISING: Interrupt is triggered when the spindle changes from LOW to UP (rising edge)
- FALLING: the interrupt is triggered when the spindle changes from the UP state to the LOW state (falling edge)
Detach an interrupt: detachInterrupt (pin or interrupt number).
Programming the Wemos D1 Mini in Lua
For those who prefer the Lua and NodeMCU, you can program the Wemos in this language. I advise you to use ESPlorer, a program written in Java that I have already presented to you in this article. To reinstall the original firmware, follow this article.
Develop without programming with ESP Easy
Finally, the Wemos lends itself very well to the use of the firmware ESP Easy. ESP Easy makes it possible to make measurements, to order actuators, to communicate with a home automation server or an online service very simply. To learn more about ESP Easy, follow this comprehensive guide.
- ESP8266, Deep Sleep mode test, wake up with a PIR motion detector
- Unpacking Wemos ESP32 LoLin clone with 0.96” SSD1306 monochrome OLED display
- Unpacking the Wemos D1 R2, ESPDuino clone, ESP8266 development board in Arduino Uno format
- Unpacking the Geekcreit PCA9685 I2C Shield 16 Servos + 2 DC motors for Arduino or ESPDuino (ESP8266)
- OLED display SSD1306 in MicroPython, example with a I2C digital barometer BME280 (or BMP180)
- ESP8266 + DHT22 + MQTT: make a connected object IoT and include it in Home Assistant