hackAIR home v2: Wemos D1 Mini

An alternative solution to hackAIR’s official Arduino shield for wireless connection to Internet is by using ESP8266 implemented solutions. The current tutorial will guide you to assemble and program the popular Wemos D1 Mini module (along with required sensor) to upload your measurements to hackAIR platform.

Required hardware

  1. An Wemos D1 mini board
  2. DHT 11 humidity sensor shield (you can use also DHT22 humidity sensor with or without shield)
  3. 1×8 long sleeve header 2.54mm – 2pcs (included with sensor shield)
  4. 1×8 female header 2.54mm – 2pcs (included with Wemos)
  5. male-to-female jumper wires – 4pcs
  6. (not shown) A supported sensor (supported sensor list)

Assembly steps

Step 1 (solder Wemos)

Solder the headers to Wemos.

In order to keep the header stable during soldering use some Blu-Tack (pointed by red arrow)

Your finished board should look like this:

Step 2 (solder shield)

Solder the headers of humidity sensor shield

Use Blu-Tack again. It really helps!

Your finished sensor shield should look like this:

Step 3 (Plug it in)

Temporarily plug the shield over the Wemos. Check alignment.

Check that all pins line up and everything is aligned. If everything is OK then Plug it in (push it down as white arrow indicates).

Your finished Wemos – shield pair should look like this :

In order to check that you put the shield in the correct orientation there is an easy way : White dots. At Wemos board as well as at humidity sensor shield you are going to find a white dot in one of the corners. The white dots from Wemos board and sensor shield must be in the same side (just like the picture below)

Step 4 (sensor cabling)

Now it’s time to do some cabling. Assuming that you have SDS011 sensor (similar instructions hold for the rest of the sensors also – see here ) initially you must connect the female side of jumper wires to sensor connector as below (NC means “NoConnect”):

Sensor pin ( counting from left side) Connect to Wemos Pin
3 5V
5 GND
6 D6
7 D7

Step 5 (Finalize connections)

Now you must connect the male side side of jumper wires to the appropriate sockets on Wemos – humidity sensor stack. First, let’s connect the +5V (at 5V socket) and GND (at GND socket) wires as below:

then connect the yellow wire (sensor’s Tx) to D7 and blue wire (sensor’s Rx) to D6 as below:

Configuration steps

Step 1 (install Wemos D1 Mini in Arduino)

  • Install the current upstream Arduino IDE at the 1.8 level or later. The current version is at the Arduino website.
  • Start Arduino and open Preferences window
  • Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field.

  • Open Τools -> Board -> Board Manager and search for esp8266. Install ESP8266 platform (and don’t forget to select your Wemos D1 R2 Mini board from Tools –> Board menu after installation).

Step 2 (install libraries)

Assuming that you’ve installed a latest version of HackAir library (as described here) now it’s time to install some additional libraries for WeMos board and humidity sensor. You need the following 4 libraries:

Always install the latest version of each library.

WiFiManager by tzapu
  • in Arduino IDE got to Sketch/Include Library/Manage Libraries

  • search for WiFiManager

  • click Install
DHT sensor library by Adafruit
  • search for DHT sensor library

  • click Install
Unified sensor library by Adafruit
  • search for unified sensor abstraction layer

  • click Install
ESP8266WiFi by I.Grokhotkov
  • search for esp8266wifi built-in

  • click Install

Programming steps

Step 1 (load the Wemos example)

This example sketch is included with the hackAIR library and you can open it in the Arduino IDE by selecting Files → Examples → hackAIR → Wemos

Step 2 (insert your token)

You must fill in your Authentication Token at line 27 of the sketch, replacing AUTHORIZATION TOKEN while keeping the quote marks.

Note: The example assumes that you have SDS011 sensor. In case that you have another sensor change line 30 accordingly

Step 3 (connect to your WiFi network)

After uploading the sketch, the Arduino board will boot up and start broadcasting it’s own Access Point. To set the WiFi point credentials use your phone/tablet to connect to the Wemos’s AP (named ESP-Wemos) and navigate to http://192.168.4.1 . After insertion of connection details the Wemos will connect to your WiFi network.

Step 4 (Reset your Wemos)

…and start sending data.

After successfully connecting to your WiFi network the shield will store your password so it can automatically reconnect next time it’s powered up. To reset the saved password upload again the Wemos example (restart from step 1)

Warning

The transistor exists only on the hackAIR WiFi shield. If you are not using the WiFi shield you cannot use this method to control the sensor’s power.