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许可证获得许可 - 有关详细信息,请参见许可证文件。