Skip to the content
2 layers130 × 91.5 mmAlarm Control System, the printed circuit board in 3D

Laser-based obstacle detection alarm with multi-code deac tivation system, integrating analog sensing with digital microcontroller control.

Size
130 × 91.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
45
Nets
84
Pads
181
Tracks, vias
219, 14
Pours
25
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
10 Feb 2025
Updated
5 Jun 2025

Overview

Alarm Control System is an open-source printed circuit board by ACHRAFAHAL, from the ACHRAFAHAL/Obstacle_Detection_Alarm_With_Protection_Codes_Security_System repository on GitHub. It is a 2-layer board of 130 × 91.5 mm with 45 parts on 84 nets, routed with 219 tracks and 14 vias.

It is built around the AZ1117CH2-3.3TRG1. Its parts include 14 resistors, 9 capacitors, 8 diodes, 4 connectors and 3 ICs.

Main components

1

README

README.md

Obstacle Detection Alarm Secured by Protection Codes

Description

This project outlines the design and implementation of an obstacle detection system that triggers a frequency-modulated audible alarm upon detecting a disrupted red LASER beam. The alarm's deactivation is secured through a precise sequence of three hexadecimal codes, complemented by a rescue code for single errors and a super-code for multiple erroneous entries. This system is ideally suited for various security, surveillance, or access control applications where the detection of unauthorized presence or intrusion is paramount.

Table of Contents

Features

  • Optical Detection: The system employs a red LASER emitter and a pair of BPX81 phototransistors for precise obstacle detection. During initial testing phases, a push-button can substitute the optical detection for functional verification. The detection logic utilizes a 74LS32 OR gate, which triggers the alarm as soon as either sensor detects a beam interruption. Visual feedback for sensor activation is provided by a green LED. A LM311 comparator then converts the analog output of the OR gate into a binary signal compatible with the microcontroller.

  • Audible Alarm**: The alarm generates a distinctive two-tone binary modulated sound, alternating between 2500 Hz and 5000 Hz every 0.5 seconds. The core of the sound generation is the XR2206 integrated circuit, configured as a voltage-controlled oscillator (VCO), capable of generating a clean sinusoidal signal. The signal processing chain involves integrating the microcontroller's square wave output into a triangular signal (0-3V) suitable for the XR2206's VCO input, followed by amplification via a push-pull stage to drive the KSSG1708 loudspeaker.

  • Security Sequence: Alarm deactivation is protected by a precise three-code hexadecimal sequence (Code 1, Code 2, Code 3). In case of an incorrect entry, a "DEFAUT" rescue code (Code 4) can be used for a restricted unlock. For multiple errors, an "ERREUR" super-code (Code 5) is required to fully reset the system procedure. This sequential logic is managed by a state machine implemented in the microcontroller's firmware.

  • Visual Indicators: The system provides clear visual feedback through three LEDs: a green LED indicates a correct procedure in progress (States 1, 2, and 3). An orange LED signifies the "DEFAUT" state, while a red LED illuminates for the "ERREUR" state. These LEDs are directly driven by the microcontroller.

  • Microcontroller: The STM32L476RG microcontroller (Nucleo-L476RG development board) serves as the central processing unit, handling the sequential and combinational logic for code verification, error state management (DEFAUT, ERREUR), and memory for predefined codes. It interfaces with a rotary encoder for user input and an OLED-SSD1306 display for detailed system status and code entry prompts. The microcontroller's internal peripherals, such as timers (TIM2 for encoder, TIM4 for PWM siren ) and external interrupts (EXTI for encoder button ), ensure real-time and reactive system operation.

