裝置藝術防護措施

Description

Description

國立暨南國際大學應用材料及光電工程學系學士班一年級

作者:陳鴻、陳冠傑、何心融、 陳勁成、吳明哲、 白聖維

指導教授:曹永忠 博士

 

防盜裝置或是警報系統是近期防制犯罪最好的方式,我們這次的作品是以裝置藝術做為出發概念,結合了防護系統及裝置的溫度感測,不僅在視覺上美觀,本身附屬的防護措施也都包含在巧思之中。

需要材料

  • 溫度感測
  • LED 控制
  • 蜂鳴器調變
  • 超音波感測器
  • Arduino 開發版

步驟

1.

2.

3.

4.

程式碼 1 // Example testing sketch for various DHT humidity/temperature sensors

// Written by ladyada, public domain #include “DHT.h” #define C0 18 #define CS0 17 #define D0 18 #define DS0 19 #define E0 21 #define F0 22 #define FS0 23 #define G0 25 #define GS0 26 #define A0 28 #define AS0 29 #define B0 31 #define C1 33 #define CS1 35 #define D1 37 #define DS1 39 #define B0 31 #define C1 33 #define CS1 35 #define D1 37 #define DS1 39 #define E1 41 #define F1 44 #define FS1 46 #define G1 49 #define GS1 52 #define A1 55 #define AS1 58 #define B1 62 #define C2 65 #define CS2 69 #define D2 73 #define DS2 78 #define E2 82 #define F2 87 #define FS2 93 #define G2 98 #define GS2 104 #define A2 110 #define AS2 117 #define B2 123 #define C3 131 #define CS3 139 #define D3 147 #define DS3 156 #define E3 165 #define F3 175 #define FS3 185 #define G3 196 #define GS3 208 #define A3 220 #define AS3 233 #define B3 247 #define C4 262 #define CS4 277 #define D4 294 #define DS4 311 #define E4 330 #define F4 349 #define FS4 370 #define G4 392 #define GS4 415 #define A4 440 #define AS4 466 #define B4 494 #define C5 523 #define CS5 554 #define D5 587 #define DS5 622 #define E5 659 #define F5 698 #define FS5 740 #define G5 784 #define GS5 831 #define A5 880 #define AS5 932 #define B5 988 #define C6 1047 #define CS6 1109 #define D6 1175 #define DS6 1245 #define E6 1319 #define F6 1397 #define FS6 1480 #define G6 1568 #define GS6 1661 #define A6 1760 #define AS6 1865 #define B6 1976 #define C7 2093 #define CS7 2217 #define D7 2349 #define DS7 2489 #define E7 2637 #define F7 2794 #define FS7 2960 #define G7 3136 #define GS7 3322 #define A7 3520 #define AS7 3729 #define B7 3951 #define C8 4186 #define CS8 4435 #define D8 4699 #define DS8 4978 #define E8 5274 #define F8 5588 #define FS8 5920 #define G8 6272 #define GS8 6645 #define A8 7040 #define AS8 7459 #define B8

7902 int buzzerPin=5;

int littleStarNote[]={C5, C5, G5, G5, A5, A5, G5, 0, F5, F5, E5, E5, D5, D5, C5, 0, G5, G5, F5, F5, E5, E5, D5, 0, G5,G5, F5, F5, E5, E5, D5, 0, C5, C5, G5, G5, A5, A5, G5, 0, F5, F5, E5, E5, D5, D5, C5, 0};

int littleStarDuration[]={4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,4, 4, 4, 4, 4, 4, 4, 4, 4, 4};

int littleBeeNote[]={G5, E5, E5, 0, F5, D5, D5, 0, C5, D5, E5, F5, G5, G5, G5, 0, G5, E5, E5, 0, F5, D5, D5, 0, C5, E5,G5, G5, E5, 0, 0, 0, D5, D5, D5, D5, D5, E5, F5, 0, E5, E5, E5, E5, E5, F5, G5, 0, G5, E5, E5, 0, F5, D5, D5, 0, C5, E5,G5, G5, C5, 0, 0, 0};

int littleBeeDuration[]={4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4};

//const byte swPin=2;

//switch pin for interrupt volatile int swValue=0;

//initial swValue:0=silent int debounceDelay=200;

//debounce delay (ms) #define DHTPIN 4

// what digital pin we’re connected to #define ledblue 13 #define ledred 12 #define buzzer 5 # define redLED 9 # define greenLED 10 # define blueLED 11

