1. Group assignment:
probe an input device's analog levels and digital signals.
2. Individual assignment:
measure something: add a sensor to a microcontroller board
that you have designed and read it.
an input device is a piece of equipment used to provide data and control signals to an information processing system, such as a computer or information appliance. Examples of input devices include keyboards, computer mice, scanners, cameras, joysticks, and microphones.
DHT11 :- The DHT11 is a commonly used Temperature and humidity sensor that comes with a dedicated NTC to measure temperature and an 8-bit microcontroller to output the values of temperature and humidity as serial data.
DHT11 Pinout Configuration
DHT11 Specifications :-
Operating Voltage: 3.5V to 5.5V
Operating current: 0.3mA (measuring) 60uA (standby)
Output: Serial data
Temperature Range: 0°C to 50°C
Humidity Range: 20% to 90%
Resolution: Temperature and Humidity both are 16-bit
Accuracy: ±1°C and ±1%
#_Connections_:)
XIAO ESP32C3 --> DHT11
3V3(VCC) --> VCC pin
D10 --> Data pin
GND --> Ground pin
#_Program_:)
#include < DHT.h >
#define DHTPIN 10 // Digital pin connected to the DHT sensor, change to D10
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
delay(1000); // Delay between sensor readings
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print("%\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println("°C");
}
#_Output_:)
#_My_PCB_:)