0% found this document useful (0 votes)
8 views2 pages

Arduino Final Project Incubator Eggs

Uploaded by

Musa Arys
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Arduino Final Project Incubator Eggs

Uploaded by

Musa Arys
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include "DHT.

h"
#include <LiquidCrystal.h>
#define DHTPIN 2 // digital pin we're connected to pin 2
#define RELAYPIN 3
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
// pin vss to gnd
// pin vdd to +5vdc
// pin v0 t0 middle potensiometer 10k
// potensiometer 10k pin left to +5vdc
// potensiometer 10k pin right to GND
// pin rs to arduino pin 12
// pin rw to gnd
// pin E to arduino pin 11
// pin D4 to arduino pin 7
// pin D5 to arduino pin 6
// pin D6 to arduino pin 5
// pin D7 to arduino pin 4
// pin A to resistor (red, red, brown, gold)
// resistor (red, red, brown, gold) to +5vdc
// pin K to gnd
// arduino pin 3 to relay In1
// DHT pin 1 in right side to +5vdc
// DHT pin 2 to resistor (red, red, brown, gold)
// resistor (red, red, brown, gold) to arduino pin 2
// DHT pin 4 to GND

#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321

// 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.


// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors. This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.
DHT dht(DHTPIN, DHTTYPE);

void setup() {
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.print("Home Made Musa");
lcd.setCursor(0,1);
lcd.print("incubator EGGS");

// setup the Tempt/Humidity Sensor


dht.begin();

// Setup relay
pinMode(RELAYPIN, OUTPUT);
}

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 humidity = dht.readHumidity(true);


// Read temperature as Celcius
float temp = dht.readTemperature();

// Check if any reads failed and exit early (to try again).
if (isnan(humidity) || isnan(temp)) {
Serial.println("Failed to read from DHT sensor!");
return;
}

if (temp < 30.70) {


digitalWrite(RELAYPIN, LOW);
} else if (temp > 30.90) {
digitalWrite(RELAYPIN, HIGH);
}

lcd.setCursor(0,0);
lcd.print("Humi: ");
lcd.print(humidity);
lcd.print(" % ");
lcd.setCursor(0,1);
lcd.print("Temp: ");
lcd.print(temp);
lcd.print(" C ");
}

You might also like