esp32 lora sensor
1.0.0
物聯網可啟用您的古代橡膠郵箱,其中包括ESP32,LORA收音機和触點閉合傳感器。
我的郵箱並不那麼接近,我想要一種查看何時打開的方法。該項目使用帶觸點傳感器的ESP32來檢測郵箱門何時打開/關閉,洛拉收音機發送快速的JSON爆發,然後深度睡覺直到再次打開門。
您需要一個接收器來撿起消息並在遠端進行操作。完成後,我將在這裡鏈接。
它從Acbrandao的ESP32_Mailbox項目中大量借用了Door State Logic,並進行了一些改進,以檢測卡住的門狀況。
它只需要幾件事:
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
保存,構建和部署。 ?
我喜歡PR :)
該項目已根據MIT許可證獲得許可 - 有關詳細信息,請參見許可證文件。