loading

This project will regulate the humidity and temperature of any greenhouse through the use of heaters and fans. Additional tutorials will be added over time for automated watering and lighting, among other things.

Everything is done through the use of Arduino.

You will need:

  1. Temperature sensor
  2. Humidity sensor
  3. Relays (for connecting the Arduino to the electrical appliances)
  4. Character LCD
  5. A greenhouse

The temperature and humidity sensors frequently come together in a single sensor. Here is a DHT11 sensor from adafruit. It's cheap but gets the job done. The sensor used in this instructable (the AM2302 DHT22 sensor) works in the same way but refreshes more quickly, reads more accurately, and comes wired.

As for a Character LCD, any will do and they mostly operate in the same way. The one used in this instructable is the qc1602a v2.0.

Step 1: Setting Up the Character LCD

This is the trickiest part to the wiring of this project. The above chart shows how each connection from the LCD connects to the Arduino. It's much easier to set this up using a positive/negative breadboard rail, however I didn't have one available. In my setup I used a potentiometer between pin three and pin 1 because it allows for easily adjustable backlight. However this is not necessary and a 10K resistor will work in its place.

Step 2: Wiring the Humidity and Temperature Sensor

It is very simple to set up two separate sensors for this, however I used one sensor that reads both humidity and temperature. DHT sensors are cheap and able to read both temperature and humidity. They have four pins and connect as follows:

  1. VCC (3V-5V power)
  2. Data out
  3. No connection
  4. Ground

Attach a 10K resistor between the VCC and Data lines as well. A diagram is displayed above.

In order to use the DHT sensors you will need to download the DHT library. Here is one from Adafruit. In order to use it, download the DHT.cpp and DHT.h files and put them in a folder called "DHT" in your arduino "libraries" folder.

Here is a sample code from adafruit for your DHT sensor:

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#include "DHT.h"

#define DHTPIN 2 // what pin we're connected to

// Uncomment whatever type you're using! //#define DHTTYPE DHT11 // DHT 11 #define DHTTYPE DHT22 // DHT 22 (AM2302) //#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V // NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1 // to 3.3V instead of 5V! // Connect pin 2 of the sensor to whatever your DHTPIN is // Connect pin 4 (on the right) of the sensor to GROUND // Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor for normal 16mhz Arduino DHT dht(DHTPIN, DHTTYPE); // NOTE: For working with a faster chip, like an Arduino Due or Teensy, you // might need to increase the threshold for cycle counts considered a 1 or 0. // You can do this by passing a 3rd parameter for this threshold. It's a bit // of fiddling to find the right value, but in general the faster the CPU the // higher the value. The default for a 16mhz AVR is a value of 6. For an // Arduino Due that runs at 84mhz a value of 30 works. // Example to initialize DHT sensor for Arduino Due: //DHT dht(DHTPIN, DHTTYPE, 30);

void setup() { Serial.begin(9600); Serial.println("DHTxx test!"); dht.begin(); }

void loop() { // Wait a few seconds between measurements. delay(2000);

// Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(); // Read temperature as Celsius float t = dht.readTemperature(); // Read temperature as Fahrenheit float f = dht.readTemperature(true); // Check if any reads failed and exit early (to try again). if (isnan(h) || isnan(t) || isnan(f)) { Serial.println("Failed to read from DHT sensor!"); return; }

// Compute heat index // Must send in temp in Fahrenheit! float hi = dht.computeHeatIndex(f, h);

Serial.print("Humidity: "); Serial.print(h); Serial.print(" %\t"); Serial.print("Temperature: "); Serial.print(t); Serial.print(" *C "); Serial.print(f); Serial.print(" *F\t"); Serial.print("Heat index: "); Serial.print(hi); Serial.println(" *F"); }

Step 3: Testing the Character LCD and DHT Sensor

Above is a closer look at a test setup for the Character LCD and DHT22 sensor. The code loaded onto it displays the humidity and temperature readings from the sensor periodically. I will upload the code as soon as possible.

<p>Have you finished the actual controller part of the code?</p>
<p>This is just a read and display project and controls nothing, change the title or finish the project please.</p>
<p>Works perfect. It's not a project, <a href="https://www.instructables.com/member/mjonquiere" rel="nofollow">mjonquiere</a>, it's a tutorial (by Adafruit) to read the data from the sensor. Look for a Display tutorial and tweak the output.</p><p>I'm happy with it, it ables me to build my 'Office Atmosphere Monitor'. Thanks.</p>
<p>thanks friend</p>
<p>absolutely pointless where's the code, from what I can see here you're just a BTW</p>
<p>Code?</p>
<p>O.K.</p>
check my instructables to find out how to draw the degree sign on lcd.
Im really interested in this insructable, I never got the Dht to play nice with relays.

About This Instructable

68,104views

135favorites

License:

More by RichardP4:Arduino Greenhouse Control - Humidity and Temperature 
Add instructable to: