Skip to content

chicken-coop-door-status/C2DS-esp32-coop-snooper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview of the Coop Snooper Code and Its Capabilities

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.

Main Components and Structure

  1. ESP32 Microcontroller: The core hardware that runs the snooper's firmware.
  2. LED Indicator: Provides a visual indication of the door status (open, closed, or error).
  3. MQTT Protocol: Used for communication between the snooper and AWS IoT Core.
  4. AWS IoT Core: Manages the IoT devices and handles message routing.
  5. AWS Lambda: Executes specific functions in response to IoT events.

Code Structure

The codebase includes several key directories and files:

  1. 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.
  2. Configuration Files:

    • CMakeLists.txt: Build configuration for the project.
    • sdkconfig: Configuration settings for the ESP32.
  3. AWS Integration:

    • Scripts and configurations for integrating with AWS services.
    • MQTT topics for communication.
    • Certificates for secure connection to AWS IoT Core.

Capabilities

  1. Status Reception:

    • The snooper subscribes to the MQTT topic coop/status to receive updates on the door status.
  2. 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).
  3. AWS Integration:

    • The snooper uses AWS IoT Core for communication.
    • AWS Lambda functions handle decision-making based on door status and time of day.
  4. 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.

Error Handling

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.

Setup and Operation

  1. 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.
  2. 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.

This system ensures the safety and security of the chickens by providing remote monitoring and alerts, without requiring manual intervention once set up.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published