elective
Created January 12, 2017

smart window

실수로 비오는것을 모르고 창문을 열어 두고 나갔을때 당신은 더이상 놀라지 않아도 된다. 왜냐하면 창문이 알아서 하기 떄문이다.

BeginnerProtip1 hour37
smart window

Things used in this project

Hardware components

DFRobot relay module
×1
DFRobot moisture sensor
×1
DFRobot GPIO Shield for Arduino
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
DC motor (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

20170113_022921_TxFzU2BTA5.jpg

20170113_032051_fc6OIKEeaw.jpg

Code

smart window

Arduino
#define BLYNK_PRINT Serial //Blynk앱을 사용하기 위한 라이브러리 불러오기
#include <BlynkSimpleCurieBLE.h>
#include <CurieBLE.h>


int soil = A1; //A1 에서 "soil" 이라고 명명된 정보를 가져온다 
char auth[] = "YourAuthToken";

BLEPeripheral  blePeripheral;

void setup() {
  Serial.begin(9600);
  delay(1000);

  blePeripheral.setLocalName("Blynk"); //Blynk 앱에서 표시될 장치 이름
  blePeripheral.setDeviceName("Blynk"); //Blynk 앱에서 표시될 장치 이름
  blePeripheral.setAppearance(384);

  Blynk.begin(blePeripheral, auth);

  blePeripheral.begin();

  Serial.println("Waiting for connections...");

  pinMode (13,OUTPUT);
}

void loop() {
  Blynk.run();
  blePeripheral.poll();

  int value = analogRead(soil); //A1 에서 불러온 값을 받는다
  int hum = map(value,0,1023,0,100);
  delay(100);
  if(hum<40){
    digitalWrite(13,LOW); //13은 릴레이
    delay(500);
  } else {
    digitalWrite(13,HIGH); //습도가 90 이상일 경우 모터가 작동
    delay(500);
  }
}

Credits

elective
2 projects • 1 follower
Contact

Comments

Please log in or sign up to comment.