//取消註釋您正在使用的任何類型!#define DHTTYPE DHT11 // DHT 11 // #define DHTTYPE DHT22 // DHT 22(AM2302),AM2321 // #define DHTTYPE DHT21 // DHT 21(AM2301)//將傳感器的引腳1(左側)連接到+ 5V //注意:如果使用具有3.3V邏輯的電路板,如Arduino Due連接引腳1 //至3.3V而不是5V!//將傳感器的引腳2連接到DHTPIN的任何位置//將傳感器的引腳4(右側)連接到GROUND //將引腳2(數據)的10K電阻連接到傳感器的引腳1(電源)/ /初始化DHT傳感器。//請注意,此庫的舊版本採用可選的第三個參數//調整更快處理器的時序。不再需要此參數//因為當前DHT讀取算法會自行調整以處理更快的觸發。DHT dht(DHTPIN,DHTTYPE); void setup(){pinMode(buzzerPin,OUTPUT); // pinMode(swPin,INPUT_PULLUP); //使能輸入引腳attachInterrupt(0,int0,LOW)的上拉電阻; // assign int0 Serial.begin(9600); Serial.println(“DHTxx test!”); dht.begin(); pinMode(ledblue,OUTPUT); pinMode(ledred,OUTPUT); digitalWrite(ledblue,LOW); digitalWrite(ledred,LOW); pinMode(蜂鳴器,OUTPUT); digitalWrite(蜂鳴器,LOW); } void loop(){//在測量之間等待幾秒鐘。延遲(2000); //讀取溫度或濕度大約需要250毫秒!//傳感器讀數也可能長達2秒’(傳感器速度非常慢)浮點數h = dht.readHumidity(); //讀取溫度為攝氏度(默認值)float t = dht.readTemperature(); //讀取溫度為華氏度(isFahrenheit = true)float f = dht.readTemperature(true); //檢查是否有任何讀取失敗並提前退出(再試一次)。if(isnan(h)|| isnan(t)|| isnan(f)){Serial.println(“無法從DHT傳感器讀取!”); 返回; } //以華氏度計算熱量指數(默認值)float hif = dht.computeHeatIndex(f,h); //以攝氏度計算熱量指數(isFahreheit = false)float hic = dht.computeHeatIndex(t,h,false); Serial.print(“濕度:”); Serial.print(H); Serial.print(“%\ t”); Serial.print(“溫度:”); Serial.print(T); Serial.print(“* C”); Serial.print(F); Serial.print(“* F \ t”); Serial.print(“Heat index:”); Serial.print(HIC); Serial.print(“* C”); Serial.print(HIF); Serial.println(“* F”); if(t <= 28){digitalWrite(ledblue,HIGH); digitalWrite(ledred,LOW); analogWrite(blueLED,0); for(int i = 0; i <256; i ++){analogWrite(greenLED,i); analogWrite(redLED,i); 延遲(5); } delay(2000); analogWrite(redLED,0); for(int i = 0; i <256; i ++){analogWrite(greenLED,i); analogWrite(blueLED,i); 延遲(5); } delay(2000); analogWrite(greenLED,0); for(int i = 0; i <256; i ++){analogWrite(blueLED,i); analogWrite(redLED,i); 延遲(5); } delay(2000); } if(t> 28){digitalWrite(ledblue,LOW); digitalWrite(ledred,HIGH); switch(swValue){case 1:playLittleBee(buzzerPin,sizeof(littleBeeNote)/ sizeof(int)); 打破; 案例2:playLittleStar(buzzerPin,sizeof(littleStarNote)/ sizeof(int)); 打破; 默認值:noTone(buzzerPin); //無聲的蜂鳴器休息; } analogWrite(greenLED,0); analogWrite(blueLED,0); analogWrite(redLED,0); void playLittleBee(int pin,int count){for(int i = 0; i <count; i ++){int d = 1000 / littleBeeDuration [i]; 音(pin,littleBeeNote [i],d); int p = d * 1.3; 延遲(P); noTone(銷); } delay(2000); void playLittleStar(int pin,int count){for(int i = 0; i <count; i ++){int d = 1000 / littleStarDuration [i]; 音(pin,littleStarNote [i],d); int p = d * 1.3; 延遲(P); noTone(銷); } delay(2000); } void int0(){//中斷處理程序if(debounced()){// debounced:++ swValue; //增加swValue if(swValue> 2){swValue = 0;} // reset swValue}} boolean debounced(){//檢查debounced static unsigned long lastMillis = 0; //記錄last millis unsigned long currentMillis = millis(); //獲取當前經過的時間if((currentMillis-lastMillis)> debounceDelay){lastMillis = currentMillis; //使用currentMillis更新lastMillis返回true; // debounced} else {return false;} // not debounced}程式碼2 int trigPin = 12; // Trig Pin int echoPin = 11; // Echo Pin持續時間長,cm,英寸; #define buzzer 5 void setup(){Serial.begin(9600);

(MakerPRO 編輯部代發)

MakerPRO編輯部

MakerPRO編輯部

MakerPRO.cc為華人圈最專注於Maker創新創業、物聯網及共享經濟報導及共筆發表的專業媒體,不論是趨勢分析與評論,或創新實作文章,在華文創新創業媒體領域都具有重要的影響力。
MakerPRO編輯部

Latest posts by MakerPRO編輯部 (see all)

    Contact

    Contact

    Project簡述

    Project簡述
    • 簡述
      防盜裝置與警報系統是近期防制犯罪最好的方式,這次的作品以裝置藝術做為出發概念,結合了防護系統及裝置的溫度感測,不僅在視覺上美觀,本身附屬的防護措施也都包含在巧思之中
    • 作者
      陳鴻、陳冠傑、何心融、 陳勁成、吳明哲、 白聖維

    您的姓名 〈需填寫〉

    您的電子郵件信箱 〈需填寫〉

    主旨

    您的信件內容