Page 1
Wemos D1 mini is an ESP8266 board that’s interesting thanks to its size, its low price ($4), micro USB power, its shields, and a documentation that looks fairly good. The board can be programmed with Arduino or Lua, and supports both serial and OTA programming. I’ve decided to give it a try and bought the board together with two temperature shields, a relay shield, and micro SD shield.
Page 2
and the other side has CH340 serial to USB chip, and the reset button.
Page 3
The provided headers make it easy to stack the board with several shields if you wish too. For example I connect Wemos D1 mini to both the relay shield, and DHT Pro shield after soldering some of the headers. The only potential pitfall would be to solder the header on the wrong side, so you just need to make sure...
Page 4
Lua/NodeMCU will want to check NodeMCU guide instead. There are various ways to configure the Arduino IDE for WeMos D1 mini in the guide, but I’ve only used the recommended way: git. The first step was to install and run Arduino 1.6.8.
Page 5
Later on, you can update the board support files and the samples by running git pull in the two directories where you ran git clone. Now connect Wemos D1 mini to a USB port of your computer with a micro USB to USB cable. In Linux, you should see a new device in the kernel log: [ 8643.196931]...
Page 6
We can use the default for the other settings include 80 MHz CPU frequency, 4M flash size, 912600 upload speed, and /dev/ttyUSB0 port. We can now use the code samples, and to make sure everything works I’ll run the blink project in File- >Sketchbooks->D1_mini_Examples->01.
Page 7
* Blink * Turns on the onboard LED on for one second, then off for one second, repeatedly. * This uses delay() to pause between LED toggles. void setup() { pinMode(BUILTIN_LED, OUTPUT); // initialize onboard LED as output void loop() { digitalWrite(BUILTIN_LED, HIGH);...
Page 8
/* DHT Pro Shield - Simple * Example testing sketch for various DHT humidity/temperature sensors * Written by ladyada, public domain * Depends on Adafruit DHT Arduino library * https://github.com/adafruit/DHT-sensor-library #include "DHT.h" #define DHTPIN D4 // what pin we're connected to // Uncomment whatever type you're using! //#define DHTTYPE DHT11 // DHT 11 #define DHTTYPE DHT22 // DHT 22 (AM2302)
Page 9
Serial.println("DHTxx test!"); dht.begin(); void loop() { // Wait a few seconds between measurements. delay(2000); // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(); // Read temperature as Celsius (the default) float t = dht.readTemperature();...
Page 10
Error compiling board WeMos D1 & mini. To fix that error, go to Sketch->Include Library->Manage Libraries, input dht to filter the library, and install DHT sensor library by Adafruit. Now click on the Upload button again, the code will be compiled and uploaded to the board. Now open the serial monitor with Ctrl+Shift M or Tools->Serial Monitor, and you should see the printed values for...
Page 11
e reported temperature matched the temperature reported by my IR thermometer (32.5 C). Pretty good. If you’d like to get results displayed on a web page instead, you may want to modify DHT Shield- >SimpleServer sample. Now I’ll had the relay shield on top, and run another sample (File->Sketchbooks->D1_mini_Examples- >04.
Page 12
* Relay Shield - Blink * Turns on the relay for two seconds, then off for two seconds, repeatedly. * Relay Shield transistor closes relay when D1 is HIGH const int relayPin const long interval 2000; // pause for two seconds void setup() { pinMode(relayPin, OUTPUT);...
Need help?
Do you have a question about the D1 mini and is the answer not in the manual?
Questions and answers