project
Relay Bomb
Project overview
Relay Bomb Only for Education Eurpose
System Overview & Core Functionality
This project is a self-contained, microcontroller-based timed relay controller built around the Arduino Nano platform. The device functions as a programmable digital countdown timer designed to energ2e an isolated relay output upon reaching zero. The user interface consists of: 0.96-inch I2C OLED Display (SSD1306): Displays real-time visual feedback, including the system state and current countdown time. Tactile Push Button: Serves as the user input trigger to initiate the sequence. 5V Active Buzzer: Provides audible notifications (e.g., tick sounds during countdown and a continuous signal upon completion). 5V Relay Module: Acts as an electrically isolated switch to toggle external higher-power circuits or loads.
Hardware Architecture & Component Analysis
A. Arduino Nano (ATmega328P) The Arduino Nano acts as the central processing unit (CPU). It operates at 5V logic and 16 MHz. It reads the trigger input, updates the OLED screen via I2C, tracks execution timing via software timers (millis() or delay()), controls the buzzer output, and toggles the relay driver pin.
B. 0.96" OLED Display (I2C) The SSD1306 monochrome OLED uses the I2C communication protocol, requiring only four connections: VCC & GND: Power supply (5V or 3.3V depending on the module driver). SDA (Data) & SCL (Clock): Connected to the hardware I2C pins of the ATmega328P (A4 for SDA and A5 for SCL).
C. 5V Relay Module The relay module isolates the low-voltage control circuit from the secondary load circuit: Optocoupler Isolation: Most standard 5V modules feature an optocoupler (e.g., PC817) that separates the microcontroller’s GPIO from the relay coil power, preventing back-EMF (inductive spikes) from reaching the microcontroller. Flyback Diode: Placed in parallel across the relay coil to safely dissipate stored magnetic energy when the coil de-energizes. Terminal Block Pins: Provides NO (Normally Open), COM (Common), and NC (Normally Closed) terminals.
D. User Interface (Button & Buzzer) Button: Wired to a digital input pin configured with an internal pull-up resistor (INPUT_PULLUP), grounding the pin when pressed. Buzzer: Connected to a digital GPIO pin, sounding pulsed tones during the countdown sequence.
Firmware Logic & State Machine
The firmware operating the system typically follows a Finite State Machine (FSM) model: [IDLE STATE] ---> (Push Button Pressed) ---> [COUNTDOWN STATE] ---> (Timer reaches 0) ---> [TRIGGER STATE] --->(Reset/Timeout)
Idle State: The microcontroller monitors the push button. The OLED displays a ready message (e.g., "Press to Start"). Countdown State: Upon press, a 10-second non-blocking or blocking timer loop starts. Every second, the counter decrements, the screen updates, and the buzzer emits a short pulse. Trigger State: At 0 seconds, the relay signal pin goes HIGH (or LOW depending on active-low/high relay configuration). The relay energizes, closing the contacts, and the buzzer sounds a sustained tone.
