WIFI D1 mini - shield contact Relay

WIFI D1 mini - shield contact Relay

WIFI D1 mini - T&H sensor shield - DHT22

WIFI D1 mini - T&H sensor shield - DHT22

WIFI D1 mini - T&H sensor shield - DHT11

Temperature and Humidity sensor shield for WeMos / WiFi D1 mini PRO, with pin headers.

$2.99
Availability: In stock
SKU
6970622930778
  • Buy 5 for $2.73 each and save 9%
  • Buy 15 for $2.47 each and save 17%
  • Buy 35 for $2.21 each and save 26%

Temperature and Humidity sensor shield for WeMos / WiFi D1 mini PRO, with pin headers.

The set includes:

  1. DHT11 Sensor Shield — 1pc
  2. Male Pin Header 1×8pins — 2pcs
  3. Female Pin Header — BLACK 1×8pins — 2pcs
  4. Stackable Header — BLACK 1×8pins — 2pcs

DHT11 is an accurate and inexpensive the Temperature and Humidity sensor shield. The sensor includes an 8-bit ADC and provides reliable output results. It covers the needs of most home and everyday application conditions.

Technical details:

  • Input voltage: 3.3V
  • Current draw: 2.5mA MAX (in active state when data is requested)
  • Humidity range: 20-90% ±5%
  • Temperature range: 0-50°C ±2%
  • Sampling rate: ≤1 Hz
Write Your Own Review
Only registered users can write reviews. Please Sign in or create an account

You can create a standalone Web server for display of temperature in the browser or through applications of Blynk service.

 

Watch the video demonstration below

 

 

Required components:

 

Assembly and connection:

  1. Solder pinheaders to the DHT11 shield, you can choose the pinheaders (female, male, stackable) that are convenient for you
  2. On the bottom side of the DHT11 shield, there are solder jumpers to connect to the I/O. In the code, we use I/O 4 (D2). Cut off the default jumper and solder on the jumper D2. Also, you can use a port by default or other available I/O.
  3. Stackable the DHT11 shield on the WIFI D1 MINI controller.
  4. Connect a micro-USB cable.

 

Installation of DHT Sensor library

  1. Download and unzip DHT-sensor library.
  2. Rename the unpacked folder on DHT.

  3. Move the DHT folder to the "libraries" IDE Arduino folder. If IDE Arduino automatically does not find library, pls restart IDE Arduino.

 

Upload of the code on WiFi D1 MINI

!!! At first, be convinced that in Arduino IDE installed the add-on for WiFi D1 MINI board.

 In Arduino IDE: Tools->Board->Wemos D1 Mini Pro.

Copy the code below in Arduino IDE. Replace SSID and the password with those that correspond to your network. Upload code it on WiFi D1 MINI

/*********
  Rui Santos
  Complete project details at https://randomnerdtutorials.com 
*********/

// Including the ESP8266 WiFi library
// подключаем библиотеку «ESP8266WiFi»

#include <ESP8266WiFi.h>
#include "DHT.h"
	
// Uncomment one of the lines below for whatever DHT sensor type you're using!
// Раскомментируйте строчк, подключаемого DHT датчика:
#define DHTTYPE DHT11   // DHT 11
//#define DHTTYPE DHT21   // DHT 21 (AM2301)
//#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321

// Replace with your network details
// вписываем здесь данные для своей WiFi-сети:
const char* ssid = "your-ssid"; //YOUR_NETWORK_NAME
const char* password = "your-password"; //YOUR_NETWORK_PASSWORD

// Web Server on port 80
// веб-сервер на порте 80:
WiFiServer server(80);

// DHT Sensor pin
// Пин датчик DHT:
const int DHTPin = 4; // Pin4 (D2 pin on WiFi D1 mini)
// Initialize DHT sensor.
// инициализируем датчик DHT:
DHT dht(DHTPin, DHTTYPE);

// Temporary variables
// Используемые временные переменные
static char celsiusTemp[7];
static char fahrenheitTemp[7];
static char humidityTemp[7];

// only runs once on boot
// этот блок будет запускаться при старте контррллера:
void setup() {
  // Initializing serial port for debugging purposes
  // инициализируем последовательный порт отладки через монитор:
  Serial.begin(115200);
  delay(10);

  dht.begin();
  
  // Connecting to WiFi network
  // подключаемся к WiFi-сети:
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  
  // Starting the web server
  // Запуск веб-сервера:
  server.begin();
  Serial.println("Web server running. Waiting for the ESP IP...");
  delay(10000);
  
  // Printing the ESP IP address
  // Выводим IP-адрес ESP:
  Serial.println(WiFi.localIP());
}

