Community project

LoRa Battery Alarm Monitor

Photo of LoRa Battery Alarm Monitor
Generated with AI

Deiv Patanduk

Published November 14, 2026

This project builds a remote battery monitoring system using LoRa wireless communication to track 18650 Li-ion cell voltage and trigger alarms when battery levels drop too low. The ESP32 microcontroller reads battery voltage through a resistor divider, communicates status via the SX1278 LoRa module, and activates a buzzer alarm through a transistor switch when thresholds are breached. The TP4056 charger module with integrated protection manages safe charging of the Li-ion cell, while a boost converter provides stable 5V power for the buzzer and logic circuits.

This guide provides a complete parts list, wiring diagram showing all connections from the ESP32 to the LoRa module, charger, buzzer, and battery measurement circuit, plus step-by-step assembly instructions. Firmware code is included to configure the LoRa radio, monitor battery voltage, send wireless alerts, and control the alarm buzzer based on user-defined voltage thresholds.

Wiring diagram

Wiring diagram for LoRa Battery Alarm Monitor
Loading diagram…

Gather all the parts

QtyComponent
1

18650 Li-ion Cell

18650 lithium-ion cell, nominal 3.7 V, ~2500 mAh. Common for higher-capacity portable / battery-bank style projects; needs a holder and protection / charger circuit.

1

TP4056 Li-Ion/LiPo charger module with protection

TP4056 single-cell Li-Ion/LiPo linear charger module, 5V USB input, 1A charge current (programmable). Common variants ship with DW01 protection. Pair with battery_lipo_storage for the cell.

1

Boost Converter

Output adjusted to 5.0 V

Small adjustable MT3608-style DC-DC boost converter module for stepping a lower DC input up to a higher rail such as 5V, 9V, or 12V. It is a power-path module with VIN/VOUT terminals, not a GPIO peripheral.

1

SX1278 LoRa RF Module (Ra-02)

Ai-Thinker Ra-02 style LoRa module based on Semtech SX1278, typically used at 433 MHz. Uses SPI plus reset and DIO interrupt pins. Operates at 3.3V logic only.

1

NPN Transistor (2N2222 / BC547)

General-purpose NPN bipolar junction transistor (BJT) in TO-92 package. Used as a low-side switch to drive loads (e.g. buzzers) whose current exceeds ESP32 GPIO source capability (~12 mA). A ~1 kΩ base resistor is placed between the ESP32 GPIO and the transistor base. The collector connects to the load negative terminal (buzzer –), and the emitter connects to GND. When the GPIO goes HIGH (3.3 V), the transistor saturates and switches the load on. Compatible with both 2N2222/2N2222A and BC547/BC547B variants. Add a flyback diode (e.g. 1N4148) across inductive load terminals.

1

5V active buzzer

User-specified two-terminal active buzzer; choose a low-current model (20 mA or less).

1

Resistor

1 kohm

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

220 ohm

Through-hole resistor (current-limiting in series with an LED)

1

LED

red

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Battery divider upper resistor

100 kohm

Passive 100 kohm resistor; midpoint is an analog input, not a digital output.

1

Battery divider lower resistor

100 kohm

Passive 100 kohm resistor to ground.

1

1N4001 Flyback Diode

General-purpose silicon rectifier diode used as a flyback / freewheeling diode to suppress back-EMF voltage spikes from inductive loads (DC motors, relays). Rated 50 V reverse voltage and 1 A forward current. Connected in parallel across the motor terminals with cathode (striped band) to the motor positive (+) / 5 V supply side and anode to the motor negative (−) / transistor collector side. Requires no firmware or library — purely passive protection component. Higher-voltage 1N400x rectifier variants are compatible substitutes when the current and package fit the design.

Assemble it in 6 steps

1. Place the board and prepare rails

Place the 30-pin ESP32 on the left, leaving free columns on the right. Top + is 5 V, bottom + is 3.3 V. Join top - to bottom - for common ground. ESP32 VIN goes to top +, GND to top -, and 3V3 to bottom +. Never join the two positive rails. Check for split power rails and bridge matching halves if needed.

  • Some ESP32 boards leave no usable holes beside their pins on a single breadboard; use two breadboards side by side if necessary.

2. Connect battery power