Required Hardware

  • LASER emitter: ADL-65075TL (not explicitly mentioned as a specific component but implied by "red LASER beam" ).

  • Phototransistor: BPX81.

  • Operational amplifiers: TL082 (used in the audio signal chain ).

  • Comparator: LM311.

  • Logic Gate: 74LS32 (OR gate).

  • Timer: While a NE555 is listed in the example, the STM32L476RG's internal timers (TIM2, TIM4) are primarily used for encoder interface and PWM siren generation in the project.

  • Function generator: XR2206.

  • Mini speaker: KSSG1708.

  • DC-DC Converter: IA1215S (for ±15V symmetric power to the audio circuit). Wurth 173010542 (12V to 5V conversion for the control part).

  • LDO Regulator: AZ1117CH2-3.3TRG1 (SOT-223 package, for 5V to 3.3V regulation).

  • Development board: STM32L476RG (Nucleo-L476RG).

  • LEDs: Red LEDs (0603 SMD): Quantity: 4 (for power control and error indication ). Yellow LED (0603 SMD): Quantity: 1 (for DEFAUT state indication). Green LED (0603 SMD): Quantity: 1 (for correct procedure indication).

  • Resistors: Various values (e.g., 220Ω, 400Ω, 800Ω, 1kΩ, 1.6kΩ, 5.1kΩ, 820Ω, 10kΩ, 15kΩ, 3.3kΩ ).

  • User inputs: Rotary encoder (Incrémental MEC (482016514001)) with integrated push-button.

  • Display: OLED-SSD1306 (I2C interfaced, SBC-OLED01 model).

  • Capacitors: A range of ceramic (10nF, 100nF ) and electrolytic (1µF, 10µF, 22µF, 47µF, 100µF ) capacitors for filtering, decoupling, and signal coupling.

  • Connectors: JST connectors (Conn_01x02, Conn_01x03, Conn_01x04 ) for inter-module connections and power input.

  • Protection Diodes: ESD diodes (WE 82402374) for protecting I2C and encoder lines from electrostatic discharge.

  • Potentiometers: 20KΩ, 50KΩ, 500Ω for fine-tuning.

Schematics

  1. System General Diagram
    System Block Diagram A comprehensive block diagram illustrating the interconnections between the main functional modules: Supply (providing +12V, +5V, +3.3V), NUCLEO-L476RG microcontroller, Rotary Encoder, and Input/Output signals (VALID_ALARM, SIG_ALARM, INPUT, INPUT_Supply). It also shows the I2C connection to the OLED-SSD1306 display and the mounting holes for the PCB.

  2. Sensor Model
    Sensor Model This schematic details the obstacle detection unit. It includes two BPX81 phototransistors (Q1, Q2) that detect the interruption of the LASER beam. Their outputs feed into a 74LS32 OR gate (U1), which activates when either beam is broken. A verification LED (D3, GREEN_LED) provides visual confirmation of sensor activation. The signal is then passed to an LM311 comparator (U2), which compares the OR gate's output to a 2.5V reference voltage, producing a binary signal for the microcontroller. This section also includes power supply filtering and visual indicators using NPN (2N1711) and PNP (2N2905) transistors.

  3. Audio Signal Chain
    Audio Signal Chain This diagram illustrates the steps involved in generating and amplifying the alarm sound. The process begins with a square wave signal (0 to 3.3V) from the microcontroller (STM32). This signal is then integrated by an operational amplifier (U1A) to transform it into a triangular wave centered at 0V (±1.65V). A second operational amplifier (U1B), configured as a non-inverting amplifier, shifts and scales this signal to a 0-3V range, suitable for the XR2206's VCO input. The XR2206 (U2) then generates the frequency-modulated sinusoidal signal (2500 Hz / 5000 Hz). Finally, this signal is amplified by a symmetric push-pull stage using 2N1711 (Q1) and 2N2905 (Q2) transistors to drive the KSSG1708 loudspeaker (LS1). The audio circuit is powered by a ±15V symmetric supply generated by an IA1215S DC-DC converter (PS1) from a 12V input.

  4. Unlock Sequence
    Unlock Sequence This state graph (Figure 1.1) visually represents the precise sequential logic for alarm deactivation. Starting from the "ALARME INACTIVE" (Etat 0) state, an active sensor transitions the system to "ALARME ACTIVE" (Etat 1). The user must then enter three correct codes sequentially (Code 1, Code 2, Code 3), moving through Etat 1, Etat 2, and Etat 3. If any code is incorrect, the system branches to a "DEFAUT" state (Etat 4), requiring Code 4. If Code 4 is incorrect, or multiple errors occur, it transitions to an "ERREUR" state (Etat 5), requiring Code 5 to reset the system. A successful sequence at Etat 3 returns the system to "ALARME INACTIVE" (Etat 0).

Installation

