4.3.19. Bluetooth Wireless Proximity Alarm System
| Description In Project 139, learners will build an expert wireless and automation system titled 'Bluetooth Wireless Proximity Alarm System'. This manual details the synthesis of HC-05 Bluetooth + HC-SR04 Ultrasonic + Active Buzzer + Traffic Light Module into an industrial IoT automation solution.|------------------|----------------------------------------------------------------| | Use case |This project connects to real-world industrial and IoT applications such as: Project 139 provides master-level competency in wireless communication, industrial IoT architecture, and automated system integration.|
Components (Things You will need)
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|---|---|---|---|---|
Building the circuit
Things Needed:
- Arduino Uno Core Board = 1
- HC-05 Bluetooth = 1
- HC-SR04 Ultrasonic = 1
- Active Buzzer = 1
- USB Cable & Jumper Wires = 1
- Bread Board
- Relay Module
- Real Time Clock
- RFID Reader
Mounting the component on the breadboard and wiring the circuit
Step 1: Inventory all modules listed in the Required Components table.
Step 2: Connect line [Wireless / RTC / RFID Bus] to [UART / SPI / I2C Pins] — (Primary telemetry and security bus.).
Step 3: Connect line [Control & Actuator Lines] to [Digital / PWM Pins] — (Relay, motor, and display driver bus.).
Step 4: Connect line [Power Rails] to [5V / 3.3V / GND] — (System power and ground rails.).
Step 5: Double-check all VCC, 5V, 3.3V, and GND polarities to prevent electrical shorts.
Step 6: Connect USB programming cable only after verifying all signal path wiring.

Make sure to connect the Arduino USB cable to the Arduino board.
PROGRAMMING
Step 1: Open your Arduino IDE. See how to set up here: Getting Started.
Step 2: Write the complete program implementing the system logic with appropriate pin definitions, setup configuration, and the main control loop.
#include <SoftwareSerial.h>
SoftwareSerial bt(2, 3); // RX, TX
const int trigPin = 11;
const int echoPin = 12;
const int buzzerPin = 8;
bool alarmActive = false;
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzerPin, OUTPUT);
bt.begin(9600);
}
void loop() {
// Bluetooth control: '1' to activate, '0' to deactivate
if (bt.available()) {
char cmd = bt.read();
if (cmd == '1') alarmActive = true;
if (cmd == '0') { alarmActive = false; digitalWrite(buzzerPin, LOW); }
}
if (alarmActive) {
// Measure distance
digitalWrite(trigPin, LOW); delayMicroseconds(2);
digitalWrite(trigPin, HIGH); delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
// Trigger alarm if object is within 20cm
if (distance > 0 && distance < 20) {
digitalWrite(buzzerPin, HIGH);
} else {
digitalWrite(buzzerPin, LOW);
}
}
delay(100);
}
Step 7: Save your code. See the Getting Started section
Step 8: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.
Step 9: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code
CONCLUSION
The system processes telemetry signals and security credentials in real time, driving relays, motors, and displays reliably.









