Project Overview
Arduino Nano + ADXL345 bike alarm: Build a motion-triggered bike theft alarm where an ADXL345 accelerometer detects movement, an Arduino triggers a 110 dB buzzer, and an HC-05 sends a Bluetooth alert to your phone.
This build is battery-powered, compact enough to hide in a saddle bag, and can run for weeks depending on your battery and usage.
- Time: ~1.5 hours
- Skill level: Intermediate
- What you will build: A vibration-triggered bike alarm with a buzzer and a phone notification.
Parts List
From ShillehTek
- ADXL345 Pre-Soldered Accelerometer - detects movement and vibration.
- KY-006 Passive Buzzer - loud local alarm output.
- HC-05 Bluetooth Module - sends an alert message to your phone over Bluetooth Classic.
- Arduino Nano V3.0 Pre-Soldered - runs the alarm logic and interfaces with the sensor.
- TP4056 LiPo Charger - charges and protects the 18650 cell.
- 120 PCS Dupont Jumper Wires - quick wiring for prototyping.
External
- 18650 LiPo cell
- Android phone + "Bluetooth Terminal" app (or any HC-05 reader)
- Small project box
Note: For iPhone-compatible alerts, swap HC-05 for our HM-10 BLE module.
Step-by-Step Guide
Step 1 - Gather the components
Goal: Make sure you have all modules and power parts ready before wiring.
What to do: Collect the Arduino Nano, ADXL345, buzzer, HC-05, TP4056, jumper wires, and your enclosure.
Expected result: All parts are ready to be wired and fit your planned enclosure.
Step 2 - Wire the ADXL345, buzzer, and Bluetooth module
Goal: Connect the sensor over I2C, connect the buzzer output pin, and connect Bluetooth serial.
What to do: Follow the wiring list below. The ADXL345 uses the Arduino I2C pins (A4/A5 on Nano). The HC-05 uses SoftwareSerial on D2/D3.
- ADXL345: VCC to 5V, GND to GND, SDA to A4, SCL to A5
- Buzzer signal to D8
- HC-05: VCC to 5V, GND to GND, TX to D2 (Arduino RX), RX to D3 (Arduino TX through divider)
- Power: TP4056 to 18650 to Arduino Vin
Expected result: Your modules are powered correctly, the ADXL345 is on the I2C bus, and the HC-05 is connected for serial messages.
Step 3 - Upload the Arduino sketch
Goal: Program the Nano to detect movement, sound the buzzer, and send a Bluetooth alert.
What to do: Install the required libraries, then upload the sketch below to your Arduino Nano. The code measures a baseline acceleration magnitude at startup and triggers when the reading differs by more than the threshold.
Code:
#include <Wire.h>
#include <Adafruit_ADXL345_U.h>
#include <SoftwareSerial.h>
Adafruit_ADXL345_Unified accel(12345);
SoftwareSerial bt(2,3);
const int BUZZ = 8;
const float THRESHOLD = 1.5; // m/s² of additional shake
float baseline = 0;
void setup() {
bt.begin(9600);
accel.begin();
pinMode(BUZZ, OUTPUT);
sensors_event_t e; accel.getEvent(&e);
baseline = sqrt(e.acceleration.x*e.acceleration.x +
e.acceleration.y*e.acceleration.y +
e.acceleration.z*e.acceleration.z);
}
void loop() {
sensors_event_t e; accel.getEvent(&e);
float mag = sqrt(e.acceleration.x*e.acceleration.x +
e.acceleration.y*e.acceleration.y +
e.acceleration.z*e.acceleration.z);
if (abs(mag - baseline) > THRESHOLD) {
tone(BUZZ, 2000, 500);
bt.println("ALARM! Movement detected.");
delay(2000);
}
delay(50);
}
Expected result: When the bike is moved or shaken, the buzzer sounds briefly and the HC-05 transmits the text alert.
Step 4 - Pair your phone and arm the alarm
Goal: View the Bluetooth alert message on your phone when movement is detected.
What to do: Pair your phone with the HC-05, open your Bluetooth terminal app, connect to the HC-05, and leave it running while the bike is parked.
Expected result: When the alarm triggers, your phone shows: "ALARM! Movement detected."
Step 5 - Optional upgrades and next steps
Goal: Decide how you want to extend the same alarm concept.
What to do: Pick any of the options below and adapt the hardware and code accordingly.
- Swap HC-05 for HM-10 for iPhone compatibility
- Swap HC-05 for ESP32 with Wi-Fi for Telegram alerts from anywhere
- Add GPS (NEO-6M) + LoRa for off-grid theft tracking
- Add a tilt-arming mode and only sound the alarm when the bike is upright
Expected result: You have a clear plan for the next feature to add without changing the core motion detection approach.
Conclusion
You built an Arduino Nano bike theft alarm using an ADXL345 accelerometer to detect movement, a buzzer for a loud local alarm, and an HC-05 module for Bluetooth alerts to your phone.
Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.
Photo credit: Reference photos adapted from Instructables.


