λͺ©λ‘π©π» IoT (Embedded)/Arduino (64)
π 곡λΆνλ μ§μ§μνμΉ΄λ μ²μμ΄μ§?
π μμ ν μ§νμ² π© BSS (Best Safety Subway) λΉμ¦λμ€ μ§μ μμ€ν BSS (Business Support System) : ν΅μ μ‘°μ§μ΄ λͺ¨λ κ³ κ° λλ©΄ νλμ κ΄λ¦¬νκ³ κ°μννλ λ° λμμ΄ λλ λ€μν μννΈμ¨μ΄ νλ‘κ·Έλ¨ μμ νκ³ κΉ¨λν μ§νμ² νμΉ λ° μ΄ν ~ ! π© μΆμ§ λ°°κ²½ λ° νμμ± μμ΄ λ° μ¬κ³ λΉλ²νκ² μΌμ΄λ¨ μ€ν¬λ¦° λμ΄ κ³ μ₯ λ¬Έμ μΆν΄κ·Ό μμ¬ μ¬κ³ μν λμ κ°μ μ μΌλ‘ μ΄μ°ννμ κ³Όν¬ν μκ°νλ‘ “μν” μμ μ λ¬ π© μλΉμ€ λ΄μ© Staion μ§νμ² μ μ§νμ² κΈ°κ΄μ¬μκ² μκΈ μν© λ° λ°©ν΄λ¬Ό κ°μ§ μ리기 MQTT ν΅μ μΌλ‘ μλ¦Ό λͺ λ² μΆμ λ¬ΈμΈμ§ μλ¦Ό μ΄λ‘μ λ Έλμ λΉ¨κ°μμΌλ‘ κ½ μ°¨μμΌλ©΄ μ΄μ°ννμ κ³Όν¬νλ‘, μ¬λλ€μ΄ 무μμμ μ ν κ²μ μ μ°¨μμ μ΄μν λΌμ΄λ μΌμλ‘ λ°©..
β Station π© sub MQ135 (Co2 κ°μ€ μΈ‘μ μΌμ) 3 κ°μ κ°λ€μ topic λ³λ‘ λ°μμ LCD λ‘ μΆλ ₯νκΈ° π© pub μ΄μν μΌμ 2κ°λ‘ 거리λ₯Ό μΈ‘μ νλ©° λμ μ¬λΆλ₯Ό μλ¦Ό -> μ΄λ₯Ό κΈ°κ΄μ¬μκ² pub λ‘ μ μ‘ λ²νΌ 2κ°λ‘ μ€ν¬λ¦° λμ΄ κ³ μ₯ (0, 1) μ κ°μ νμ¬ κ³ μ₯ μ¬λΆλ₯Ό μλ¦Ό -> μ΄λ₯Ό κΈ°κ΄μ¬μκ² pub λ‘ μ μ‘ β MQ135_SUB & Door_Button_PUB #include "WiFiS3.h" #include #include #include #include #include #include // atof ν¨μκ° μ μΈλ ν€λ νμΌ #include // WiFi and MQTT μ ν #define WLAN_SSID "class924" #define WLAN_PASS "kosta9..
β Subway π© pub MQ135 (Co2 κ°μ€ μΈ‘μ μΌμ) 3 κ°μ κ°λ€μ freeRTOS λ‘ λ°μμ PUB λ‘ λ³΄λ΄κΈ° MQ135 (Co2 κ°μ€ μΈ‘μ μΌμ) 3 κ°μ κ°λ€μ LCD λ‘ μκ°ννκΈ° β MQ135_PUB #include #include "WiFiS3.h" #include #include #include #define INCLUDE_vTaskDelayUntil = 1 #include #include // WiFi and MQTT settings #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.154" #define MQTT_PORT 1883 #define MQ135_PIN_1..
β Sqlite3 sqlite3 dbνμΌλͺ .db >> .mode table >> .tables >> select * from ν μ΄λΈλͺ ; β db νμΌ (main.c) μ€ννκΈ° // gcc -g -o main main.c -lpaho-mqtt3c -lsqlite3 β Ultrasonic + button // main.c #include #include #include #include // CμΈμ΄λ‘ ꡬνλ SQL λ°μ΄ν° λ² μ΄μ€ μμ§ #include #include #include // MQ Telemetry Transport λ²μ 3.1 νλ‘ν μ½μ λν // C ꡬνμ ν΄λΌμ΄μΈνΈ κΈ°λ₯μ΄ ν¬ν¨λ 32λΉνΈ Windows λΌμ΄λΈλ¬λ¦¬ #include #define MQTT_HOST "192.168.0.154" #d..
β MQTT β pub.ino #include #include "WiFiS3.h" #include #include #include // WiFi and MQTT settings #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.154" #define MQTT_PORT 1883 #define MQ135_PIN_1 A0 #define MQ135_PIN_2 A1 char ssid[] = WLAN_SSID; char pass[] = WLAN_PASS; int keyIndex = 0; WiFiClient ethClient; PubSubClient mqtt(ethClient); int status = W..
β MQTT β pub.ino #include "WiFiS3.h" #include #include // WiFi and MQTT μ ν #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.154" #define MQTT_PORT 1883 #define TRIG 9 // TRIG ν μ€μ (μ΄μν 보λ΄λ ν) #define ECHO 8 // ECHO ν μ€μ (μ΄μν λ°λ ν) ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = WLAN_SSID; // your network SSID (na..
β MQTT β pub.ino #include "WiFiS3.h" #include #include // WiFi and MQTT μ ν #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.154" #define MQTT_PORT 1883 #define MQ135_PIN A0 char ssid[] = WLAN_SSID; char pass[] = WLAN_PASS; int keyIndex = 0; WiFiClient ethClient; PubSubClient mqtt(ethClient); int status = WL_IDLE_STATUS; WiFiServer server(80); void setup(..
β MQTT β pub.ino //pub.ino #include "WiFiS3.h" #include #include // WiFi and MQTT μ ν #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.51" #define MQTT_PORT 1883 #define MQTT_USERNAME "your_mqtt_username" #define MQTT_KEY "your_mqtt_password" #define TRIG 9 // TRIG ν μ€μ (μ΄μν 보λ΄λ ν) #define ECHO 8 // ECHO ν μ€μ (μ΄μν λ°λ ν) ///////please enter your sensitive ..