IoT เปิดใช้งานกล่องจดหมายยางโบราณของคุณด้วย ESP32, Lora Radio และเซ็นเซอร์ปิดการติดต่อ
กล่องจดหมายของฉันไม่ได้อยู่ใกล้และฉันต้องการวิธีที่จะดูเมื่อเปิด โครงการนี้ใช้เซ็นเซอร์ ESP32 w/ ติดต่อเพื่อตรวจจับเมื่อประตูกล่องจดหมายเปิด/ ปิดวิทยุ LORA เพื่อส่งการระเบิด JSON อย่างรวดเร็วแล้วนอนหลับลึกจนประตูเปิดอีกครั้ง
คุณจะต้องมีตัวรับสัญญาณเพื่อรับข้อความและทำอะไรบางอย่างกับมันในตอนท้าย ฉันจะเชื่อมโยงของฉันที่นี่เมื่อเสร็จแล้ว
มันยืมตรรกะสถานะประตูอย่างหนักจากโครงการ ESP32_Mailbox ของ Acbrandao โดยมีการปรับปรุงบางอย่างสำหรับการตรวจจับสภาพประตูที่ติดอยู่
ต้องใช้สองสามอย่างเท่านั้น:
Platformio + VScode จะจัดการกับการพึ่งพาไลบรารีทั้งหมดของคุณเพื่อให้คุณสามารถสร้างได้
คุณอาจต้องติดตั้งไดรเวอร์ CP210X เพื่อให้คอมพิวเตอร์ของคุณรับรู้ชิปเซ็ตบน ESP32
ทางเลือกคุณสามารถปรับแต่งการตั้งค่าเหล่านี้ให้เหมาะกับความต้องการของคุณได้ดีขึ้น:
#define IS_DEBUG false // enable Serial.println statements
...
#define SYNCWORD 0xF3 // used to make sure our receiver only listens to our packets
...
// Mailbox config
#define PROJECT_NAME "rad-esp32-lora-sender" // What do we call this thing?
#define LED_ENABLED true // Turn on the on-board LED when transmitting status
#define MAX_OPENDOOR_TIME 30000 // default 30s in milliseconds how long to wait while door is open to consider it stuck open
#define MAX_STUCK_BOOT_COUNT 5 // If the door is stuck for more than x times let's switch to timer interrupt to save battery
#define TIMER_SLEEP_MICROSECS 1800 * 1000000 // when on timer interrupt how long to sleep in seconds * microseconds
// Define the contact closure input pin and initial state (Depends on your sensor - N/C or N/O )
gpio_num_t doorSensorPIN = GPIO_NUM_34; // GPIO for the contact closure
const int GPIO_DOOR_CLOSED_STATE = HIGH; // Default state when the reed and magnet are next to each other
บันทึกสร้างและปรับใช้ -
ฉันชอบ PRS :)
โครงการนี้ได้รับใบอนุญาตภายใต้ใบอนุญาต MIT - ดูไฟล์ License.md สำหรับรายละเอียด