The Coop Snooper is an ESP32-based system designed to remotely monitor the status of a chicken coop door by subscribing to AWS IoT messages and displaying the status via an LED indicator. Here's a detailed description of its capabilities and how it works, suitable for an introductory audience.
- ESP32 Microcontroller: The core hardware that runs the snooper's firmware.
- LED Indicator: Provides a visual indication of the door status (open, closed, or error).
- MQTT Protocol: Used for communication between the snooper and AWS IoT Core.
- AWS IoT Core: Manages the IoT devices and handles message routing.
- AWS Lambda: Executes specific functions in response to IoT events.
The codebase includes several key directories and files:
-
Main Application Code (
main/
):main.c
: The main application logic.sensors.c
&sensors.h
: Functions and definitions related to sensor operations (if any).certs/
: Directory containing security certificates for secure communication.
-
Configuration Files:
CMakeLists.txt
: Build configuration for the project.sdkconfig
: Configuration settings for the ESP32.
-
AWS Integration:
- Scripts and configurations for integrating with AWS services.
- MQTT topics for communication.
- Certificates for secure connection to AWS IoT Core.
-
Status Reception:
- The snooper subscribes to the MQTT topic
coop/status
to receive updates on the door status.
- The snooper subscribes to the MQTT topic
-
Visual Indicators:
- An LED on the snooper provides a visual status of the door.
- Green: Door state is as expected (open during the day, closed at night).
- Flashing Red: Error state (door open at night, door closed during the day, or sensor failure).
- An LED on the snooper provides a visual status of the door.
-
AWS Integration:
- The snooper uses AWS IoT Core for communication.
- AWS Lambda functions handle decision-making based on door status and time of day.
-
OTA Updates:
- The snooper can receive over-the-air (OTA) firmware updates via AWS S3 buckets.
- It subscribes to the
coop/update/snooper
MQTT topic for OTA update triggers.
The system is designed to handle several error conditions:
- Door Closure Failure at Sunset: If the door does not close at sunset, an alert is triggered.
- Door Open Failure at Sunrise: If the door does not open at sunrise, an alert is triggered.
- Missing Keep-Alive Messages: Indicates a snooper failure if messages are not received within a specified period.
- Sunrise/Sunset Times Retrieval Failure: Triggers an alert if the system cannot retrieve these times.
- Status Disagreement Between Sensors: Indicates a potential sensor or connectivity issue.
-
Initial Setup:
- Configure the ESP32 with the appropriate firmware.
- Set up AWS IoT Core, Lambda functions, and DynamoDB tables.
- Deploy security certificates for secure communication.
-
Normal Operation:
- The snooper continuously monitors the door status by subscribing to the
coop/status
topic. - It updates the local LED indicator based on the received status.
- AWS services process the status and trigger alerts if any issues are detected.
- The snooper continuously monitors the door status by subscribing to the
This system ensures the safety and security of the chickens by providing remote monitoring and alerts, without requiring manual intervention once set up.