Skip to content

les2feup/capsense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Figure 1

CAPSense

Context-aware Sensor Active Prioritization for Emergency Management

Arduino C++ MQTT IoT License

Description

CAPSense is an adaptive IoT framework that uses fuzzy logic to prioritize emergency situations. The system focuses on monitoring multiple environmental hazards factors including:

  • Air Quality
  • Fire Risk
  • Flood Risk
  • Environmental conditions (temperature, humidity, etc.)

The system uses a multi-sensor approach to detect and prioritize hazards based on their severity and urban contextual assessment. Therefore, it is tailored for IoT smart cities projects focused on enhance citizen safety through targeted emergency response.

Features

  • Multi-sensor aggregation for hazard perception
  • Urban knowledge base for hazard prioritization
  • Adaptive fuzzy logic control system
  • Real-time data prioritization computation
  • Over-the-air (OTA) updates for risk and vulnerability level adjustment
  • MQTT-based communication

Article Information

To-Be-Defined

Experimental System Components

For validation purposes, the file arduino/capsense/src/capsense-validation.ino contains the code for the experimental system. The system is built around an Arduino-based platforms and works in two ways:

  1. Simulation Mode: The system uses "virtual" sensors to simulate environmental conditions. The system uses a fuzzy logic controller to evaluate the risk levels based on synthetic sensor readings.

To activate the simulation mode, set the SIMULATION_MODE flag in the capsense-validation.ino file.

  1. Real-time Mode: The system uses actual sensors.

The validation also has support for a debugging mode that allows the user to monitor the sensor readings and the risk levels through the serial interface.

To activate the debugging mode, set the DEBUG flag in the capsense-validation.ino file.

Hardware Components

For the real-time mode, the system uses the following sensors:

Software Architecture

The system is built around several key components:

  • HazardFactor: Manages multiple sensors and their weights associated with hazard perception computation.
  • HazardPerception: Hangles the overall hazard perception computation
  • ContextRiskIndex: Evaluates risk based on temporal context
  • FuzzyController: Handles fuzzy logic prioritization index computation

Getting Started

  1. Connect the sensors to the appropriate Arduino pins
  2. Compile the code from /arduino/capsense/ with Arduino IDE or PlatformIO (recommended)
  3. Allow initial sensor calibration (especially for gas sensors)
  4. Monitor readings through the serial interface

Building and Testing

Prerequisites

  • Install Visual Studio Code
  • Install PlatformIO IDE extension
  • Git (for cloning the repository)

Project Setup

  1. Clone the repository:
git clone https://github.com/yourusername/capsense.git
cd capsense
  1. Open the project in VS Code:
code .

Building with PlatformIO

The project supports multiple boards through PlatformIO. The main configurations are:

  • Raspberry Pi Pico (default)
  • Arduino Nano 33 BLE
  • ESP32

Dependencies are automatically managed through the platformio.ini configuration:

lib_deps =
    zerokol/eFLL @ ^1.4.1           ; Fuzzy Logic Library
    bblanchon/ArduinoJson @ ^7.3.0   ; JSON processing
    seeed-studio/Grove Temperature And Humidity Sensor @ ^2.0.2
    seeed-studio/Grove - Air quality sensor @ ^1.0.2

To build for a specific board:

# For Raspberry Pi Pico (default)
pio run

# For Arduino Nano 33 BLE
pio run -e nano33ble

# For ESP32
pio run -e esp32

Running Tests

The project includes unit tests that can be run using PlatformIO's test runner:

pio test

Debugging

  1. Enable debug mode in capsense-validation.ino:
#define DEBUG true
  1. Monitor serial output:
pio device monitor --port /dev/cu.usbmodem* --baud 115200

Common Issues

  • If sensor libraries are not found, ensure they're installed:
pio lib install "seeed-studio/Grove Temperature And Humidity Sensor"
pio lib install "seeed-studio/Grove - Air quality sensor"
  • For permission issues on macOS:
sudo chmod 666 /dev/cu.usbmodem*

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A context-aware adjustable sensor for emergency detection.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published