Input Devices

Assignment in Progress

Group assignment: Probe an input device(s)'s analog levels and digital signals Document your work on the group work page and reflect on your individual page what you learned Individual assignment: Measure something: add a sensor to a microcontroller board that you have designed and read it.

#include dht DHT; #define DHT11_PIN 7 void setup(){ Serial.begin(9600);} void loop(){ int chk = DHT.read11(DHT11_PIN); Serial.print("Temperature: "); Serial.println(DHT.temperature); delay(1000);} In this Arduino sketch, I have structured a program that interfaces with a DHT11 temperature and humidity sensor. Below is a breakdown of the programming process I utilized, described from your perspective: Library Inclusion: - I included the dht.h library, which provides functions to interact with DHT series sensors like the DHT11. Sensor Pin Definition: - I set DHT11_PIN as 7 to identify the pin connected to the DHT11 sensor. Setup Initialization: - Within the setup() function: - I initiated serial communication with a baud rate of 9600 using Serial.begin(), enabling communication with the serial monitor. Main Loop Functionality: - In the loop() function: - I employed DHT.read11(DHT11_PIN) to read data from the DHT11 sensor connected to pin 7 and stored the result in chk. - The temperature reading from the sensor (DHT.temperature) is printed to the serial monitor using Serial.print() and Serial.println(). - A delay of 1000 milliseconds (1 second) is incorporated with delay(1000) to control the rate of temperature readings. Execution Flow: - The program continually loops through reading the temperature from the DHT11 sensor at pin 7, displaying the temperature value on the serial monitor every second. The DHT11 sensor is a popular digital temperature and humidity sensor module used in various electronics projects. Here's a description of the DHT11 sensor as an input device in your program: Functionality: The DHT11 sensor can measure both temperature and humidity levels in the surrounding environment. It provides digital output that can be read by a microcontroller. Connection: The DHT11 sensor typically has three pins: VCC (power supply), data (signal output), and GND (ground). In your program, the data pin of the DHT11 sensor is connected to pin 7 of the Arduino board. Communication Protocol: The DHT11 sensor communicates using a proprietary single-wire digital protocol. It sends data in the form of a serial bit stream that contains the temperature and humidity readings. Readings: When the Arduino reads data from the DHT11 sensor, it receives digital values representing the temperature and humidity levels. These values are then processed and used in your program for further operations. Accuracy: The DHT11 sensor is known for its simplicity and affordability. However, compared to more advanced sensors like the DHT22, the DHT11 has lower accuracy and a limited measurement range. Application: The DHT11 sensor is commonly used in projects where basic temperature and humidity monitoring is required, such as weather stations, environmental monitoring systems, and smart home automation.