Week 11

Home Assignment

Input Devices

#_Tasks_:)

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.

#_What are Input Devices?

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.

Image

DHT11 Pinout Configuration

Image

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

Image

#_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_:)

Image

#_My_PCB_:)

Image


FAB ACADEMY - Akash Mhais 😎