PCB Fabrication: Generate Gerber files from the KiCad projects for each of the three main parts: Detection, Control, and Actuator. These files are then sent to a PCB manufacturer.

Component Soldering: Upon receiving the engraved PCBs, manually solder all through-hole components. Special attention should be paid to the spacing and quality of solder joints to prevent issues like short-circuits, as encountered during initial testing.

Power Supply Integration: For the Control PCB, integrate the J401 connector for the 12V input, the Wurth 173010542 DC-DC converter (U401) for 12V to 5V conversion, and the AZ1117CH2-3.3TRG1 LDO regulator (U402) for 5V to 3.3V regulation. Visual control LEDs (D401, D402, D403) should be verified for proper operation.

Microcontroller Setup: Carefully mount the Nucleo-L476RG board onto the designated footprint on the Control PCB. Interconnections: Connect the Detection module to the Control module via J1 and J3 connectors. Ensure proper signal connections for INPUT (laser detection) and INPUT_Supply. Connect the Control module to the Actuator module via the J2 connector, ensuring correct routing for VALID_ALARM (alarm activation signal) and SIG_ALARM (power supply to the output circuit).

Firmware: Program the STM32L476RG microcontroller with the project firmware. The software is designed with a modular architecture, leveraging the microcontroller's internal peripherals such as timers (TIM2 for encoder, TIM4 for PWM siren ), external interrupts (EXTI for encoder button press ), I2C for OLED communication, and GPIOs for LED control. This ensures efficient and responsive operation.

Usage

System Activation: The alarm system is initialized in an "ALARM INACTIVE" (Etat 0) state, as shown on the OLED display. Obstacle Detection: When an obstacle interrupts the LASER beam, the phototransistors detect the change, triggering the 74LS32 OR gate and the LM311 comparator. This sends a logical front signal to the STM32's INPUT pin, transitioning the system to the "ALARM ACTIVE" state (Etat 1). The audible alarm will simultaneously be triggered.

Alarm Deactivation: To disarm the alarm, the user must enter a sequence of three correct hexadecimal codes (Code 1, Code 2, Code 3) using the rotary encoder. Code Entry: Rotate the encoder to select a character (0 to F) and press the integrated push-button to validate each character. The OLED display will guide the user by showing prompts like "CODE 1:X", "CODE D:X", or "CODE E:X".

Correct Sequence: Successful entry of Code 1, Code 2, and Code 3 (transitioning through Etat 1, Etat 2, and Etat 3) will deactivate the alarm, and the system will revert to the "ALARM OFF" state (Etat 0). The green LED will illuminate during the correct procedure.

Incorrect Entry (DEFAUT State): If a code is entered incorrectly, the system may transition to the "DEFAUT" state (Etat 4), requiring the user to enter a specific rescue code (Code 4). The orange LED will indicate this state.

Multiple Errors (ERREUR State): In cases of multiple incorrect entries or an incorrect rescue code, the system will enter the "ERREUR" state (Etat 5), demanding the entry of a super-code (Code 5) to reset the entire procedure and return to Etat 0. The red LED will blink to signify this critical error state.

Visual Feedback: The OLED display provides real-time information on the system's status and the progress of code entry. The three colored LEDs (Green, Orange, Red) offer immediate visual cues regarding the system's current state and the validity of code entries.

contributing


Ahal Achraf Profile Picture
Ahal Achraf
Control Part
GitHub
Hussain Ali Profile Picture
Hussain Ali
Control Part
GitHub

Parts