// runs over and over again
// Цилкличный блок:
void loop() {
  // Listenning for new clients
  // Слушаем новых клиентов (подключения):
  WiFiClient client = server.available();
  
  if (client) {
    Serial.println("New client");
    // bolean to locate when the http request ends
	// логическая переменная, для определения конца http-запроса
    boolean blank_line = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        
        if (c == '\n' && blank_line) {
            // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
			// данные от датчика могут запаздывать на 2 секунды (это очень медленный датчик):
            float h = dht.readHumidity();
            // Read temperature as Celsius (the default)
			// считываем температуру в Цельсиях (по умолчанию):
            float t = dht.readTemperature();
            // Read temperature as Fahrenheit (isFahrenheit = true)
			// считываем температуру в Фаренгейтах  (isFahrenheit = true)
            float f = dht.readTemperature(true);
            // Check if any reads failed and exit early (to try again).
			// проверяем, корректны ли считанные данные. Если нет, то выходим и начинаем заново:
            if (isnan(h) || isnan(t) || isnan(f)) {
              Serial.println("Failed to read from DHT sensor!");
              strcpy(celsiusTemp,"Failed");
              strcpy(fahrenheitTemp, "Failed");
              strcpy(humidityTemp, "Failed");         
            }
            else{
              // Computes temperature values in Celsius + Fahrenheit and Humidity
			  // Рассчитываем градусы в Цельсиях и Фаренгейтах, а также влажность
              float hic = dht.computeHeatIndex(t, h, false);       
              dtostrf(hic, 6, 2, celsiusTemp);             
              float hif = dht.computeHeatIndex(f, h);
              dtostrf(hif, 6, 2, fahrenheitTemp);         
              dtostrf(h, 6, 2, humidityTemp);
              // You can delete the following Serial.print's, it's just for debugging purposes
			  // Нижеследующие Serial.print() можно удалить, т.к. они для отладочных целей
              Serial.print("Humidity: ");
              Serial.print(h);
              Serial.print(" %\t Temperature: ");
              Serial.print(t);
              Serial.print(" *C ");
              Serial.print(f);
              Serial.print(" *F\t Heat index: ");
              Serial.print(hic);
              Serial.print(" *C ");
              Serial.print(hif);
              Serial.print(" *F");
              Serial.print("Humidity: ");
              Serial.print(h);
              Serial.print(" %\t Temperature: ");
              Serial.print(t);
              Serial.print(" *C ");
              Serial.print(f);
              Serial.print(" *F\t Heat index: ");
              Serial.print(hic);
              Serial.print(" *C ");
              Serial.print(hif);
              Serial.println(" *F");
            }
            client.println("HTTP/1.1 200 OK");
            client.println("Content-Type: text/html");
            client.println("Connection: close");
            client.println();
            // your actual web page that displays temperature and humidity
			// Актуальная веб-страница, отображающая температуру и влажность. Формируем HTML-код:
            client.println("<!DOCTYPE HTML>");
            client.println("<html>");
            client.println("<head></head><body><h1>ESP8266 - Temperature and Humidity</h1><h3>Temperature in Celsius: ");
            client.println(celsiusTemp);
            client.println("*C</h3><h3>Temperature in Fahrenheit: ");
            client.println(fahrenheitTemp);
            client.println("*F</h3><h3>Humidity: ");
            client.println(humidityTemp);
            client.println("%</h3><h3>");
            client.println("</body></html>");     
            break;
        }
        if (c == '\n') {
          // when starts reading a new line
		  // если обнаружен переход на новую строку
          blank_line = true;
        }
        else if (c != '\r') {
          // when finds a character on the current line
		  // если в текущей строчке найден символ
          blank_line = false;
        }
      }
    }  
    // closing the client connection
	// закрываем соединение с клиентом
    delay(1);
    client.stop();
    Serial.println("Client disconnected.");
  }
}   

 

Result:

Open the Arduino IDE serial monitor at a baud rate of 115200. After a few seconds, your IP address should appear.

Open any browser on the device connected to the router (the smartphone or PC). Open the IP address shown in the COM monitor of Arduino IDE. As a result, the browser should show:

 


Blynk service

 Blynk is a platform with iOS and Android apps to control Arduino, Raspberry Pi and the likes over the Internet. You can easily build graphic interfaces for all your projects by simply dragging and dropping widgets.

Downloads, docs, tutorials: http://www.blynk.cc

Download latest Blynk library here: https://github.com/blynkkk/blynk-library/releases/latest

Upload of the code on WiFi D1 MINI

Copy the code below in Arduino IDE. Replace SSID and the password with those that correspond to your network. Upload code it on WiFi D1 MINI

 

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************

  This example shows how value can be pushed from Arduino to
  the Blynk App.
  
  App project setup:
    Value Display widget attached to V5
    Value Display widget attached to V6
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Your auth";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "your-ssid";
char pass[] = "your-password";

#define DHTPIN 4          // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  dht.begin();

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run();
  timer.run();
}

 

Result:

Open the Blynk app on the device. For download app, docs, tutorials: http://www.blynk.cc

Documents

Dimensional drawing

Dimensions WIFI D1 mini - T&H sensor shield - DHT11 Dimensions WIFI D1 mini - T&H sensor shield - DHT11

Pinout

Pinout WIFI D1 mini - T&H sensor shield - DHT11 Pinout WIFI D1 mini - T&H sensor shield - DHT11

Schematic

Schematic of WIFI D1 mini - T&H sensor shield - DHT11