Building Temperature and Relative Humidity Sensors for
Obtaining Greenhouse Environmental Data
Patrick Dean Jr. Objectives The purpose of the mini project was to create a device that is capable of monitoring air temperature and relative humidity changes in a greenhouse. The intent of this project involves: 1) Learning Arduino Uno and sensors, 2) Learning fundamental basics of creating circuits, 3) Learning basics of C language for coding in Arduinos Integrated Development Environment (IDE) Program, 4) Learn microcontroller technology and impact of using microcontrollers to create monitoring systems in Agriculture. Introduction
In order to remotely monitor the ambient temperature and humidity within a greenhouse at constant intervals throughout the day an Environmental monitoring device was created. The Environmental Monitoring device created has 5 major components: the Arduino Uno microcontroller, the lm35 Temperature Sensor by Cytron Technologies, the HR202 Humidity Sensor by Cytron Technologies, the breadboard to create the temporary circuit, and the Arduino Integrated Development Environment (IDE) to create and run source code.
Introduction The Arduino Uno is a microcontroller that has 14 digital input/output pins, a power jack, USB connection, and reset button. Depending on the amount of power needed for all of the sensors to function the USB connection can power the microcontroller as well as the power jack.
Introduction The lm35 temperature sensor is a precision centigrade temperature sensor with an integrated circuit. The output voltage is linearly proportional to temperature in degrees Celsius at 10 mv per degree C.
Introduction The humidity sensor module is mounted with the HR202 Humidity Sensor. The HR202 is a basic sensor that only needs a source of power to begin operation.
Methodology The project was carried out in the following stages: Research and Analysis of components of needed Design of circuit Design Implementation Testing.
Methodology Process: Wire lm35 and Arduino Uno to the breadboard Create and test code for lm35 temperature sensor Add LED to circuit Test temperature sensor and code for accurate readings Wire HR202 Humidity Sensor to the breadboard Create and test code independently Test both Temperature and Humidity Sensor together for accurate readings
Methodology We created a couple of different source codes before we created one that worked. We made sure the temperature sensor and humidity sensor worked independently before getting them to work together.
//Pins in use: //LED: D2 //Temperature sensor: A0
const int inPin = 0; //sensor connected to this analog pin const int threshold = 35; // the degree Celsius that will trigger output int led = 2; //digital output pin
void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); Serial.begin(9600);//data read in bps for serial data transmission }
void loop() { int value = analogRead (inPin); long Celsius = (value*500L)/1024; // 10 mV per degree C Serial.print (celsius); Serial print (degrees Celsius: ); if(celsius>threshold) { digitalWrite (output, HIGH); Serial.println(pin is on); pinMode(2, OUTPUT); digitalWrite(2, HIGH); } else { digitalWrite(outPin, LOW); Serial.println(pin is off); pinMode(2, OUTPUT); digitalWrite(2, LOW); } delay(1000);//wait for one second
} Turn on the LED when temperature goes above 35C Methodology Created a couple of different source codes before we created one that worked. We made sure the temperature sensor and humidity sensor worked independently before getting them to work together.
Turn on the LED when temperature goes above 35C Methodology The Arduino Unos connection to the breadboard requires connections from certain pins to the breadboard: the power pin is the 5 volt pin, the ground pin, and the analog pin.
Methodology The lm35 sensor has its positive terminal pinned to 5 volts by way of the breadboard. The ground terminal is wired on the breadboard to connect with the ground pin on the Arduino Uno. The output terminal is pinned to Analog 0 (A0) on the Arduino Uno.
Methodology The HR202 humidity sensor has 4 pins: positive and negative pins connected to 5 volts power, 1 ground pin, and 1 analog pin, A1. Methodology
The LED is wired to digital ground pin with its resistor wired to digital pin 13 (on the Arduino Uno). Results
int inPin = A0; //sensor connected to this analog pin int RelHum = A1; // RH sensor int led = 13; //digital output pin int redled = 5; // digital output pin
void setup() { // initialize the digital pin as an output. Serial.begin(9600);//data read in bps for serial data transmission pinMode(led, OUTPUT); pinMode(inPin, INPUT); pinMode(yellowled, OUTPUT); pinMode(RelHum, INPUT); } void loop() { int value = analogRead(inPin);
float humidity = analogRead(RelHum); long celcius = (value*500L)/1024; // 10 mV per degree C
Serial.print("Temperature="); Serial.println(celcius); Serial.print("Relative humidity="); Serial.println(humidity); Serial.print("\n"); if(celcius>30) { digitalWrite (led, HIGH); //Serial.print("Pin is on"); //Serial.print("\n"); } else { digitalWrite(led, LOW); //Serial.print("Pin is off"); //Serial.print("\n"); } //if(humidity<25) //{digitalWrite(redled, HIGH); //Serial.print("Misting on"); //Serial.print("\n"); //Serial.print("\n"); //} /*else {digitalWrite(redled, LOW); Serial.print("Misting off"); Serial.print("\n"); Serial.print("\n"); }*/ delay(1000);//wait for one second } Results
Results
Results Use sensors to construct a Wireless Sensor Network System (WSN) Future Works WSN sensors collect environmental information inside the greenhouse The sensor manager acquires environmental data The database stores data The web server monitors data through Web browser Future Works Application Layer Hourly data obtained Environment monitoring service MAC and Network Layer Database WSN interface and Sensor manager Web server Physical Layer Soil moisture sensor Ambient temperature and RH sensor Soil temperature sensor Solar radiation sensor A Special Thanks to: Angelina Ho Mei Yi Dr. Christopher Teh Boon Sung Dr. Ionel Grozescu