ICOMP-UNC / Bit-Masters

MIT License
0 stars 0 forks source link

Shelter Environmental Monitoring and Control System #4

Open daviddaguero opened 2 weeks ago

daviddaguero commented 2 weeks ago

High-level project description

The project aims to develop a real-time environmental monitoring and control system for a shelter, using the STM32 microcontroller and FreeRTOS for efficient task management. Integrating various sensors to monitor temperature, battery status, motion, and fire, the system ensures the safety and comfort of shelter occupants. Key features include automated gate control, fan-based temperature regulation, battery level indication, and data transmission to a remote monitoring center. With FreeRTOS, the STM32 manages concurrent tasks, handling sensor monitoring, real-time data processing, and responsive control actions like gate and fan operation. The use of Direct Memory Access (DMA) enhances efficiency by reducing CPU load, enabling reliable and responsive operation in a low-power, real-time environment.

Project Objectives

1. Real-Time Environmental Monitoring

Develop a system to monitor environmental factors like temperature, battery status, motion, and fire within the shelter, ensuring occupant safety and comfort.

2. Automated and Manual Gate Control

Implement automated gate control based on sensor inputs, with a manual override feature to allow user control in emergencies.

3. Temperature-Controlled Fan Activation

Use temperature data to regulate fan speed through PWM, ensuring effective cooling based on real-time conditions.

4. Battery Level Indication

Provide a clear indication of battery status using PWM to adjust LED brightness, showing low, medium, or full charge levels.

5. Data Transmission to Remote Monitoring Center

Transmit sensor data to an external monitoring center every 30 seconds, supporting on-demand data requests for remote oversight.

6. Display Interface

Display real-time temperature data on an external screen via I2C, enhancing user awareness of current shelter conditions.

7. Efficient Task Management with FreeRTOS

Utilize FreeRTOS to enable concurrent task management, prioritizing critical operations like fire and motion detection, ensuring timely responses.

8. DMA for Optimized Data Handling

Integrate DMA to offload data transfers between peripherals and memory, reducing CPU usage and enhancing power efficiency.

9. Scalability and Modularity

Design the system to allow easy integration of additional sensors or components, supporting future expansions and modifications.

10. Reliability and Low Power Consumption

Ensure reliable, continuous operation with minimal power consumption, particularly in battery-dependent environments.

Requirements

Functional Requirements

1. Environmental monitoring

Non-Functional Requirements

1. Reliability

Success Criteria for the Project

The project will be considered successful if the following criteria are met:

1. Reliable Environmental Monitoring:

The system accurately monitors temperature, battery status, motion, and fire conditions in real time, with no missed detections or false alarms under standard operating conditions.

2. Responsive Actuation:

Automated Gate Control: The gate responds promptly to sensor inputs, closing when motion is detected or when the temperature is below 24 degrees Celsius and opening in fire situations, with a response time within 1 second.

Manual Override: Manual control functions reliably when the override switch is activated, disabling automatic responses and allowing user control over the gate.

3. Accurately Battery Level Indication:

sofiavalos commented 2 weeks ago

System architecture

The proposed architecture based on the requirements is as follows: Arquitectura

daviddaguero commented 2 weeks ago

State machine diagram

stateDiagram-v2

    [*] --> MonitorEnvironment : Start Monitoring
    MonitorEnvironment --> MotionDetected : Motion Sensor Triggered
    %% MotionDetected --> Alarm : Nearby Threat Detected
    MotionDetected --> GateClosed : Close Gate

    MonitorEnvironment --> FireDetected : Fire Sensor Triggered
    %% FireDetected --> Alarm : Fire Detected Inside
    FireDetected --> GateOpened : Open Gate

    [*] --> ManualMode : Manual Override Activated
    ManualMode --> GateOpened : Panic button pressed
    ManualMode --> GateClosed : Panic button released

    MonitorEnvironment --> GateClosed : Temp < 24°C, Close Gate

    MonitorEnvironment --> FanOn : Temperature > 27°
    FanOn --> IncreaseFanSpeed : Temperature raises
    FanOn --> DecreaseFanSpeed : Temperature decreases
    FanOn --> FanOff : Temperature < 27°

    [*] --> BatteryCheck : Check Battery Level
    BatteryCheck --> LedSteadyOn : Battery level full
    BatteryCheck --> LedBlinkSlow : Battery level medium
    BatteryCheck --> LedBlinkFast : Battery level low
sofiavalos commented 2 weeks ago

Description of the main system modules

The main modules of our system are as follows:

In the system, the modules interact interdependently to ensure proper operation and efficient response to environmental conditions. The general configuration module is essential as it handles the initial setup of all sensors, GPIO I/O ports, and peripherals such as the ADC, PWM, and timers. Once these peripherals are configured, the system can collect environmental data (such as temperature, motion detection, fire presence, among others) and control devices (like motors or PWM signals) with precision. The ADC converts the analog signals from the sensors into digital values for processing, while the timers and PWM ensure precise control over output devices like the fan and door motor.

The system response module interacts closely with the configuration module as it uses sensor data to adjust parameters in real-time. For instance, when the temperature sensor detects a high temperature, the system responds by activating the fan or adjusting the motor speed to close the door, utilizing the pre-configured timers and PWM. This module must operate quickly to prevent severe consequences, and its interaction with the other modules ensures that the response is immediate and appropriate.

Meanwhile, the alarm and notification module plays a crucial role in continuous system monitoring. It consists of several functions that interact to provide an effective alert system in critical situations. The battery level monitors the energy status, while the fire alarm detects dangerous conditions. The display shows the real-time measured temperature, providing a clear view of the system’s status. This module integrates with the system response module, as the activation of alarms or notifications could trigger an immediate response, such as adjusting ventilation or closing the door.

The remote center is responsible for receiving, storing, and analyzing data from the system via UART transmission. This module ensures that the data is stored for later analysis, facilitating the evaluation of operational conditions and potential system improvements. The remote center relies on the interaction of all other modules, as it receives processed sensor data and system states for long-term analysis.

Finally, the main module manages communication between the modules and system controllers. It acts as an intermediary, coordinating the execution of tasks between different components and ensuring proper data and response management. This module also handles interruptions and handlers, allowing the system to respond efficiently to events like temperature changes or alarm triggers, while maintaining the data flow to the remote center and user interface.

Together, the interaction between these modules creates a dynamic system capable of autonomously responding to environmental conditions, maintaining continuous monitoring, and providing necessary alerts to ensure the system operates effectively and securely.

daviddaguero commented 2 weeks ago

Block Diagram

flowchart TD
    Main["Main"]
    GeneralConfiguration["General Configuration"]
    SystemResponse["System Response"]
    AlarmNotification["Alarm and Notification"]
    RemoteCenter["Remote Center"]

    Main --> GeneralConfiguration
    Main --> SystemResponse
    Main --> AlarmNotification
    Main --> RemoteCenter