Stufin
Home Quick Cart Profile

ESP-01S DHT11 Temperature Humidity Sensor module

Buy Now on Stufin

Temperature Range

-40C to 80C

Humidity Range

0-100% RH

Accuracy

1C (temperature), 5% RH (humidity)

  • Serial Interface: UART
  • GPIO Pins: 8
  • Reset Button: Yes
  • Power Supply: 3.3V - 5.5V
  • Current Consumption: < 200mA
  • Dimensions: 22mm x 18mm x 10mm

Conclusion

The ESP-01S DHT11 Temperature Humidity Sensor Module is a versatile and powerful IoT module that combines Wi-Fi capabilities, a microcontroller, and a temperature and humidity sensor in a compact package. Its low power consumption, compact design, and ease of use make it an ideal choice for a wide range of applications, including environmental monitoring, home automation, industrial automation, and IoT projects.

Pin Configuration

  • ESP-01S DHT11 Temperature Humidity Sensor Module Pinout Guide
  • The ESP-01S DHT11 Temperature Humidity Sensor module is a compact and versatile module that integrates an ESP-01S microcontroller and a DHT11 temperature and humidity sensor. This module is ideal for IoT projects that require wireless connectivity and environmental sensing. Here's a detailed breakdown of the module's pins and how to connect them:
  • Pinout Structure:
  • The ESP-01S DHT11 module has a total of 8 pins, which are arranged in two rows of 4 pins each. The pinout structure is as follows:
  • Row 1:
  • 1. VCC (Red Wire)
  • Description: Power supply pin for the module (3.3V or 5V)
  • Connection: Connect to a 3.3V or 5V power source
  • 2. RX (White Wire)
  • Description: Receive pin for serial communication
  • Connection: Connect to the TX pin of a serial communication device (e.g., USB-to-TTL serial adapter)
  • 3. TX (Green Wire)
  • Description: Transmit pin for serial communication
  • Connection: Connect to the RX pin of a serial communication device (e.g., USB-to-TTL serial adapter)
  • 4. GND (Black Wire)
  • Description: Ground pin for the module
  • Connection: Connect to a common ground point in your circuit
  • Row 2:
  • 1. DHT11 VCC (Red Wire)
  • Description: Power supply pin for the DHT11 sensor (3.3V or 5V)
  • Connection: Connect to a 3.3V or 5V power source (typically connected to the VCC pin in Row 1)
  • 2. DHT11 DATA (Yellow Wire)
  • Description: Data pin for the DHT11 sensor
  • Connection: Connect to a digital input pin on your microcontroller (e.g., Arduino or Raspberry Pi)
  • 3. RST (Blue Wire)
  • Description: Reset pin for the ESP-01S microcontroller
  • Connection: Typically left unconnected or connected to a reset button
  • 4. CH_PD (No Wire)
  • Description: Chip Enable pin for the ESP-01S microcontroller (not used in this module)
  • Important Connection Notes:
  • Make sure to connect the VCC pin to a 3.3V or 5V power source, as the module is not 5V tolerant.
  • The DHT11 sensor requires a separate power connection, but it can be connected to the same power source as the ESP-01S microcontroller.
  • The RX and TX pins are used for serial communication and should be connected to a serial communication device, such as a USB-to-TTL serial adapter.
  • The RST pin is typically left unconnected or connected to a reset button to reset the ESP-01S microcontroller.
  • By following this pinout guide, you can successfully connect the ESP-01S DHT11 Temperature Humidity Sensor module to your microcontroller or development board and start collecting temperature and humidity data wirelessly.

Code Examples

ESP-01S DHT11 Temperature Humidity Sensor Module Documentation
Overview
The ESP-01S DHT11 Temperature Humidity Sensor Module is a versatile and compact IoT component that integrates a DHT11 temperature and humidity sensor with an ESP-01S Wi-Fi module. This module allows for easy measurement of temperature and humidity levels and wirelessly transmits the data to a connected device.
Technical Specifications
DHT11 Temperature and Humidity Sensor:
	+ Temperature range: 0C to 50C
	+ Humidity range: 20% to 80% RH
	+ Accuracy: 2C (temperature), 5% RH (humidity)
 ESP-01S Wi-Fi Module:
	+ Wi-Fi protocol: 802.11 b/g/n
	+ Frequency: 2.4 GHz
	+ Data rate: up to 150 Mbps
