3.1 Architecture
In Figure-1, the entire architecture of the system of this study is exhibited clearly. Firstly, Arduino board is connected to power supply and connected along with the three LED screens showing water level, ultrasonic water level and condition of water level respectively. The other Arduino board is used for sensors including Piezo sensor, Ultrasonic distance sensor, Passive infrared sensor (PIR) and Breadboard. On the breadboard, there are also Photo resistor and Relay SPDT connected. These are the prime elements of the proposed system for this study.
3.2 Simulated Environment
Tinkercad is an intuitive online platform empowering user to design and simulate electronic circuits and 3D models effortlessly. With a user-friendly interface, it enables drag-and-drop functionality to assemble circuits using an extensive library of components, including Arduino boards, sensors, and more (Narayan Mohapatra et al., 2020). Its simulation feature allows users to visualize circuit behaviour, aiding in prototyping and troubleshooting without physical components. Widely embraced in education, it fosters learning by allowing experimentation in electronics and programming. Tinkercad's collaborative environment encourages sharing designs, making it a go-to tool for novices and experts alike in exploring, learning, and validating electronic designs and 3D models.
In a flood detection system, coding in C++ typically involves processing sensor data and implementing algorithms to identify flood conditions based on predefined criteria. Here's the structure for the flood detection algorithm in C++:
- Acquiring simulated sensor readings (Distance, PIR, Piezo, etc.)
- Initializing variables and constants
const int waterThreshold = 500; // Define threshold value for water level
int waterLevel; // Variable to store water level sensor reading
- Simulating sensor readings or interfacing with actual sensors to get data
// Simulated sensor reading (replace with actual sensor input)
waterLevel = simulateWaterLevelReading(); // Function to get water level reading
- Implementing flood detection logic based on sensor readings
bool isFloodDetected = false;
// Check if water level exceeds threshold for flood detection
if (waterLevel > waterThreshold) {
isFloodDetected = true;
// Additional actions can be added here, like triggering alerts
}
- Based on the detection result, trigger actions (alerts, notifications)
if (isFloodDetected) {
// Trigger alert/notification function
sendFloodAlert(); // Function to send flood alert
}
- Defining functions to simulate sensor readings or implement alert mechanisms
int simulateWaterLevelReading() {
// Simulate sensor reading (replace with actual sensor logic)
// Example: return a random value between 0 and 1023
return rand() % 1024;
}
void sendFloodAlert() {
// Function to send flood alert (replace with actual alert mechanism)
// Example: print message to console
cout << "Flood detected! Take necessary precautions." << endl;
}
3.3 Virtual Simulated Sensor Models:
PIR Sensor: PIR (Passive Infrared) sensors in Tinkercad serve adeptly for flood detection. These sensors detect changes in infrared radiation emitted by objects within their field. By simulating flood conditions, the PIR sensor triggers an alert when it detects motion or temperature shifts beyond predefined thresholds. In Tinkercad's virtual environment, assembling this setup involves integrating the PIR sensor into a circuit along with other necessary components. As floodwaters intrude, altering the environment's thermal profile, the sensor swiftly reacts, signalling potential flooding (Mukhopadhyay et al., 2018). It's an efficient, simulated means to monitor and anticipate flooding scenarios, demonstrating the sensor's utility in preemptive warning systems.
Ultrasonic Distance Sensor: Ultrasonic distance sensors, simulated in platforms like Tinkercad, serve as crucial components for flood detection. By emitting ultrasonic pulses and measuring their reflection off surfaces, these sensors gauge distance. In flood monitoring, they detect water levels, and alerting systems when thresholds are breached. Integrated with microcontrollers, like Arduino in Tinkercad, they provide real-time data for swift responses, activating alarms or initiating preventive measures. This technology ensures timely warnings, enabling proactive actions against flooding disasters (Kelemen et al., 2015). Tinkercad's simulated environment allows for experimentation and prototyping, fostering innovative solutions to address environmental challenges like flood detection and prevention.
Piezo Sensor: Piezo sensors in Tinkercad offer a simple yet effective means for flood detection. These sensors work on the principle of generating voltage when subjected to mechanical stress. Placing them strategically in flood-prone areas, they detect water levels by reacting to pressure changes. Once submerged, the sensor's voltage output alters, signalling the presence of water (Bansal et al., 2022). In Tinkercad, these sensors are simulated within circuits to trigger alerts or activate preventive measures when water levels rise, aiding in timely flood warnings or automated responses. Their versatility, low cost, and efficiency make piezo sensors invaluable tools for flood detection within Tinkercad simulations.
Text alert simulation: Simulation of GSM Module: In simulating a GSM module for a text-driven alert system in flood detection, a virtual representation is created to mimic the behaviour of an actual GSM module that sends text alerts. Since Tinkercad doesn't inherently support direct simulation of GSM modules, a simulated environment is constructed to represent the functionality of such a module.
3.4 Simulation Steps:
1st- Virtual Interface: Creating a simulated interface that emulates the communication protocol of a GSM module.
2nd- Text Message Generation: Developing a function in the simulation environment to generate text messages upon detecting a flood condition.
void sendTextAlert() {
// Simulated function to send text alert
// Example: Output text message to console
cout << "Flood Alert: Take immediate action!" << endl;
}
3rd- Integration with Flood Detection Algorithm: Integrating the text alert function within the flood detection algorithm. When the flood condition is detected, it triggers the text alert simulation function.
if (isFloodDetected) {
sendTextAlert(); // Trigger text alert function
}
4th- Simulation Output: Upon detecting a flood (simulated condition), the system generates a text-based alert in the simulation environment.
3.5 Algorithm Development Flowchart
In Figure-2, the initiation of the system is described by the Algorithm chart, that depicts the entire pseudo code of the simulated workflow to build the system.
3.6 Simulation Workflow
3.6.1 Circuit Design and Simulation
- Circuit Design Components:
Arduino Board: Acts as the central processing unit to control and manage the sensors and output devices.
Power Supply: Provides the necessary power to the entire circuit and components.
Sensors:
PIR Sensor: Detects motion, which could indicate a change in the environment due to flooding.
Piezo Sensor: Detects vibrations, potentially signalling water movement or changes in the environment.
Ultrasonic Distance Sensor: Measures water level by sending ultrasonic waves and detecting their reflection.
Photo Resistor: Measures ambient light level, helpful in certain flood situations.
Display:
LED Level: Indicates the overall level of the detected flood situation.
LED Ultrasonic Water Level: Displays the water level as measured by the ultrasonic sensor.
LED Condition of Water Level: Indicates the condition (normal, rising, critical) of the water level.
Auxiliary Elements:
Relay SPDT: Controls the switching of higher power devices like a sump pump or alarm system.
Signal Light for rising water level: Provides a visual indication when the water level is rising.
Light Bulb: Simulating an output device such as an alarm or signalling system.
Sensor Integration: PIR, Piezo, Ultrasonic Distance, and Photo Resistor sensors are connected to the Arduino board's digital or analogue pins as per their requirements.
Reading Sensor Data: Arduino continuously reads data from these sensors to detect any changes indicating potential flooding.
Display and Output Devices: LEDs are connected to the Arduino board to display the water level, its condition, and other relevant information. Signal lights and a light bulb can be connected via a relay to trigger alerts or actions based on sensor readings.
Power Management: All components are powered adequately and within their operational limits.
Simulation: For simulation, Tinkercad is used. These platforms offer a simulated environment where components, writing Arduino code, and testing the functionality of the circuit are connected virtually without physically assembling it. Sensor inputs, monitoring LED outputs, and verifying the behaviour of the entire system based on programmed conditions can be simulated.
Alert System: To implement a text-driven alert system the Arduino is interfaced with a GSM module or use an online service (like IFTTT) to send SMS alerts or notifications based on predefined conditions (e.g., critical water level detected).
3.6.2 Sensor Data Simulation
- Initializing the Arduino board and connecting all the sensors and components as per their specifications.
- Setting pins for input (sensors) and output (LEDs, relay, signal lights, etc.).
- Initializing variables to store sensor readings, thresholds, and alert states.
- Setting thresholds for sensor readings (e.g., distance, light level) to detect normal conditions.
- Continuously monitoring sensor inputs using appropriate functions or libraries for each sensor type.
- Reading data from the sensors at regular intervals (e.g., every few milliseconds or seconds).
- Storing sensor readings in variables for processing.
- Using sensor readings to determine if flood conditions exist
- PIR Sensor: Detecting motion indicating potential flooding.
- Ultrasonic Distance Sensor: Measuring water level by calculating the distance between the sensor and the water surface.
- Photo Resistor: Checking ambient light conditions to identify changes indicative of flooding.
- Piezo Sensor: Detecting vibrations or sound caused by rising water levels.
- Comparing sensor readings with predefined thresholds:
- If the Ultrasonic Distance Sensor reading indicates a water level above a certain threshold, trigger a flood alert.
- If the PIR Sensor detects significant motion, consider it a potential flood event.
- If the Photo Resistor detects a sudden decrease in ambient light, interpreted as potential flooding.
- If the Piezo Sensor detects vibrations indicating rising water, initiate flood detection.
- If flood conditions are detected:
- Turn on LED indicators for different water levels.
- Trigger the signal light for rising water levels.
- Activate the relay to control external devices (e.g., pump, alarm system).
- Turn on a light bulb to indicate the flood situation.
- Integrating a GSM/GPRS module or an internet-enabled module to send text alerts:
- If flood conditions persist for a defined duration or exceed certain thresholds, send an alert message.
- Include relevant information like location, type of sensor triggered, and the severity of the flood.
- Continuously monitor the sensors and update the status of the system.
- Providing a mechanism to reset the system once the flood conditions are resolved or normalized.