// The University of Arizona // College of Engineering * 2021 Summer Engineering Academy * // Biosystems Engineering Department // Vegetation Index and Phenology Lab (vip.arizona.edu) // Dr. Kamel Didan // Dr. Armando Barreto Munoz // Mr. Truman P. Combs // Ms. Madeline Melichar // Learn about our lab at this site vip.arizona.edu /* We work in the following fields * We work with NASA on their Earth Observing Satellites * We develop Image processing tools and science algorithms * We teach Engineers about UAS & Drones and Proximal sensing to monitor and observe the Environment * We work with Big Geospatial data, the science required to work with it, and implement Machine Learning tools for smart solution to environemental monitoring * And More..... */ /* About this Project ======================== This Arduino program will communicate with a temperature and humidity sensor (DHT22 or AHT10) It wil then collect data and displays it to the serial monitor or serial plotter If you wish you can capture this data & analyze and/or plot it */ // Libraries to work with the Temp and Humidity sensors #include // Library for DHT22 // Define the pins to where the LEDS will be attached #define LED_Humidity_Pin 3 // D3 PIN - This LED will glow if Humidity exceeds a certain number #define LED_Temp_Pin 4 // D3 PIN - This LED will glow if Temperature exceeds a certain number // Define the pin to which the DHT22 sensor will be attched #define DHT22_Pin 2 // D2 PIN dht DHT; // Create a DHT object to work with the sensors and library // Declare Global variables for Temp and Humidity to hold the data read by the sensor float DHT22_Humidity,DHT22_Temp; void setup() { // Initialize the communication protocol Serial.begin(9600); // Use a 9600 Baud Rate - basically a speed of communication // Set the LED output for humidity and Temp pinMode(LED_Humidity_Pin, OUTPUT); // Set the LED as an output mode so we can send a pulse to it when needed pinMode(LED_Temp_Pin, OUTPUT); // Set the LED as an output mode so we can send a pulse to it when needed // Create label for the plot if needed Serial.flush(); Serial.println("DHT22_Temp , DHT22_Humidity"); } void loop() { // Call a function that reads the data form the DHT22 sensor Get_DHT22_Data(); // Print the data in order so it could be labelled & plotted Serial.print(DHT22_Temp);Serial.print(","); Serial.print(DHT22_Humidity); Serial.println(); // Test the Status of Humidity and Temperature and turn ON/OFF the corresponding LED if (DHT22_Humidity > 30){ digitalWrite(LED_Humidity_Pin, HIGH); // Turn the LED on (HIGH is the voltage level) delay(250); // Wait for a quarter of a second digitalWrite(LED_Humidity_Pin, LOW); // Turn the LED off by making the voltage LOW delay(250); // Wait for a quarter of a second } if (DHT22_Temp > 30.0){ digitalWrite(LED_Temp_Pin, HIGH); delay(250); digitalWrite(LED_Temp_Pin, LOW); delay(250); } } void Get_DHT22_Data(){ // Read the Sensor data int readData = DHT.read22(DHT22_Pin); // Reads the data from the sensor DHT22_Temp = DHT.temperature; // Gets the values of the temperature DHT22_Humidity = DHT.humidity; // Gets the values of the humidity }