Ridwan Wulida
Published

TUGAS ORKOM - Kipas Angin Otomatis

Membuat kipas dapat menyala otomatis dengan menggunakan sensor suhu, jika suhu sudah melewati batas yang ditentukan maka kipas akan menyala

EasyWork in progress1 hour1,371
TUGAS ORKOM - Kipas Angin Otomatis

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Relay Module for Tessel
Relay Module for Tessel
×1
Temperature Sensor
Temperature Sensor
×1
SparkFun Bluetooth Modem - BlueSMiRF Silver
SparkFun Bluetooth Modem - BlueSMiRF Silver
×1
LED (generic)
LED (generic)
×3
Jumper wires (generic)
Jumper wires (generic)
×2

Story

Read more

Schematics

skema_GNcgghzGhl.png

Skema gncgghzghl

Code

Kipas Angin Otomatis

Arduino
#include <SoftwareSerial.h>

SoftwareSerial hc(0,1);

int ledmerah = 11;
int ledkuning = 10;
int ledhijau = 9;

int relay = 3;

int suhu;
float tempSuhu;


void setup() {
  hc.begin(38400);
  Serial.begin(9600);
  pinMode(ledmerah,OUTPUT);
  pinMode(ledkuning,OUTPUT);
  pinMode(ledhijau,OUTPUT);
  pinMode(relay,OUTPUT);
  digitalWrite(relay,LOW);
}

void loop() {
  // put your main code here, to run repeatedly:
  
  
  if(hc.available()){
   
    Serial.write(hc.read());
    Serial.print(" Suhu android");
    Serial.print(" -> ");
     suhu = hc.read();
     Serial.print(suhu);
     hidupkan(suhu);
     delay(60000);
     
   }else{
    
    tempSuhu = analogRead(A0);
    Serial.print("Suhu sensor = ");
    Serial.println(tempSuhu);
    tempSuhu = (5.0*tempSuhu*100.0)/1024.0;
    suhu = (int)tempSuhu;
    Serial.print("Suhunya jadi = ");
    Serial.println(suhu);
    hidupkan(suhu);
    delay(5000);
    
    }  
  
}

void hidupkan(int suhu){
  if(suhu > 35){
    digitalWrite(relay,HIGH);
    digitalWrite(ledkuning,HIGH);
    digitalWrite(ledmerah,LOW);
    digitalWrite(ledhijau,LOW);
  }else if(suhu == 0){
    digitalWrite(relay,LOW);
    digitalWrite(ledkuning,LOW);
    digitalWrite(ledmerah,HIGH);
    digitalWrite(ledhijau,LOW);
   }else{
    digitalWrite(relay,LOW);
    digitalWrite(ledkuning,LOW);
    digitalWrite(ledmerah,LOW);
    digitalWrite(ledhijau,HIGH);
   }
  }

Credits

Ridwan Wulida

Ridwan Wulida

1 project • 0 followers
Contact

Comments

Add projectSign up / Login