45
QtyValueFootprintReferences
610kResistor_SMD:R_0402_1005MetricR901, R902, R903, R904, R905, R906
6MountingHole_PadMountingHole:MountingHole_3.2mm_M3_PadH102, H103, H104, H106, H107, H108
4RED_LEDLED_SMD:LED_0603_1608MetricD401, D402, D403, D502
310nCapacitor_SMD:C_0402_1005MetricC901, C902, C903
2100nCapacitor_SMD:C_0402_1005MetricC404, C904
21kResistor_SMD:R_0402_1005MetricR801, R802
2800Resistor_SMD:R_0402_1005MetricR501, R503
2Conn_01x03Connector_JST:JST_EH_S3B-EH_1x03_P2.50mm_HorizontalJ2, J3
2WE 82402374Library:SC70-5LD801, D901
1100uCapacitor_SMD:C_0402_1005MetricC403
110uCapacitor_SMD:C_0402_1005MetricC401
1173010542Library:173010xxxU401
11k6Resistor_SMD:R_0402_1005MetricR403
11uCapacitor_SMD:C_0402_1005MetricC801
122uCapacitor_SMD:CP_Elec_5x5.4C402
1400Resistor_SMD:R_0402_1005MetricR504
15k1Resistor_SMD:R_0402_1005MetricR402
1820Resistor_SMD:R_0402_1005MetricR404
1AZ1117CH2-3.3TRG1Package_TO_SOT_SMD:SOT-223-3_TabPin2U402
1Conn_01x02Connector_JST:JST_XH_S2B-XH-A_1x02_P2.50mm_HorizontalJ401
1Conn_01x04Library:SBC-OLED01J801
1GREEN_LEDLED_SMD:LED_0603_1608MetricD505
1NUCLEO_L476RGLibrary:NUCLEO_L476RGU501
1RotaryEncoder_SwitchLibrary:482016514001_Mechanical_Incremental_Encoder_SwitchSW901
1YELLOW_LEDLED_SMD:LED_0603_1608MetricD504

More from ACHRAFAHAL/Obstacle_Detection_Alarm_With_Protection_Codes_Security_System

2
  • 2 layers72 × 72 mmAlarme, the printed circuit board in 3D

    Alarme

    ACHRAFAHAL/Obstacle_Detection_Alarm_With_Protection_Codes_Security_System

    Laser-based obstacle detection alarm with multi-code deac tivation system, integrating analog sensing with digital microcontroller control.

    49 parts1
  • 2 layers108 × 38 mmTPv1, the printed circuit board in 3D

    TPv1

    ACHRAFAHAL/Obstacle_Detection_Alarm_With_Protection_Codes_Security_System

    Laser-based obstacle detection alarm with multi-code deac tivation system, integrating analog sensing with digital microcontroller control.

    30 parts1

Similar boards

  • 4 layers140 × 300 mmLLC DCDC V5, the printed circuit board in 3D

    LLC DCDC V5

    BOAB235/Design_of_1200W_LLC_DCDC

    In battery electric vehicles (BEVs) and 48 V mild-hybrid architectures, a high-voltage DC-DC converter steps the 300–400 V traction battery bus down to the 48 V auxiliary rail that powers lighting, HVAC blowers…

    212 parts1
  • 4 layers121 × 96 mmClaw Machine, the printed circuit board in 3D

    Claw Machine

    emiz-jh/2526_Maker_ClawMachine

    Projet de machine à pince réalisé dans le cadre de l'Option Maker ENSEA 2025-2026.

    92 parts1
  • 2 layers60 × 50 mmAesir scale, the printed circuit board in 3D

    Aesir scale

    aesirkth/atlas_load_cell

    A load cell reader over CAN

    56 parts
  • 4 layers109 × 86 mmHell, the printed circuit board in 3D

    Hell

    DBXYD/2526_Projet1AB_Helios

    Projet de 1ere année ENSEA sur un strobe solaire

    171 parts
  • 2 layers99.3 × 95.1 mmPower processing unit, the printed circuit board in 3D

    Power processing unit

    ear0/ECE445_Team18

    ECE 445 senior design project - Spring 2024

    80 parts
  • 4 layers60 × 58 mmProjetCorps, the printed circuit board in 3D

    ProjetCorps

    mael-lukas/2324_Projet1AB_Animatronic

    Projet d'électronique 1ère année A et B - Création d'un animatronic.

    64 parts

Questions

How big is the Alarm Control System PCB?

It measures 130 × 91.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Alarm Control System use?

45 parts, built around the AZ1117CH2-3.3TRG1. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Alarm Control System KiCad files?

From the ACHRAFAHAL/Obstacle_Detection_Alarm_With_Protection_Codes_Security_System repository on GitHub, at the commit this page was made from: the board is PCB design/command/Alarm Control System.kicad_pcb and its schematic PCB design/Sound amplification/Alarme.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Alarm Control System design in my own project?

Its repository states no licence, so its author keeps all rights: ask ACHRAFAHAL before reusing the design.