Ever thought about your home anticipating your arrival and responding accordingly? With our Bluetooth Low Energy (BLE) notifier setup, you can bring this futuristic idea to life. Whether it’s for security, convenience, or just a bit of fun, this setup has countless applications.
Imagine your garage door opening automatically or your lights turning on just as you approach your home.
Here, a Bluetooth-based smartwatch is used, and the notifier scans BLE devices. After scanning, it notifies when a particular MAC (media access control) address of the smartwatch comes within the notifier’s range.
Bluetooth is ubiquitous today, and various devices and applications on smartphones, smartwatches, tablets, laptops, and iPads opt for this technical advancement. Bluetooth low energy (BLE) is a prevailing technology, and unlike its cousin – the classic Bluetooth technology, it has equally diverse applications. The proposed setup uses BLE to identify the person using the smartphone MAC address and announces their arrival in the setup.
Fig. 1 shows the prototype of the experimental setup and demonstrates the use of BLE. Fig. 2 is the block diagram representation of the entire setup.
PoC Videos
BLE operates with the lowest possible power consumption, is low-cost, low-bandwidth, and simple to use. Such a radio standard was originally initiated by Nokia as Wibree. These design goals eventually led to Bluetooth 4.0 (BLE), a genuine low-power standard that can run for an extended period on a small coin-size cell battery. Bluetooth devices with any specification version prior to 4.0 cannot communicate in any way with a BLE device.
Also Read: Untangling The Wires by Bluetooth Low Energy (BLE)
The on-air protocol, the upper protocol layers, and the applications are incompatible between these two technologies. Just like Bluetooth, BLE operates in the 2.4GHz ISM band. Unlike classic Bluetooth, however, BLE remains in sleep mode constantly except when a connection is initiated. The actual connection times are only a few milliseconds (ms), unlike Bluetooth, which would take ~100ms.
Table 1 represents the Bill of Materials. Table 2 highlights the major differences between classic Bluetooth and BLE technologies.
Table 1: Bill of Materials | |
Components | Quantity |
ESP32 (Mod1) | 1 |
9V battery | 1 |
BT66 (IC1) | 1 |
BC547 (IC2) | 1 |
Resistor 1kΩ (R1) | 1 |
Smart watch | 1 |
Small speaker | 1 |
Jumper wires | 10 |
Table 2: Major differences between Classic Bluetooth and BLE | ||
Specifications | Classic Bluetooth | Bluetooth Low Energy (BLE) |
Range | 100m | Greater than 100m |
Data Rate | 1-3Mbps | 1Mbps |
Application Throughput | 0.7-2.1Mbps | 0.27Mbps |
Frequency | 2.4GHz | 2.4GHz |
Security | 56/128-bit | 128-bit AES with counter mode CBC-MAC |
Robustness | Adaptive fast frequency hopping, FEC, fast ASK | 24-bit CRC, 32-bit message integrity check |
Latency | 100ms | 6ms |
Time Lag | 100ms | 3ms |
Voice Capable | Yes | No |
Network Topology | Star | Star |
Power Consumption | 1W | 0.01 to 0.5W |
Peak Current Consumption | Less than 30mA | Less than 15mA |
BLE can communicate with other devices in two ways: broadcasting or connections.
The broadcasting method by MAC address is used here. As per the guidelines established by the generic access profile (GAP), broadcast communication involves a BLE device (called a broadcaster) sending packets to any scanning device within its communication range. Any Bluetooth-compatible device (called the observer) can easily pick up the data broadcasted by the BLE device. This communication is unidirectional.
Broadcasting takes advantage of the advertising features of BLE to send a small packet (typically 47 bytes with 31 bytes customisable payload) using frequency hopping technique. BLE operates in the licence-free 2.4GHz ISM band, divided into 40 communication channels, having a bandwidth of 2MHz each. These 40 channels include 3 advertising channels and 37 connection channels.
A MAC address is a 12-digit hexadecimal number assigned to each device connected to the network. Primarily specified as a unique identifier during device manufacturing, the MAC address is often found on a device’s network interface card (NIC).
A MAC address is represented by 12 hexadecimal digits (0-9 and A-F) separated by colons or dashes. For instance, 01:0A:95:9D:67:16 or 01-0A-95-9D-67-16. Each hexadecimal digit represents four bits; thus, every pair of digits signifies one byte or octet. The initial six digits in a MAC address indicate the NIC manufacturers, known as organisationally unique identifier (OUI), while the remaining six digits are assigned by the manufacturer to identify the NIC.
To obtain the MAC address of your smartwatch, on the home screen of your watch, press the down button and go to Settings. The device name is your watch’s Bluetooth name. The 12 alphanumeric characters under MAC are your smartwatch’s MAC address.
Once the relevant MAC address is obtained, a code can be built to scan all neighbouring BLE-enabled devices within the range and identify specific ones. In the proposed setup, on detecting the desired MAC address, a musical tone is activated using a transistor (BC547) and a speaker assembly.
To ensure that the speaker does not play the tone continuously, its duration is limited to 5 seconds. Further, even if the identified MAC address remains within the range of detection, the same will continue to be detected by the code, but it will not activate the speaker in any way. As a precautionary measure to avoid detection, an additional (buffer) timer of 3,600,000 ms=an hour is set up to wind up everything before the tone starts playing again.
BLE based Personalized Notifier – Circuit and Working
Fig. 3 shows the circuit diagram of the BLE-based nearby person notifier. It is built around the ESP32 board (MOD1), smartwatch, BT66 (IC1), NPN transistor BC547 (IC2), a small speaker, and a few other components.
Fig. 4 shows the connection diagram of the notifier on a breadboard. It will help in understanding how to connect components on the breadboard.
Table 3 shows connections among ES32 pins, BT66, BC547, speaker, 9V battery (BT1), and the resistor.
Table 3: Connection among ES32 pin, BT66, BC547, speaker, BT1 and resistor | ||||||||
ESP32 | BT66 | Resistor R1 | BC547 | Speaker | +5V | GND | BT1(-) | BT1(+) |
GND | Pin1 | E | GND | – | ||||
GIO15 | Pin2 | |||||||
5V | +5V | |||||||
Pin3 | R1 | |||||||
R1 | B | |||||||
C | 2 | |||||||
1(+) | + |
BLE is widely considered for wireless indoor localisation systems (ILS) in which BLE-received signal strength (RSS) is most often used to derive the location of the target. The setup was tested in building premises with multiple adjacent rooms, separated by walls, windows, and doors. It worked successfully up to 15-18 metres, including opaque separations in a non-line of sight (NLOS) condition.
On a conclusive note, BLE detects individual persons, provided the MAC address on the respective smartwatch can be identified. To ensure gender equality, the code was tested with the father’s smartwatch also. And it worked!
In the code, configure the MAC address with the MAC address of your smartwatch, then select the board as ESP32 and upload the code to the ESP32 board. Fig. 5 shows the snippet of the source code.
Construction and Testing
After uploading the source code, assemble the ESP32 board on a breadboard along with other components as shown in Fig. 3. Now power the device and keep it in the home. Next, go out wearing your smartwatch, and when you come near the home, the device will be able to sense it. It starts notifying using the speaker.
The same device can be changed with a relay to automatically turn on the lights, AC, and door, when you come home. It can also be modified as a security system. When you are at home, the device turns on; otherwise, it automatically locks the home. Overall, the notifier can be modified for many use cases according to your creativity.
Dr Geetali Saha is a faculty member of the Department of Electronics and Communication Engineering, GCET, Anand, Gujarat. Maulik Patel from the final year IT Engineering department has executed this notifier