Thursday, December 26, 2024

Transform Your Home with BLE: Set Up A Smart Notifier System

efy test

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.

- Advertisement -

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.

- Advertisement -
BLE Notifier Setup
Fig 1: Authors’ prototype of the proposed set up
BLE Notifier Block Diagram
Fig. 2: Block diagram

PoC Videos

POC Video in Hindi
PoC Video in English

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
ComponentsQuantity
ESP32 (Mod1)1
9V battery1
BT66 (IC1)1
BC547 (IC2)1
Resistor 1kΩ (R1)1
Smart watch1
Small speaker1
Jumper wires10
Table 2: Major differences between Classic Bluetooth and BLE
SpecificationsClassic BluetoothBluetooth Low Energy (BLE)
Range100mGreater than 100m
Data Rate1-3Mbps1Mbps
Application Throughput0.7-2.1Mbps0.27Mbps
Frequency2.4GHz2.4GHz
Security56/128-bit128-bit AES with counter mode CBC-MAC
RobustnessAdaptive fast frequency hopping, FEC, fast ASK24-bit CRC, 32-bit message integrity check
Latency100ms6ms
Time Lag100ms3ms
Voice CapableYesNo
Network TopologyStarStar
Power Consumption1W0.01 to 0.5W
Peak Current ConsumptionLess than 30mALess 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.

BLE based Personalized Notifier
Fig. 3: Circuit diagram of BLE-based nearby person notifier

Fig. 4 shows the connection diagram of the notifier on a breadboard. It will help in understanding how to connect components on the breadboard.

BLE based Nearby Person Notifier
Fig. 4: Wiring of the BLE based Personalized Notifier

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
ESP32BT66Resistor R1BC547Speaker+5VGNDBT1(-)BT1(+)
GNDPin1
E

GND
GIO15Pin2






5V



+5V



Pin3R1






R1B







C2







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.

BLE based Personalized Notifier Code
Fig. 5: 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

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Truly Innovative Electronics

Electronics News

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics

×