Showing
5 changed files
with
576 additions
and
0 deletions
arduino/dht.ino
0 → 100644
| 1 | +#include <Adafruit_Sensor.h> | ||
| 2 | +#include <DHT.h> | ||
| 3 | +#include <DHT_U.h> | ||
| 4 | + | ||
| 5 | +#define DHTPIN 2 | ||
| 6 | +#define DHTTYPE DHT22 | ||
| 7 | +DHT_Unified dht(DHTPIN, DHTTYPE); | ||
| 8 | + | ||
| 9 | +uint32_t delayMS; | ||
| 10 | + | ||
| 11 | +// 미세먼지 센서 | ||
| 12 | +int dust_sensor = A0; // 미세먼지 핀 번호 | ||
| 13 | +float dust_value = 0; // 센서에서 입력 받은 미세먼지 값 | ||
| 14 | +float dustDensityug=0; // ug/m^3 값을 계산 | ||
| 15 | +int sensor_led = 12; // 미세먼지 센서 안에 있는 적외선 led 핀 번호 | ||
| 16 | +int sampling = 280; // 적외선 led를 키고, 센서 값을 읽어 들여 미세먼지를 측정하는 샘플링 시간 | ||
| 17 | +int waiting = 40; | ||
| 18 | +float stop_time = 9680; // 센서를 구동하지 않는 시간 | ||
| 19 | + | ||
| 20 | +// 블루투스 모듈 | ||
| 21 | +#include <SoftwareSerial.h> | ||
| 22 | +#define BT_RX 7 | ||
| 23 | +#define BT_TX 8 | ||
| 24 | + | ||
| 25 | +SoftwareSerial HM10(BT_RX,BT_TX); // RX핀(7번)은 HM10의 TX에 연결 | ||
| 26 | + // TX핀(8번)은 HM10의 RX에 연결 | ||
| 27 | +// at 설정 | ||
| 28 | +char recv_str[100]; | ||
| 29 | + | ||
| 30 | +// 변화 유무 | ||
| 31 | +bool tempBool; | ||
| 32 | +bool humidBool; | ||
| 33 | +bool dustBool; | ||
| 34 | + | ||
| 35 | + | ||
| 36 | +void setup(){ | ||
| 37 | + Serial.begin(9600); | ||
| 38 | + | ||
| 39 | + // 온습도 센서 | ||
| 40 | + dht.begin(); | ||
| 41 | + sensor_t sensor; | ||
| 42 | + dht.temperature().getSensor(&sensor); | ||
| 43 | + dht.humidity().getSensor(&sensor); | ||
| 44 | + delayMS = sensor.min_delay / 1000; | ||
| 45 | + | ||
| 46 | + // 미세먼지 센서 | ||
| 47 | + pinMode(sensor_led,OUTPUT); // 미세먼지 적외선 led를 출력으로 설정 | ||
| 48 | + pinMode(4, OUTPUT); | ||
| 49 | + | ||
| 50 | + // 블루투스 모듈 | ||
| 51 | + HM10.begin(9600); | ||
| 52 | + | ||
| 53 | + // 블루투스 작동확인 | ||
| 54 | + while(1) | ||
| 55 | + { | ||
| 56 | + if(sendBlueToothCommand("AT") == 0) | ||
| 57 | + { | ||
| 58 | + if(strcmp((char *)recv_str, (char *)"OK") == 0) | ||
| 59 | + { | ||
| 60 | + Serial.println("Bluetooth exists\r\n"); | ||
| 61 | + break; | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + delay(500); | ||
| 65 | + | ||
| 66 | + } | ||
| 67 | + sendBlueToothCommand("AT+NAMEDUSTSENSOR"); // 블루투스 장치 이름설정 | ||
| 68 | + sendBlueToothCommand("AT+MODE3"); // 블루투스 모드 설정 | ||
| 69 | + sendBlueToothCommand("AT+TYPE3"); | ||
| 70 | + | ||
| 71 | + tempBool = true; | ||
| 72 | + humidBool = true; | ||
| 73 | + dustBool = true; | ||
| 74 | + | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | + | ||
| 78 | +void loop(){ | ||
| 79 | + delay(delayMS); | ||
| 80 | + sensors_event_t event; | ||
| 81 | + | ||
| 82 | + if(tempBool) | ||
| 83 | + { | ||
| 84 | + dht.temperature().getEvent(&event); | ||
| 85 | + double temp_val = (double)event.temperature; | ||
| 86 | + if (isnan(temp_val)) { | ||
| 87 | + HM10.println(F("Error reading temperature!")); | ||
| 88 | + } | ||
| 89 | + else { | ||
| 90 | + HM10.write(F("temp ")); | ||
| 91 | + HM10.println(temp_val); | ||
| 92 | + delay(2000); | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + if(humidBool) | ||
| 97 | + { | ||
| 98 | + dht.humidity().getEvent(&event); | ||
| 99 | + double humid_val = (double)event.relative_humidity; | ||
| 100 | + if (isnan(humid_val)) { | ||
| 101 | + HM10.println(F("Error reading humidity!")); | ||
| 102 | + } | ||
| 103 | + else { | ||
| 104 | + HM10.write(F("humd ")); | ||
| 105 | + HM10.println(humid_val); | ||
| 106 | + delay(2000); | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + if(dustBool) | ||
| 111 | + { | ||
| 112 | + // 미세먼지 센서 | ||
| 113 | + digitalWrite(sensor_led, LOW); // LED 켜기 | ||
| 114 | + delayMicroseconds(sampling); // 샘플링해주는 시간. | ||
| 115 | + | ||
| 116 | + dust_value = analogRead(dust_sensor); // 센서 값 읽어오기 | ||
| 117 | + | ||
| 118 | + delayMicroseconds(waiting); // 너무 많은 데이터 입력을 피해주기 위해 잠시 멈춰주는 시간. | ||
| 119 | + | ||
| 120 | + digitalWrite(sensor_led, HIGH); // LED 끄기 | ||
| 121 | + delayMicroseconds(stop_time); // LED 끄고 대기 | ||
| 122 | + | ||
| 123 | + // 미세먼지 농도 값 | ||
| 124 | + dustDensityug = (0.17 * (dust_value * (5.0 / 1024.0)) - 0.1) * 1000; // 미세먼지 값 계산 | ||
| 125 | + double dust_val = dustDensityug; | ||
| 126 | + // 센서 값 전송 | ||
| 127 | + HM10.write("dust "); | ||
| 128 | + HM10.println(dustDensityug); | ||
| 129 | + delay(2000); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + | ||
| 133 | + while(1) | ||
| 134 | + { | ||
| 135 | + delay(1000); | ||
| 136 | + | ||
| 137 | + digitalWrite(sensor_led, LOW); // LED 켜기 | ||
| 138 | + delayMicroseconds(sampling); // 샘플링해주는 시간. | ||
| 139 | + dust_value = analogRead(dust_sensor); // 센서 값 읽어오기 | ||
| 140 | + delayMicroseconds(waiting); // 너무 많은 데이터 입력을 피해주기 위해 잠시 멈춰주는 시간. | ||
| 141 | + digitalWrite(sensor_led, HIGH); // LED 끄기 | ||
| 142 | + delayMicroseconds(stop_time); // LED 끄고 대기 | ||
| 143 | + is_dust_different(dustDensityug, dust_val, dustBool); | ||
| 144 | + | ||
| 145 | + dht.temperature().getEvent(&event); | ||
| 146 | + is_temp_different((double)event.temperature, temp_val, tempBool); | ||
| 147 | + | ||
| 148 | + dht.humidity().getEvent(&event); | ||
| 149 | + is_humid_different((double)event.relative_humidity, humid_val, humidBool); | ||
| 150 | + | ||
| 151 | + if(dustBool || tempBool || humidBool){ | ||
| 152 | + break; | ||
| 153 | + } | ||
| 154 | + } | ||
| 155 | +} | ||
| 156 | + | ||
| 157 | +// 10의 자리수에 변화가 발생시 값 전송 함수 | ||
| 158 | +bool is_dust_different(double now_dustVal, double& past_dustV bool& dustBool){ | ||
| 159 | + if((now_dustVal/10)!=(past_dustV/10)){ | ||
| 160 | + return true; | ||
| 161 | + } | ||
| 162 | + else{ | ||
| 163 | + return false; | ||
| 164 | + } | ||
| 165 | +} | ||
| 166 | + | ||
| 167 | +// 이전 값과 4 초과의 차이가 발생시 값 전송 함수 | ||
| 168 | +bool is_humid_different(double now_humidVal, double& past_humidV bool& humidBool){ | ||
| 169 | + if((now_humidVal>past_humidV+2) || (now_humidVal<past_humidV-2)){ | ||
| 170 | + return true; | ||
| 171 | + } | ||
| 172 | + else{ | ||
| 173 | + return false; | ||
| 174 | + } | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +// 이전 값과 1.5 초과의 차이가 발생시 값 전송 함수 | ||
| 178 | +bool is_temp_different(double now_tempVal, double& past_tempV bool& tempBool){ | ||
| 179 | + if((now_tempVal>past_tempV+0.75) || (now_tempVal<past_tempV-0.75)){ | ||
| 180 | + return true; | ||
| 181 | + } | ||
| 182 | + else{ | ||
| 183 | + return false; | ||
| 184 | + } | ||
| 185 | +} | ||
| 186 | + | ||
| 187 | +// at 설정용 함수 | ||
| 188 | +int sendBlueToothCommand(char command[]) | ||
| 189 | +{ | ||
| 190 | + Serial.print("send: "); | ||
| 191 | + Serial.print(command); | ||
| 192 | + Serial.println(""); | ||
| 193 | +#if NLCR | ||
| 194 | + HM10.println(command); | ||
| 195 | +#else | ||
| 196 | + HM10.print(command); | ||
| 197 | +#endif | ||
| 198 | + delay(300); | ||
| 199 | + | ||
| 200 | + if(recvMsg(200) != 0) return -1; | ||
| 201 | + | ||
| 202 | + Serial.print("recv: "); | ||
| 203 | + Serial.print(recv_str); | ||
| 204 | + Serial.println(""); | ||
| 205 | + return 0; | ||
| 206 | +} | ||
| 207 | + | ||
| 208 | +int recvMsg(unsigned int timeout) | ||
| 209 | +{ | ||
| 210 | + //wait for feedback | ||
| 211 | + unsigned int time = 0; | ||
| 212 | + unsigned char num; | ||
| 213 | + unsigned char i; | ||
| 214 | + | ||
| 215 | + //waiting for the first character with time out | ||
| 216 | + i = 0; | ||
| 217 | + while(1) | ||
| 218 | + { | ||
| 219 | + delay(50); | ||
| 220 | + if(HM10.available()) | ||
| 221 | + { | ||
| 222 | + recv_str[i] = char(HM10.read()); | ||
| 223 | + i++; | ||
| 224 | + break; | ||
| 225 | + } | ||
| 226 | + time++; | ||
| 227 | + if(time > (timeout / 50)) return -1; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + //read other characters from uart buffer to string | ||
| 231 | + while(HM10.available() && (i < 100)) | ||
| 232 | + { | ||
| 233 | + recv_str[i] = char(HM10.read()); | ||
| 234 | + i++; | ||
| 235 | + } | ||
| 236 | +#if NLCR | ||
| 237 | + recv_str[i-2] = '\0'; //discard two character \n\r | ||
| 238 | +#else | ||
| 239 | + recv_str[i] = '\0'; | ||
| 240 | +#endif | ||
| 241 | + return 0; | ||
| 242 | +} |
arduino/motor.ino
0 → 100644
| 1 | +#include <Stepper.h> | ||
| 2 | + | ||
| 3 | +// 스텝당 1.8도 회전함. 360/1.8 | ||
| 4 | +const int stepsPerRevolution = 200; | ||
| 5 | + | ||
| 6 | +Stepper myStepper(stepsPerRevolution, 2, 3, 4, 5); | ||
| 7 | + | ||
| 8 | +// 블루투스 모듈 | ||
| 9 | +#include <SoftwareSerial.h> | ||
| 10 | +#define BT_RX 7 | ||
| 11 | +#define BT_TX 8 | ||
| 12 | + | ||
| 13 | +// RX핀(7번)은 HM10의 TX에 연결 | ||
| 14 | +// TX핀(8번)은 HM10의 RX에 연결 | ||
| 15 | +SoftwareSerial HM10(BT_RX,BT_TX); | ||
| 16 | + | ||
| 17 | +// 동작 수신용 | ||
| 18 | +char receivechar; | ||
| 19 | + | ||
| 20 | +// at 설정용 | ||
| 21 | +char recv_str[100]; | ||
| 22 | + | ||
| 23 | +void setup() | ||
| 24 | +{ | ||
| 25 | + // 1분에 n바퀴 회전 | ||
| 26 | + myStepper.setSpeed(60); | ||
| 27 | + | ||
| 28 | + Serial.begin(9600); | ||
| 29 | + HM10.begin(9600); | ||
| 30 | + | ||
| 31 | + // 블루투스 작동 확인 | ||
| 32 | + while(1) | ||
| 33 | + { | ||
| 34 | + if(sendBlueToothCommand("AT") == 0) | ||
| 35 | + { | ||
| 36 | + if(strcmp((char *)recv_str, (char *)"OK") == 0) | ||
| 37 | + { | ||
| 38 | + Serial.println("Bluetooth exists\r\n"); | ||
| 39 | + break; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + delay(500); | ||
| 43 | + | ||
| 44 | + } | ||
| 45 | + sendBlueToothCommand("AT+NAMEMOTOR"); // 블루투스 장치 이름설정 | ||
| 46 | + sendBlueToothCommand("AT+MODE3"); // 블루투스 모드 설정 | ||
| 47 | + sendBlueToothCommand("AT+TYPE3"); | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | + | ||
| 51 | +void loop() | ||
| 52 | +{ | ||
| 53 | + if(HM10.available()) | ||
| 54 | + { | ||
| 55 | + receivechar = HM10.read(); | ||
| 56 | + if(receivechar == 'y'){ | ||
| 57 | + // 이상태에서는 360도 회전. | ||
| 58 | + // 회전수 조절시 아래 함수 추가 | ||
| 59 | + myStepper.step(stepsPerRevolution); | ||
| 60 | + myStepper.step(stepsPerRevolution); | ||
| 61 | + myStepper.step(50); | ||
| 62 | + | ||
| 63 | + | ||
| 64 | + delay(1500); | ||
| 65 | + } | ||
| 66 | + if(receivechar == 'n'){ | ||
| 67 | + // 이상태에서는 -360도 회전. | ||
| 68 | + // stepsPerRevolution = 200일때 1초대기. -> 360도 회전. | ||
| 69 | + myStepper.step(-stepsPerRevolution); | ||
| 70 | + myStepper.step(-stepsPerRevolution); | ||
| 71 | + myStepper.step(-20); | ||
| 72 | + | ||
| 73 | + | ||
| 74 | + delay(1500); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | +} | ||
| 79 | + | ||
| 80 | +// at 설정용 함수 | ||
| 81 | +int sendBlueToothCommand(char command[]) | ||
| 82 | +{ | ||
| 83 | + Serial.print("send: "); | ||
| 84 | + Serial.print(command); | ||
| 85 | + Serial.println(""); | ||
| 86 | +#if NLCR | ||
| 87 | + HM10.println(command); | ||
| 88 | +#else | ||
| 89 | + HM10.print(command); | ||
| 90 | +#endif | ||
| 91 | + delay(300); | ||
| 92 | + | ||
| 93 | + if(recvMsg(200) != 0) return -1; | ||
| 94 | + | ||
| 95 | + Serial.print("recv: "); | ||
| 96 | + Serial.print(recv_str); | ||
| 97 | + Serial.println(""); | ||
| 98 | + return 0; | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +int recvMsg(unsigned int timeout) | ||
| 102 | +{ | ||
| 103 | + //wait for feedback | ||
| 104 | + unsigned int time = 0; | ||
| 105 | + unsigned char num; | ||
| 106 | + unsigned char i; | ||
| 107 | + | ||
| 108 | + //waiting for the first character with time out | ||
| 109 | + i = 0; | ||
| 110 | + while(1) | ||
| 111 | + { | ||
| 112 | + delay(50); | ||
| 113 | + if(HM10.available()) | ||
| 114 | + { | ||
| 115 | + recv_str[i] = char(HM10.read()); | ||
| 116 | + i++; | ||
| 117 | + break; | ||
| 118 | + } | ||
| 119 | + time++; | ||
| 120 | + if(time > (timeout / 50)) return -1; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + //read other characters from uart buffer to string | ||
| 124 | + while(HM10.available() && (i < 100)) | ||
| 125 | + { | ||
| 126 | + recv_str[i] = char(HM10.read()); | ||
| 127 | + i++; | ||
| 128 | + } | ||
| 129 | +#if NLCR | ||
| 130 | + recv_str[i-2] = '\0'; //discard two character \n\r | ||
| 131 | +#else | ||
| 132 | + recv_str[i] = '\0'; | ||
| 133 | +#endif | ||
| 134 | + return 0; | ||
| 135 | +} |
arduino/rain_intr.ino
0 → 100644
| 1 | +#include <SoftwareSerial.h> | ||
| 2 | +#define BT_RX 7 | ||
| 3 | +#define BT_TX 8 | ||
| 4 | + | ||
| 5 | +// RX핀(7번)은 HM10의 TX에 연결 | ||
| 6 | +// TX핀(8번)은 HM10의 RX에 연결 | ||
| 7 | +SoftwareSerial HM10(BT_RX,BT_TX); | ||
| 8 | + | ||
| 9 | +// 적외선 센서 | ||
| 10 | +int Sensor = 9; // 센서핀은 9번에 연결 | ||
| 11 | +int intruder_val; | ||
| 12 | + | ||
| 13 | +int Raindrops_pin = A0; // 빗방울센서 핀을 A0으로 설정 | ||
| 14 | + | ||
| 15 | +// at 설정용 | ||
| 16 | +char recv_str[100]; | ||
| 17 | + | ||
| 18 | +// 지속시간 체크용 | ||
| 19 | +int count_i = 0; | ||
| 20 | +int count_r = 0; | ||
| 21 | + | ||
| 22 | +// 변화체크용 | ||
| 23 | +bool is_raining; | ||
| 24 | +bool is_intruded; | ||
| 25 | + | ||
| 26 | +void setup() { | ||
| 27 | + Serial.begin(9600); | ||
| 28 | + HM10.begin(9600); | ||
| 29 | + pinMode(Sensor, INPUT); // 센서값을 입력으로 설정 | ||
| 30 | + | ||
| 31 | + // 블루투스 작동확인 | ||
| 32 | + while(1) | ||
| 33 | + { | ||
| 34 | + if(sendBlueToothCommand("AT") == 0) | ||
| 35 | + { | ||
| 36 | + if(strcmp((char *)recv_str, (char *)"OK") == 0) | ||
| 37 | + { | ||
| 38 | + Serial.println("Bluetooth exists\r\n"); | ||
| 39 | + break; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + delay(500); | ||
| 43 | + | ||
| 44 | + } | ||
| 45 | + sendBlueToothCommand("AT+NAMERAININGSENSOR"); // 블루투스 장치 이름설정 | ||
| 46 | + sendBlueToothCommand("AT+MODE3"); // 블루투스 모드 설정 | ||
| 47 | + sendBlueToothCommand("AT+TYPE3"); | ||
| 48 | + | ||
| 49 | + is_raining = true; | ||
| 50 | + is_intruded = true; | ||
| 51 | + | ||
| 52 | + | ||
| 53 | +} | ||
| 54 | +void loop() { | ||
| 55 | + // Serial.println(analogRead(A0)); // 센서 출력값을 시리얼모니터로 전송. 수동확인용 | ||
| 56 | + | ||
| 57 | + intruder_val = digitalRead(Sensor); | ||
| 58 | + // 센서값 읽어옴 | ||
| 59 | + | ||
| 60 | + if(is_intruded) | ||
| 61 | + { | ||
| 62 | + delay(500); | ||
| 63 | + if (intruder_val == LOW) { | ||
| 64 | + // 장애물이 감지되면 | ||
| 65 | + while(1){ | ||
| 66 | + delay(1000); | ||
| 67 | + count_i += 1; | ||
| 68 | + if(count_i >= 3){ | ||
| 69 | + HM10.write("intr "); | ||
| 70 | + HM10.write(1); | ||
| 71 | + break; | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + count_i = 0; | ||
| 75 | + delay(1000); | ||
| 76 | + is_intruded = false; | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + if (intruder_val == HIGH) | ||
| 80 | + { | ||
| 81 | + is_intruded = true; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + | ||
| 85 | + | ||
| 86 | + if(is_raining) | ||
| 87 | + { | ||
| 88 | + if(analogRead(A0) < 150){ | ||
| 89 | + // 센서 출력값이 150 미만이면 | ||
| 90 | + // 빗방울 감지가 5초간 지속되면 | ||
| 91 | + delay(100); | ||
| 92 | + while(1){ | ||
| 93 | + delay(1000); | ||
| 94 | + count_r += 1; | ||
| 95 | + if(count_r >= 5){ | ||
| 96 | + HM10.write("rain "); | ||
| 97 | + HM10.println(1); | ||
| 98 | + break; | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + count_r = 0; | ||
| 102 | + delay(1000); | ||
| 103 | + is_raining = false; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + } | ||
| 107 | + if(analogRead(A0) > 150) | ||
| 108 | + { | ||
| 109 | + is_raining = true; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +// at 설정용 함수 | ||
| 115 | +int sendBlueToothCommand(char command[]) | ||
| 116 | +{ | ||
| 117 | + Serial.print("send: "); | ||
| 118 | + Serial.print(command); | ||
| 119 | + Serial.println(""); | ||
| 120 | +#if NLCR | ||
| 121 | + HM10.println(command); | ||
| 122 | +#else | ||
| 123 | + HM10.print(command); | ||
| 124 | +#endif | ||
| 125 | + delay(300); | ||
| 126 | + | ||
| 127 | + if(recvMsg(200) != 0) return -1; | ||
| 128 | + | ||
| 129 | + Serial.print("recv: "); | ||
| 130 | + Serial.print(recv_str); | ||
| 131 | + Serial.println(""); | ||
| 132 | + return 0; | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +int recvMsg(unsigned int timeout) | ||
| 136 | +{ | ||
| 137 | + //wait for feedback | ||
| 138 | + unsigned int time = 0; | ||
| 139 | + unsigned char num; | ||
| 140 | + unsigned char i; | ||
| 141 | + | ||
| 142 | + //waiting for the first character with time out | ||
| 143 | + i = 0; | ||
| 144 | + while(1) | ||
| 145 | + { | ||
| 146 | + delay(50); | ||
| 147 | + if(HM10.available()) | ||
| 148 | + { | ||
| 149 | + recv_str[i] = char(HM10.read()); | ||
| 150 | + i++; | ||
| 151 | + break; | ||
| 152 | + } | ||
| 153 | + time++; | ||
| 154 | + if(time > (timeout / 50)) return -1; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + //read other characters from uart buffer to string | ||
| 158 | + while(HM10.available() && (i < 100)) | ||
| 159 | + { | ||
| 160 | + recv_str[i] = char(HM10.read()); | ||
| 161 | + i++; | ||
| 162 | + } | ||
| 163 | +#if NLCR | ||
| 164 | + recv_str[i-2] = '\0'; //discard two character \n\r | ||
| 165 | +#else | ||
| 166 | + recv_str[i] = '\0'; | ||
| 167 | +#endif | ||
| 168 | + return 0; | ||
| 169 | +} |
docs/최종보고서.docx
0 → 100644
No preview for this file type
readme.md.txt
0 → 100644
| 1 | +# IoT센서를 이용한 원격 제어 스마트 창문 | ||
| 2 | +Arduino에 연결된 센서를 통해 측정한 데이터를 기반으로 자동 창문 개폐를 제어한다. | ||
| 3 | + | ||
| 4 | +## Intro | ||
| 5 | +저전력 블루투스로 아두이노 장치와 안드로이드 기기를 연결해 데이터를 송수신한다. | ||
| 6 | +센서로 측정한 데이터를 어플리케이션에서 조회할 수 있다. | ||
| 7 | + | ||
| 8 | +## Development Environment | ||
| 9 | +* Android Studio @ 3.6 | ||
| 10 | +* Arduino IDE | ||
| 11 | + | ||
| 12 | +## Application Version | ||
| 13 | +* minSdkVersion: 24 | ||
| 14 | +* targetSdkVersion: 26 | ||
| 15 | + | ||
| 16 | +## Screenshots | ||
| 17 | +<img src="https://user-images.githubusercontent.com/33692487/85216389-00193980-b3bf-11ea-8a1c-6035b2a0eb43.jpg" width="40%"> | ||
| 18 | + | ||
| 19 | +<img src="https://user-images.githubusercontent.com/33692487/85216397-18895400-b3bf-11ea-977e-5e7512acd43d.jpg" width="40%"> | ||
| 20 | + | ||
| 21 | +<img src="https://user-images.githubusercontent.com/33692487/85216401-2212bc00-b3bf-11ea-8b50-14f60b349359.jpg" width="40%"> | ||
| 22 | + | ||
| 23 | +1. 첫번째 탭에서 수동으로 창문을 제어할 수 있다 | ||
| 24 | +2. 두번째 탭에서 아두이노 센서에서 측정한 데이터를 조회할 수 있다. | ||
| 25 | +3. 세번째 탭에서 다중의 아두이노 장치와 블루투스를 통해 연결할 수 있다. | ||
| 26 | + | ||
| 27 | +## Members | ||
| 28 | +* 2017104012 이수민 | ||
| 29 | +* 2017104031 채수빈 | ||
| 30 | + |
-
Please register or login to post a comment