bahayshield-ultra

Public

@cikeyz

Share bahayshield-ultra

Check access before sharing the link.

Who can open this board

Anyone can open this board. No sign-in is required.

This link opens the latest version. Copying it does not grant additional access.

Loading 3D model… large boards can take a moment.

README

BahayShield ULTRA

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

Contents

Overview

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).

Features

FeatureDescription
Water levelHC-SR04 over a fixed mast; mapped to dry / ankle / knee / waist / critical
Barometric trendBME280 pressure feeds rolling slope and baseline into TRI
Storm profilesHabagat, Bagyo, and Flash Flood reweight water vs pressure
Staged alertsLED bar, alert LED, buzzer cadence, 20x4 LCD
Relay cutRelay 1 COM-NC on a 5 V demo load; active-LOW coil drive
Operator inputsPCF8574 4x4 keypad, A1 button ladder, serial commands
Event logDS3231 timebase + AT24C32 EEPROM with checksummed records
Mechanical stackKiCad motherboard project, 3D-printed enclosure, HC-SR04 mast

System architecture

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.

Hardware

BlockPartRole
MCUArduino Mega 2560 Pro (ATmega2560)Final controller; 5 V on 5V pin (VIN unused)
WaterHC-SR04Distance over diorama tray
EnvironmentBME280 (I2C, typically 0x76)Pressure for TRI; temp/humidity for display only
RTC + logDS3231 + AT24C32Timekeeping and event log
Display20x4 I2C LCD (primary 0x27)TRI, profile, water, pressure, state
Keypad4x4 via PCF8574 (0x20)Profile, mute, cut, ack, page
Buttons3x tactile on A1 ladderYellow cut, Blue view, Green ack
Indicators5 TRI LEDs + alert LED + buzzerStaged alert UI
Actuator2-ch 5 V relay moduleRelay 1 demo-load cut; Relay 2 spare
PowerUSB-C PD source → XL4015 buck → 5.00 VFuse + reverse protection on the design
Load5 V LED strip on Relay 1 COM-NCStand-in for a ground-floor branch
PCBKiCad Rev A motherboardHeaders for Mega 2560 Pro and modules
EnclosurePrinted base, top panel, BME280 cage, mastControl unit + sensor geometry

Firmware

Production sketch: firmware/bahayshield-ultra/

  • Non-blocking millis() scheduler
  • Fixed-point TRI suited to Mega-class SRAM
  • Non-blocking HC-SR04 echo state machine
  • Active-LOW relay with confirm window before power-cut latch
  • Serial at 115200 baud

Bring-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)
BME280DS3231 + AT24C32XL4015 buck
Serial: upload OKSerial: HC-SR04
Serial: keypadSerial: LCD I2C

Full set: docs/photos/.

Quick Start

git clone https://github.com/cikeyz/bahayshield-ultra.git
cd bahayshield-ultra
  1. Install Arduino IDE or Arduino CLI.
  2. Select board Arduino Mega or Mega 2560 (ATmega2560 on the Mega 2560 Pro module).
  3. Install Adafruit BME280 and its dependencies.
  4. Open firmware/bahayshield-ultra/bahayshield-ultra.ino.
  5. Upload with the external load disconnected.
  6. Open Serial Monitor at 115200. Confirm I2C devices, LCD, and inactive relay before connecting the LED-strip load path.
CmdAction
cManual relay cut
aAcknowledge / reset when safe
vCycle LCD page
mMute buzzer
1 / 2 / 3Habagat / Bagyo / Flash Flood
?Help

Demo script: docs/demo-procedure.md.

Project Structure

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/

Safety

  • Relay contacts switch a 5 V demo load only. No AC, outlets, extension cords, or household branch wiring.
  • Humidity and temperature are display/log context. Pressure is the barometric input to TRI and cutoff logic.
  • Storm demos can use the A0 potentiometer for a repeatable pressure curve while BME280 still reports real ambient pressure.
  • Verify buck output at 5.00 V, relay active level, and COM-NC continuity before a live demo.

License

MIT. See LICENSE.

Course Note

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.

Comments

No comments yet. Be the first to ask about this board.

Ask about this board

Sign in to BoardRepo

New here? Signing in creates your account; there is no separate sign-up.