Pengaman Rumah Multi Sensor Berbasis Arduino Uno dengan Komunikasi Ethernet

44

Lampiran 1
Gambar Alat Secara Keseluruhan

Universitas Sumatera Utara

45

Lampiran 2
Program Arduino Uno
#include
#include

//Constants
#define DHTPIN 4
#define DHTTYPE DHT22
//DHT dht(DHTPIN, DHTTYPE);
//Variables
int LDR= A2;
int pirPin = 6;

int redLED= 13;
int greenLED=12;
int nilaiLDR= 0;
int buzzerPin = 11;
int pirState = LOW;
float hum;
float temp;
int MQ2 = A3;
int MQ2Value = 0;
int address = 0;
int startAddress = 60;
void setup() {
Serial.begin(9600);
Serial.println("DHT22 Temperature dan Humidity ke EEPROM");
Serial.print("Data dimulai pada lokasi EEPROM ");
Serial.println(startAddress);
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(LDR, INPUT);


Universitas Sumatera Utara

46

pinMode(pirPin, INPUT);
pinMode (MQ2, INPUT);
dht.begin();
}
void loop()
{
//SENSOR TEMPERATUR DAN KELEMBABAN (DHT22)
//hum = dht.readHumidity();
//temp= dht.readTemperature();
Serial.print("Humidity: ");
Serial.print(hum);
Serial.print(" RH, Temp: ");
Serial.print(temp);
Serial.println("C");
if (temp >= 32){

tone(buzzerPin, 956, 200);
delay (500);
tone(buzzerPin, 956, 200);
delay (500);
tone(buzzerPin, 956, 200);
delay (500);
tone(buzzerPin, 956, 200);
delay (500);
tone(buzzerPin, 956, 200);
delay (500);
Serial.println ("OVER HEAT"); }
else if (temp = 300 ) {
tone(buzzerPin, 956, 200);
delay (500);
tone(buzzerPin, 956, 200);
delay (500);
tone(buzzerPin, 956, 200);
delay (500);
tone(buzzerPin, 956, 200);
delay (500);

tone(buzzerPin, 956, 200);
delay (500);
Serial.println ("Status Asap : YES ");
} else
Serial.println ("Status Asap : NO");

noTone(buzzerPin);

delay (2000); // delay 2 sec
}}

Universitas Sumatera Utara

49

Lampiran 3
Tampilan Hasil Pengujian Alat pada Soket Test

Universitas Sumatera Utara


Aosong Electronics Co.,Ltd
--------------------------------------------------------------------------------------------------------------------Your specialist in innovating humidity & temperature sensors

Digital-output relative humidity & temperature sensor/module
DHT22 (DHT22 also named as AM2302)

Capacitive-type humidity and temperature module/sensor
1

Thomas Liu (Business Manager)
Email: thomasliu198518@yahoo.com.cn
Universitas Sumatera Utara

Aosong Electronics Co.,Ltd
--------------------------------------------------------------------------------------------------------------------Your specialist in innovating humidity & temperature sensors

1. Feature & Application:

* Full range temperature compensated
* Relative humidity and temperature measurement

* Calibrated digital signal *Outstanding long-term stability *Extra components not needed
* Long transmission distance * Low power consumption
*4 pins packaged and fully interchangeable

2. Description:
DHT22 output calibrated digital signal. It utilizes exclusive digital-signal-collecting-technique and humidity
sensing technology, assuring its reliability and stability.Its sensing elements is connected with 8-bit single-chip
computer.
Every sensor of this model is temperature compensated and calibrated in accurate calibration chamber and the
calibration-coefficient is saved in type of programme in OTP memory, when the sensor is detecting, it will cite
coefficient from memory.
Small size & low consumption & long transmission distance(20m) enable DHT22 to be suited in all kinds of
harsh application occasions.
Single-row packaged with four pins, making the connection very convenient.

3. Technical Specification:
Model
Power supply
Output signal
Sensing element

Operating range
Accuracy

DHT22
3.3-6V DC
digital signal via single-bus
Polymer capacitor
humidity 0-100%RH;
temperature -40~80Celsius
humidity +-2%RH(Max +-5%RH); temperature