Battery positive to TP4056 B+, negative to B-. OUT+ to boost IN+ and OUT- to boost IN-. With the ESP32 disconnected, measure and adjust boost OUT to 5.0 V. Then connect OUT+ to top + and OUT- to top -. Use the protected TP4056 version with B+/B- and OUT+/OUT- terminals.

  • Use an insulated cell holder; do not solder directly to the cell. Reversed polarity or a short can cause fire.
  • Disconnect the boost 5 V wire from the breadboard before connecting ESP32 USB; do not connect both supplies together.
  • TP4056 has no load sharing: disconnect the load while charging, and set charge current within the cell rating.
  • The battery-monitor lower resistor connects to OUT- common ground, not directly to B-; this preserves the protection circuit.

3. Wire the LoRa module

VCC to bottom + (3.3 V), GND to common ground. SCK to GPIO18 (clock), MISO to GPIO19 (radio data out), MOSI to GPIO23 (radio data in), NSS to GPIO5 (select), RST to GPIO14 (reset), DIO0 to GPIO4 (interrupt).

  • Never power the radio from 5 V. Attach the matching antenna before any future radio transmission.
  • GPIO5 is a boot-strapping pin, also the listed default SPI select. Do not add circuitry that forces it low at startup.

4. Wire the buzzer switch

GPIO25 to the 1 kohm resistor; its other lead and transistor base share row 30 a-e. Emitter to ground. Collector and buzzer negative share row 32 a-e. Buzzer positive to top +. Put the diode across the buzzer: banded end to positive, other end to row 32.

  • Check the actual transistor datasheet for base, collector and emitter positions; 2N2222 and BC547 lead orders differ. Do not guess from the flat face.

5. Wire the indicator

GPIO26 to the 220 ohm resistor. Its other lead and LED anode share row 50 a-e. LED cathode (short leg, flat-edge side) to ground.

6. Wire battery measurement

Battery positive and R1 first lead share row 40 a-e. R1 second lead, R2 first lead and GPIO35 share row 42 a-e. R2 second lead to common ground. Both resistors are 100 kohm; the divider limits a fully charged 4.2 V cell to 2.1 V at GPIO35.

  • Each numbered a-e strip is one connection; f-j is a separate strip across the centre gap. Keep row 30, 32, 40, 42 and 50 separate.

Review all connections

1. Connections between "battery" and "ESP32"

FunctionbatteryESP32
power+V → TP4056 Li-Ion/LiPo charger module with protection B+EXT
groundGND → TP4056 Li-Ion/LiPo charger module with protection B-EXT
power+V → Battery divider upper resistor P1EXT

2. Connections between "charger" and "ESP32"

FunctionchargerESP32
powerOUT+ → Boost Converter VIN+EXT
groundOUT- → Boost Converter VIN-EXT
powerIN+ → Charger USB 5V positiveEXT
groundIN- → Charger USB groundEXT

3. Connections between "boost" and "ESP32"

FunctionboostESP32
powerVOUT+5V
groundVOUT-GND

4. Connections between "radio" and "ESP32"

FunctionradioESP32
powerVCC3V3
groundGNDGND
spiSCKGPIO 18
spiMISOGPIO 19
spiMOSIGPIO 23
spiNSSGPIO 5
digitalRESETGPIO 14
digitalDIO0GPIO 4

5. Connections between "baseR" and "ESP32"

FunctionbaseRESP32
digitalP1GPIO 25
digitalP2 → NPN Transistor (2N2222 / BC547) BASEEXT

6. Connections between "transistor" and "ESP32"

FunctiontransistorESP32
groundEMITTERGND
digitalCOLLECTOR → 5V active buzzer NEGEXT

7. Connections between "buzzer" and "ESP32"

FunctionbuzzerESP32
powerPOS5V

8. Connections between "diode" and "ESP32"

FunctiondiodeESP32
passiveCathode → 5V active buzzer POSEXT
passiveAnode → 5V active buzzer NEGEXT

9. Connections between "ledR" and "ESP32"

FunctionledRESP32
digitalP1GPIO 26
digitalP2 → LED ANODEEXT

10. Connections between "indicator" and "ESP32"

FunctionindicatorESP32
groundGNDGND

11. Connections between "r1" and "ESP32"

Functionr1ESP32
analogP2 → Battery divider lower resistor P1EXT
analogP2GPIO 35

12. Connections between "r2" and "ESP32"

Functionr2ESP32
groundP2GND

Deploy the firmware

#include <Arduino.h>
// Wiring-only placeholder: no radio, alarm or measurement behaviour.
void setup() {
  digitalWrite(25, LOW); pinMode(25, OUTPUT);
  digitalWrite(26, LOW); pinMode(26, OUTPUT);
}
void loop() { delay(1000); }

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik