Stufin
Home Quick Cart Profile

AM2302 Temperature & Humidity Sensor

Buy Now

Name

AM2302 Temperature & Humidity Sensor

Description

The AM2302 is a digital temperature and humidity sensor module designed for various Internet of Things (IoT) applications, home automation, and environmental monitoring projects. This sensor module is capable of measuring both temperature and relative humidity with high accuracy and reliability.

Functionality

The AM2302 sensor module is designed to measure the ambient temperature and relative humidity in the surrounding environment. It uses a thermistor to measure temperature and a capacitive humidity sensor to measure relative humidity. The sensor module outputs digital signals that can be easily read by microcontrollers such as Arduino, Raspberry Pi, or other IoT development boards.

Key Features

  • Temperature Measurement:

Measurement range

0% to 99.9% RH (Relative Humidity)

Accuracy

2% RH

Resolution

0.1% RH

  • Digital Output:

Output format

Digital serial signal (Manchester code)

Communication protocol

Single-bus communication protocol

  • Power Supply:

Operating voltage

3.3V to 5.5V

Current consumption

<2mA (average)

  • Other Features:

High accuracy and reliability

Fast response time

Low power consumption

Compatible with various microcontrollers and development boards

  • Package:

The AM2302 sensor module is typically packaged in a compact, 3-pin (VCC, GND, OUT) SIP (Single In-Line Package) module with a dimension of 15mm x 10mm x 5mm.

  • Operating Conditions:

Operating temperature

-40C to 80C (-40F to 176F)

Storage temperature

-50C to 100C (-58F to 212F)

Applications

  • Weather stations and environmental monitoring systems
  • Home automation and smart building systems
  • Industrial control and automation systems
  • IoT projects and prototyping
  • Robotics and drone applications
  • HVAC (Heating, Ventilation, and Air Conditioning) systems

Note

Before using the AM2302 sensor module, please refer to the datasheet for specific usage guidelines, calibration requirements, and any necessary precautions to ensure accurate and reliable measurements.

Pin Configuration

  • AM2302 Temperature & Humidity Sensor Documentation
  • Pin Description
  • The AM2302 Temperature & Humidity Sensor is a digital sensor that measures temperature and humidity with high accuracy. It has a total of 3 pins, which are described below:
  • Pin 1: VCC (Power Supply)
  • Function: Provides power to the sensor
  • Voltage: Typically 3.3V to 5V DC
  • Description: Connect this pin to a stable power source to power the sensor.
  • Pin 2: DATA (Digital Output)
  • Function: Outputs digital data representing temperature and humidity measurements
  • Signal: Digital signal, typically using a single-bus protocol
  • Description: This pin outputs digital data that can be read by a microcontroller or other digital devices. The data is transmitted in a specific protocol, which can be decoded using a suitable library or algorithm.
  • Pin 3: GND (Ground)
  • Function: Provides a ground reference for the sensor
  • Description: Connect this pin to a common ground point in your circuit to provide a stable reference voltage.
  • Connecting the Pins
  • To connect the AM2302 sensor, follow this structure:
  • Step 1: Connect Pin 1 (VCC) to a stable power source (e.g., a 3.3V or 5V power rail) on your board.
  • Step 2: Connect Pin 2 (DATA) to a digital input pin on your microcontroller or other digital device.
  • Step 3: Connect Pin 3 (GND) to a common ground point on your board.
  • Important Considerations
  • Make sure to use a suitable voltage regulator or power supply to provide a stable voltage to the sensor.
  • Use a pull-up resistor (typically 1k to 10k) on the DATA pin to ensure stable communication.
  • Ensure proper grounding to prevent noise and electrical interference.
  • By following these connection guidelines and considering the important considerations, you can successfully integrate the AM2302 Temperature & Humidity Sensor into your IoT project.

Code Examples

AM2302 Temperature & Humidity Sensor Documentation
Overview
The AM2302 is a digital temperature and humidity sensor that uses a capacitive sensor to measure relative humidity and a thermistor to measure temperature. It is a popular choice for IoT applications due to its high accuracy, wide range, and low power consumption.
Pinout
The AM2302 sensor has four pins:
VCC: Power supply (3.3V to 5V)
 GND: Ground
 DOUT: Digital output (1-wire protocol)
Communication Protocol
The AM2302 uses a 1-wire protocol to communicate with the microcontroller. The protocol consists of a 40-bit data frame, which includes:
16 bits for humidity data
 16 bits for temperature data
 8 bits for checksum
Code Examples
Example 1: Raspberry Pi (Python)
This example uses the `pyAM2302` library to read temperature and humidity data from the AM2302 sensor connected to a Raspberry Pi.
```python
import time
from pyAM2302 import AM2302
# Create an instance of the AM2302 class
sensor = AM2302()
while True:
    # Read temperature and humidity data
    temperature, humidity = sensor.read()
# Print the data
    print(f'Temperature: {temperature:.1f}C, Humidity: {humidity:.1f}%')
# Wait for 1 second before taking the next reading
    time.sleep(1)
```
Example 2: Arduino (C++)
This example uses the `DHT` library to read temperature and humidity data from the AM2302 sensor connected to an Arduino board.
```c++
#include <DHT.h>
#define DHTPIN 2 // Pin 2 for data output
DHT dht(DHTPIN, DHTTYPE);
void setup() {
  Serial.begin(9600);
  dht.begin();
}
void loop() {
  // Wait a few seconds between readings
  delay(2000);
// Read temperature and humidity data
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();
// Print the data
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" C");
Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println(" %");
}
```
Example 3: ESP32 (MicroPython)
This example uses the `machine` module to read temperature and humidity data from the AM2302 sensor connected to an ESP32 board.
```python
import machine
import utime
# Create a onewire object
ow = machine.Pin(4)  # Pin 4 for data output
d = machine.DHT(ow, machine.DHT.AM2302)
while True:
    # Read temperature and humidity data
    d.measure()
# Print the data
    print(f'Temperature: {d.temperature():.1f}C, Humidity: {d.humidity():.1f}%')
# Wait for 1 second before taking the next reading
    utime.sleep(1)
```
Note: Make sure to install the required libraries and adapt the pin connections according to your specific setup.