Loading 3D model… large boards can take a moment.
Offline flood and typhoon preparedness controller for a tabletop home-safety demo.
Arduino Mega 2560 Pro · HC-SR04 · BME280 · TRI scoring · low-voltage relay cut
Overview · Features · Gallery · Quick Start · Structure · License
BahayShield ULTRA is an offline microcontroller system that combines ultrasonic water-level sensing with barometric pressure trend analysis. It computes a Typhoon Risk Index (TRI), stages visual and audible alerts, and can open a low-voltage demo load through a relay when risk stays high long enough.
The demo unit pairs a control enclosure with a house diorama and clear flood tray. It is a tabletop simulation, not a field-installed household electrical product, and it does not switch AC mains.
Controller: final build uses an Arduino Mega 2560 Pro compact module (ATmega2560, CH340 USB, dual-row 100-mil headers). Early breadboard work may use a full-size Mega 2560 form factor; the MCU and IDE board target stay the same ().
Arduino Mega or Mega 2560| Feature | Description |
|---|---|
| Water level | HC-SR04 over a fixed mast; mapped to dry / ankle / knee / waist / critical |
| Barometric trend | BME280 pressure feeds rolling slope and baseline into TRI |
| Storm profiles | Habagat, Bagyo, and Flash Flood reweight water vs pressure |
| Staged alerts | LED bar, alert LED, buzzer cadence, 20x4 LCD |
| Relay cut | Relay 1 COM-NC on a 5 V demo load; active-LOW coil drive |
| Operator inputs | PCF8574 4x4 keypad, A1 button ladder, serial commands |
| Event log | DS3231 timebase + AT24C32 EEPROM with checksummed records |
| Mechanical stack | KiCad motherboard project, 3D-printed enclosure, HC-SR04 mast |
flowchart LR
subgraph Inputs
US[HC-SR04]
BME[BME280]
POT[A0 pressure pot]
BTN[Buttons]
KEY[Keypad]
end
subgraph Controller
MCU[Mega 2560 Pro<br/>ATmega2560<br/>TRI + FSM]
RTC[DS3231 RTC]
PWR[XL4015 5 V rail]
end
subgraph Outputs
LED[TRI LEDs + alert]
BUZ[Active buzzer]
REL[Relay 1 COM-NC<br/>5 V load]
LCD[20x4 I2C LCD]
LOG[AT24C32 event log]
end
US --> MCU
BME --> MCU
POT --> MCU
BTN --> MCU
KEY --> MCU
RTC --> MCU
PWR --> MCU
MCU --> LED
MCU --> BUZ
MCU --> REL
MCU --> LCD
MCU --> LOG
Editable diagrams: docs/diagrams/.
Deeper write-up: docs/overview.md.
| Block | Part | Role |
|---|---|---|
| MCU | Arduino Mega 2560 Pro (ATmega2560) | Final controller; 5 V on 5V pin (VIN unused) |
| Water | HC-SR04 | Distance over diorama tray |
| Environment | BME280 (I2C, typically 0x76) | Pressure for TRI; temp/humidity for display only |
| RTC + log | DS3231 + AT24C32 | Timekeeping and event log |
| Display | 20x4 I2C LCD (primary 0x27) | TRI, profile, water, pressure, state |
| Keypad | 4x4 via PCF8574 (0x20) | Profile, mute, cut, ack, page |
| Buttons | 3x tactile on A1 ladder | Yellow cut, Blue view, Green ack |
| Indicators | 5 TRI LEDs + alert LED + buzzer | Staged alert UI |
| Actuator | 2-ch 5 V relay module | Relay 1 demo-load cut; Relay 2 spare |
| Power | USB-C PD source → XL4015 buck → 5.00 V | Fuse + reverse protection on the design |
| Load | 5 V LED strip on Relay 1 COM-NC | Stand-in for a ground-floor branch |
| PCB | KiCad Rev A motherboard | Headers for Mega 2560 Pro and modules |
| Enclosure | Printed base, top panel, BME280 cage, mast | Control unit + sensor geometry |
hardware/pinout.mdhardware/power-tree.mdhardware/bom.mdhardware/wiring-overview.mdpcb/enclosure/Production sketch: firmware/bahayshield-ultra/
millis() scheduler115200 baudBring-up suite: firmware/bring-up/ (I2C, LCD, keypad, RTC, BME280, relay, ultrasonic, full breadboard integration).
Libraries for production:
Wire
Adafruit BME280
Adafruit Unified Sensor
Adafruit BusIO
LCD and PCF8574 keypad use direct Wire access.
| Mega 2560 Pro (front) | Mega 2560 Pro (back) |
|---|---|
| BME280 | DS3231 + AT24C32 | XL4015 buck |
|---|---|---|
| Serial: upload OK | Serial: HC-SR04 |
|---|---|
| Serial: keypad | Serial: LCD I2C |
|---|---|
Full set: docs/photos/.
git clone https://github.com/cikeyz/bahayshield-ultra.git
cd bahayshield-ultra
firmware/bahayshield-ultra/bahayshield-ultra.ino.115200. Confirm I2C devices, LCD, and inactive relay before connecting the LED-strip load path.| Cmd | Action |
|---|---|
c | Manual relay cut |
a | Acknowledge / reset when safe |
v | Cycle LCD page |
m | Mute buzzer |
1 / 2 / 3 | Habagat / Bagyo / Flash Flood |
? | Help |
Demo script: docs/demo-procedure.md.
bahayshield-ultra/
├── README.md
├── LICENSE
├── .gitignore
├── firmware/
│ ├── bahayshield-ultra/ # production sketch
│ └── bring-up/ # M00-M16 driver tests
├── hardware/
│ ├── pinout.md
│ ├── power-tree.md
│ ├── bom.md
│ └── wiring-overview.md
├── pcb/
│ ├── README.md
│ ├── rev-a/ # KiCad Rev A + local libraries
│ └── archive/prototype-1/ # early routing baseline
├── enclosure/
│ ├── README.md
│ ├── scad/
│ └── stl/
└── docs/
├── overview.md
├── demo-procedure.md
├── diagrams/
└── photos/
MIT. See LICENSE.
Built for CMPE 311 (Microprocessor Systems), Polytechnic University of the Philippines, Group 4, A.Y. 2025-2026, under Engr. Rufo I. Marasigan Jr., D.Eng, PCpE. Published here as a standalone project.
No comments yet. Be the first to ask about this board.