Context-aware Sensor Active Prioritization for Emergency Management
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.
- 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
To-Be-Defined
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:
- 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_MODEflag in thecapsense-validation.inofile.
- 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
DEBUGflag in thecapsense-validation.inofile.
For the real-time mode, the system uses the following sensors:
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 computationContextRiskIndex: Evaluates risk based on temporal contextFuzzyController: Handles fuzzy logic prioritization index computation
- Connect the sensors to the appropriate Arduino pins
- Compile the code from
/arduino/capsense/with Arduino IDE or PlatformIO (recommended) - Allow initial sensor calibration (especially for gas sensors)
- Monitor readings through the serial interface
- Install Visual Studio Code
- Install PlatformIO IDE extension
- Git (for cloning the repository)
- Clone the repository:
git clone https://github.com/yourusername/capsense.git
cd capsense- Open the project in VS Code:
code .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.2To 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 esp32The project includes unit tests that can be run using PlatformIO's test runner:
pio test- Enable debug mode in
capsense-validation.ino:
#define DEBUG true- Monitor serial output:
pio device monitor --port /dev/cu.usbmodem* --baud 115200- 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*This project is licensed under the MIT License - see the LICENSE file for details.