Connecting the Module
To connect the ESP-01S DHT11 module, follow these steps:
1. Connect the VCC pin to a 3.3V power source.
2. Connect the GND pin to a ground pin.
3. Connect the RX pin to the TX pin of your serial communication device (e.g., serial monitor).
4. Connect the TX pin to the RX pin of your serial communication device.
5. Connect the DHT11 sensor pins to the corresponding pins on the ESP-01S module.
Code Examples
### Example 1: Basic Temperature and Humidity Readings
This example demonstrates how to read temperature and humidity values from the DHT11 sensor and print them to the serial monitor using the Arduino IDE.
```c
#include <DHT.h>
#define DHT_PIN 2 // DHT11 sensor pin connected to ESP-01S pin 2
DHT dht(DHT_PIN, DHT11);
void setup() {
  Serial.begin(115200);
  dht.begin();
}
void loop() {
  int temperature = dht.readTemperature();
  int humidity = dht.readHumidity();
  
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" C");
  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println(" % RH");
  
  delay(2000);
}
```
### Example 2: Wi-Fi Connected Temperature and Humidity Monitoring
This example demonstrates how to connect the ESP-01S module to a Wi-Fi network and send temperature and humidity readings to a remote server using the ESP8266 core library.
```c
#include <WiFi.h>
#include <DHT.h>
#define DHT_PIN 2 // DHT11 sensor pin connected to ESP-01S pin 2
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASSWORD "your_wifi_password"
#define SERVER_URL "http://example.com/temperaturehumidity"
DHT dht(DHT_PIN, DHT11);
WiFiClient client;
void setup() {
  Serial.begin(115200);
  dht.begin();
  
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  
  Serial.println("Connected to WiFi");
  Serial.println("Initializing HTTP client...");
}
void loop() {
  int temperature = dht.readTemperature();
  int humidity = dht.readHumidity();
  
  String httpRequest = "GET " + String(SERVER_URL) + "?temperature=" + String(temperature) + "&humidity=" + String(humidity) + " HTTP/1.1
";
  httpRequest += "Host: " + String(SERVER_URL) + "
";
  httpRequest += "Connection: close

";
  
  client.print(httpRequest);
  
  delay(2000);
}
```
### Example 3: MQTT-Based Temperature and Humidity Monitoring (Optional)
This example demonstrates how to connect the ESP-01S module to an MQTT broker and publish temperature and humidity readings as MQTT messages using the PubSubClient library.
```c
#include <WiFi.h>
#include <DHT.h>
#include <PubSubClient.h>
#define DHT_PIN 2 // DHT11 sensor pin connected to ESP-01S pin 2
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASSWORD "your_wifi_password"
#define MQTT_BROKER "mqtt://example.com:1883"
#define MQTT_TOPIC "temperaturehumidity"
DHT dht(DHT_PIN, DHT11);
WiFiClient espClient;
PubSubClient client(espClient);
void setup() {
  Serial.begin(115200);
  dht.begin();
  
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  
  Serial.println("Connected to WiFi");
  Serial.println("Initializing MQTT client...");
  
  client.setServer(MQTT_BROKER, 1883);
}
void loop() {
  int temperature = dht.readTemperature();
  int humidity = dht.readHumidity();
  
  char temperatureBuffer[10];
  char humidityBuffer[10];
  dtostrf(temperature, 6, 2, temperatureBuffer);
  dtostrf(humidity, 6, 2, humidityBuffer);
  
  client.publish(MQTT_TOPIC, ("Temperature: " + String(temperatureBuffer) + " C, Humidity: " + String(humidityBuffer) + " % RH").c_str());
  
  delay(2000);
}
```
Note: In this example, you need to replace the placeholders with your actual Wi-Fi SSID, password, MQTT broker URL, and topic.