Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University
Advisor : Prof. Teh-Lu Liao
S...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
 Motivation
 Block Diagram
...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
3
Schematic View
Rain Sensor
...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
4
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
5
Microprocessor
Rain Sensor
...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
6
Arduino-
ATMEGA2560
YL-83
D...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
 Arduino is an open-source
e...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
8
Rain Sensor : YL-83
Sensiti...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
9
Arduino-1
LCM
Extension
cor...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
10
Rain
Sensor
Humidity and T...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
11
HC-05
Slave
Slave
Slave
Ma...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
 The Bluetooth module has tw...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
13
Start
BT
match?
Finding
Sl...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
14
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
#include <Wire.h>
#include <L...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
#include <SoftwareSerial.h>
#...
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
17
Intelligent Control Laboratory, Dept. of Engineering Science,
National Cheng Kung University
Thank you for your attention....
Upcoming SlideShare
Loading in …5
×

A Wireless Application of The Rain, Humidity and Temperature Sensors Based on Arduino and Bluetooth

2,569 views

Published on

A Wireless Application of The Rain, Humidity and Temperature Sensors Based on Arduino and Bluetooth

  1. 1. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University Advisor : Prof. Teh-Lu Liao Student : Zheng-De Liu
  2. 2. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University  Motivation  Block Diagram  Framework Diagram  Arduino Introduction  Device Description  Flow Diagram  Master Code & Slave Code  Performance 2
  3. 3. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 3 Schematic View Rain Sensor Humidity and Temperature Sensor Control Control LCM Screen Bluetooth
  4. 4. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 4
  5. 5. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 5 Microprocessor Rain Sensor Temprature and Humidity Sensor Wireless Transceiver Uart Host Debug Uart I/O I/O Microprocessor Light and Buzzer LCM Screen Wireless Transceiver Uart Uart Host Debug I/O IIC Central Node Sensor Node
  6. 6. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 6 Arduino- ATMEGA2560 YL-83 DHT-11 HC-05 Uart Serial Monitor Uart I/O I/O Arduino- ATMEGA2560 Light and Buzzer LCM 1602 HC-05 Uart Uart Serial Monitor I/O IIC Central Node Sensor Node
  7. 7. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University  Arduino is an open-source electronics prototyping platformbased on flexible, easy-to-use hardware and software. 7
  8. 8. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 8 Rain Sensor : YL-83 Sensitivity: 0~5V Humidity and Temperature Sensor : DHT11 Sensitivity:0~50 oC 20~90%RH Bluetooth : HC-05 LCM : 1602 8-Channels Relay DIY Extension Cord
  9. 9. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 9 Arduino-1 LCM Extension cord Relay Bizzer Bluetooth Light
  10. 10. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 10 Rain Sensor Humidity and Tempture Sensor Bluetoooth Arduino-2
  11. 11. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 11 HC-05 Slave Slave Slave Master
  12. 12. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University  The Bluetooth module has two work modes: Commands response mode and auto connection mode. Ex: AT+ROLE=1 (Enter) Can change from M to S . AT+BIND=12,3,287044 (Enter) Binding address. 12
  13. 13. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 13 Start BT match? Finding Slave? Raining? Set AT-command LCM show DHT11-Sensor Reading DHT11 Form BT LCM show YL-83-Sensor Reading YL-83 Form BT Switch on? Buzzer call & Light on Y N N Y N Y N Y LCM show standby LCM show standby LCM show standby Rain stopped? End Y N
  14. 14. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 14
  15. 15. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University #include <Wire.h> #include <LiquidCrystal_I2C.h> #include <SoftwareSerial.h> #define Bizzer 44 #define Switch4 A0 #define Relay_Ch1 45 #define Master_Tx 13 #define Master_Rx 12 #define I2C_ADDR 0x20 #define BACKLIGHT_PIN 7 #define En_pin 4 #define Rw_pin 5 #define Rs_pin 6 #define D4_pin 0 #define D5_pin 1 #define D6_pin 2 #define D7_pin 3 #define BACKLIGHT_FLAG NEGATIVE LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_p in,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); SoftwareSerial BT(Master_Rx, Master_Tx); 15 char i,j; int s; void LCD_init() { lcd.begin (20,4); lcd.setBacklightPin(BACKLIGHT_ PIN,BACKLIGHT_FLAG); lcd.setBacklight(1); lcd.clear(); delay(100); } void setup() { pinMode(Bizzer,OUTPUT); pinMode(Switch4,INPUT); pinMode(Relay_Ch1,OUTPUT); LCD_init(); BT.begin(9600); Serial.begin(9600); lcd.setCursor(0,0); lcd.print("Standby!!"); } void loop() { char str[5]; delay(900); for(i=0;i<5;i++) { if(BT.available()>0) { str[i]= BT.read(); Serial.println(str[i]); delay(100); } } s=analogRead(Switch4); Serial.println(s); if(s>600) { digitalWrite(Bizzer,LOW); digitalWrite(Relay_Ch1,LOW); LCD_init(); lcd.setCursor(0,0); lcd.print("Standby!!"); str[0]=str[1]=str[2]=str[3]=str[4]='X'; delay(7500); } if(str[0]=='d'||str[0]=='h'||str[0]=='t') { digitalWrite(Bizzer,HIGH); digitalWrite(Relay_Ch1,HIGH); if(str[0]=='d') { lcd.setCursor(7,2); lcd.print("level-1"); } if(str[0]=='h') { lcd.setCursor(7,2); lcd.print("level-2"); } if(str[0]=='t') { lcd.setCursor(7,2); lcd.print("level-3"); } lcd.setCursor(0,0); lcd.print("warning!!"); lcd.setCursor(0,1); lcd.print("YL-83 DHT11 Sensor"); lcd.setCursor(0,2); lcd.print("state: "); } if(str[0]=='n') { digitalWrite(Bizzer,LOW); digitalWrite(Relay_Ch1,LO W); LCD_init(); lcd.setCursor(0,0); lcd.print("Standby!!"); } lcd.setCursor(0,3); lcd.print("H:"); lcd.setCursor(4,3); lcd.print("(%) ; T:"); lcd.setCursor(14,3); lcd.print("(oC)"); lcd.setCursor(2,3); lcd.print(str[1]); lcd.setCursor(3,3); lcd.print(str[2]); lcd.setCursor(12,3); lcd.print(str[3]); lcd.setCursor(13,3); lcd.print(str[4]); }
  16. 16. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University #include <SoftwareSerial.h> #include <dht11.h> #define Slave_TxPin 11 #define Slave_RxPin 10 #define Temp_sensor 22 int rain_AO=A0; SoftwareSerial BT(Slave_RxPin, Slave_TxPin); dht11 DHT11; void BT_init() { int i; BT.write("ATrn"); delay(200); BT.write("AT+ROLE=1rn"); delay(200); BT.write("AT+INITrn"); delay(200); BT.write("AT+BIND=12,3,287044rn"); delay(200); BT.write("AT+CMODE=0rn"); delay(200); } 16 void setup() { Serial.begin(9600); BT.begin(9600); pinMode(rain_AO,INPUT); // BT_init(); } void loop() { char Humidity_tens; char Humidity_units; char Temperature_tens; char Temperature_units; int chk = DHT11.read(Temp_sensor); int a = DHT11.humidity; int b = DHT11.temperature; char table[]="0123456789"; int i,k; i=analogRead(rain_AO); if(i<1000) { if(i>500 && i<1000) { BT.print('d'); Serial.println('d'); } if(i>300 && i<500) { BT.print('h'); Serial.println('h');; } if(i>50 && i<300) { BT.print('t'); Serial.println('t');; } delay(100); } else if(i>=1000) { BT.print('n'); Serial.println('n'); delay(100); } Humidity_tens = table[a/10]; Humidity_units = table[a%10]; Serial.println(Humidity_tens); Serial.println(Humidity_units); Temperature_tens = table[b/10]; Temperature_units = table[b%10]; Serial.println(Temperature_tens); Serial.println(Temperature_units); BT.print(Humidity_tens); delay(100); BT.print(Humidity_units); delay(100); BT.print(Temperature_tens); delay(100); BT.print(Temperature_units); delay(100); delay(1000); }
  17. 17. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University 17
  18. 18. Intelligent Control Laboratory, Dept. of Engineering Science, National Cheng Kung University Thank you for your attention. 18

×