5905

This project proposes the creation of a standalone alarm system based on an Arduino Nano board (ATmega328P) combined with a BK A7670E 4G GSM module. The system allows for remote activation and control via SMS, while also retaining manual operation via an on/off button. My existing alarm system (Septam wired control panel + Daitem transmitter) was completely destroyed by a lightning strike. As I was away from home less frequently, I disconnected everything: mains power, telephone line, system batteries (12V/

System Overview:
 
The Arduino Nano (ATmega328P) forms the logical core of the system: it manages alarm zones, operating logic, GSM communication, and parameter saving to EEPROM.
 
The siren timing functions are handled by a secondary ATtiny85 microcontroller, programmed to provide autonomous timing, independent of the Nano's operation.
 
The Nano does not keep the sirens continuously active; it sends a trigger logic pulse to the ATtiny only if the local timer is not already active.
 
This design ensures reliable siren triggering, even in the event of software overload or transient disturbances in the main microcontroller.
 
Remote communication is provided by a BK A7670E 4G GSM module, controlled by AT commands in text mode. The code uses the SoftwareSerial library, with an extended 128-byte buffer.
 
The system operates on a 12V battery, with mains power and battery voltage monitoring.
 
See Diagram: Schema_ALARME_SMS_4Z_4G_2026.pdf
 
Logic Core: Arduino Nano (ATmega328P)
 
The Arduino Nano performs the following functions:
 
- Reading and managing:
 
alarm zones Z1 to Z4 (NC contacts)
tamper zone Z5 (NC contacts)
Z6 on/off input via lock (NO contact)
 
system states (rest, armed, alarm)
 
- GSM module control (SMS)
- Saving and restoring parameters to EEPROM
- Local and remote signaling (LEDs, buzzer)
 
Inputs:
 
- Z1 to Z4, intrusion alert zones (Alarm, A0..A3)
- Z5, tamper zone (AP, D10)
- Z6, on/off input (key/lock, D9)
 
The 6 zone inputs are protected by a series resistor of A 2.2 kΩ resistor, followed by a 100 nF capacitor connected to ground, is connected directly to a microcontroller input configured as INPUT_PULLUP.
 
The 2.2 kΩ / 100 nF capacitor pair forms an RC filter of approximately 220 µs, sufficient to eliminate contact bounce, RF noise, or transient pulses due to sometimes significant cable lengths.
 
In the event of an accidental external voltage application (up to 12 V in the context of a wired alarm), the current injected into the microcontroller's internal protection diodes remains below 0.5 mA. This is within the strictly acceptable lower limit, guaranteeing the survival of the I/O without the need for additional components.
 
The 'Alarm + AP' zones are treated identically; they are wired as NC (normally closed), in accordance with standard safety practices: any line interruption is immediately interpreted as a fault or an Intrusion.
 
Zone 5 (Tamper Protection) can be ejected from the system (via SMS or jumper).
 
The On/Off zone is normally open. A lock action closes a contact that connects GND to the controller input.
Technical Inputs:
 
- Mains Power Fault
Mains power is detected at the charger output before the Schottky diode, ensuring reliable information regardless of the battery status.
 
This information is conditioned by an NPN transistor, providing the microcontroller with inverted logic on input A7. This design allows for simple electrical separation, reliable detection of mains power presence or absence, and simplified software processing.
 
- Battery Fault
The battery voltage is measured after the Schottky diode, corresponding to the voltage actually available to the system in backup mode.
 
The measurement is performed using a 100 kΩ / 33 kΩ voltage divider, supplemented by a 1 kΩ series resistor. before analog input A6. This series resistor helps limit the current to the ADC input during transients, thus providing additional protection for the microcontroller.
 
This circuit allows for stable and sufficiently accurate measurements for monitoring the state of charge and detecting a low battery, used to trigger GSM notifications.
 
Outputs:
 
- Indoor siren (pulse)
- Outdoor siren (pulse)
- Siren RESET output (pulse)
 
For each siren (indoor and outdoor):
The Nano sends a HIGH signal to request activation. If no timer is running, the timer starts and the corresponding relay is activated for as long as the timer is active.
 
If a reset is sent by the Nano, and the time limit is exceeded, the siren is deactivated and the system is reset.
The reset has priority and is common to both sirens.
 
Indicators:
 
- System off: Green loop control LED.
 
The green LED, known as the loop control LED, illuminates when All detection zones are closed, indicating a normal system state.
 
This information comes from the zone control loop, the status of which is visually displayed
both on the main control panel and, where applicable, on a sub-control panel.
 
Remote lock equipped with an LED.
 
- System in operation: Red LED indicates alarm is active.
 
When the tamper zone is ejected via SMS using the watchdog timer, the green LED flashes when the system is disarmed, and the red LED flashes when the system is armed.
 
For both system status indicators, a similar transistor stage is used to allow simultaneous control of the LEDs from the same logic signal.
Resistors limit the LED current depending on their location (control box or remote lock).
 
A shunt allows, if necessary, adaptation of the wiring when the LED is integrated directly into the external lock.
 
A diode protects the transistor's base-emitter junction against potential reverse or transient voltages.
 
- Buzzer.
 
For local notification, a buzzer is integrated into the system. It is controlled by an NPN transistor connected in ground-switching mode, with a base resistor. The buzzer is powered directly by +5V.
 
This device allows for the emission of two distinct sound sequences, corresponding respectively to the system's power-up and power-down.
 
A "Buzzer ON/OFF" jumper is provided to disable the buzzer if necessary.
 
Power Supply Architecture and Battery Management
 
The system is powered upstream by a 240 VAC / 24 V DC MainWell type power supply.
 
This 24 V voltage is distributed directly to the motherboard, where it serves as the primary source for battery charging and generating secondary voltages.
 
In the initial version of the system, power and battery management relies on a conventional linear charging scheme, suitable for low-capacity lead-acid batteries.
 
The voltage from the external 24 V DC power supply is applied to an LT1083 adjustable linear regulator, configured as both a current and voltage source. This component provides both current limiting and voltage regulation for the battery. Adjustment is achieved via a resistive bridge coupled with an adjustment potentiometer, allowing for precise adaptation of the output voltage.
 
Current limiting is achieved by measuring the voltage drop across a low-value resistor (R13), which drives a BD135 power transistor.
When the current exceeds the set threshold, the transistor activates the ADJ pin of the regulator to reduce the output voltage, thus protecting the battery from overcharging.
 
An indicator LED displays the charging status or the presence of current.
 
Isolation between the mains power supply and the battery is ensured by Schottky diodes, limiting current feedback and enabling automatic switching between the external source and the battery in the event of a mains power failure.
 
While this architecture offers the advantages of simplicity and robustness, it suffers from low efficiency. The heat dissipation of the linear regulator becomes significant due to the large voltage drop between the 24V input and the battery voltage, necessitating a substantial heatsink and negatively impacting the overall system efficiency.
 
old_ALIM.pdf schematic
 
The system's evolution is based on the integration of an HW083 switching charge module directly onto the motherboard. This module, adjustable in voltage and current, replaces the linear charger of the first version and allows for a significant improvement in efficiency and thermal behavior.
 
The HW083 charger is set to deliver a voltage of 13.8V after the output Schottky diode.
 
This value corresponds to a standard floating charge, suitable for the continuous maintenance of a 7Ah lead-acid battery. The charging current is limited to 700mA, or approximately C/10, a recommended value to ensure reliable charging without excessive heating or premature battery aging.
 
Mains power (EDF) detection is performed upstream of the Schottky diode, directly on the output of the HW083 module. This arrangement clearly distinguishes between mains power and battery power, regardless of the battery's state of charge or voltage.
 
Conversely, battery voltage monitoring is performed downstream of the Schottky diode, on the common battery/power supply rail. This measurement accurately reflects the actual voltage available to the system in backup mode, including the voltage drop across the diode and the actual operating conditions.
 
The +5V output is now generated by an adjustable LM2596 step-down converter, powered directly from the 13.8V battery/load rail. This switching converter offers high efficiency, significantly higher than that of a linear regulator, which greatly reduces heat dissipation, even at high output currents.
 
Output voltage adjustment
The voltage is maintained by an adjustable resistive bridge, allowing for precise adjustment of the +5V supply.
 
The 3.3V supply for the GSM module's UART interface is provided by a separate TLV76033DBZR LDO regulator, distinct from the Arduino Nano.
 
The Arduino Nano's integrated 3.3V regulator is not used. This approach avoids any dependence on the implementation of the onboard regulator, which can vary depending on the commercially available module versions.
 
This architecture also allows, depending on the design choice, the use of the microcontroller alone, independently of the Arduino board.
 
Finally, it guarantees a stable voltage for the UART logic levels and improves immunity to interference generated by the GSM module, as well as the use of the published BK-A7670E interface.
 
Secondary microcontroller: ATtiny85.
 
The ATtiny85 is not the alarm trigger, but a timer for the sirens. Its role is strictly limited to receiving direct commands from the Nano, triggering the siren relays, providing local time delay, and ensuring automatic shutdown as a last resort.
 
The ATtiny85 code allows for the following relay configurations:
CLASSIC_RELAY = 1 → relay active at HIGH
CLASSIC_RELAY = 0 → relay active at LOW (Chinese relay boards)
 
ATTiny85 code: ATTINY_TEMPO_ALARME_SMS.ino
 
For more information, please refer to the schematic.
 “I’ll be back. for the code :-)