BLE is a wireless technology for a personal area network that is designed and marketed by the Bluetooth Special Interest Group. It is a low power-consuming device which maintains the same communication range as that of Bluetooth classic. It is mainly used in small and low power consumption devices such as a, smartwatch, BLE keychain, true wireless Bluetooth earphones, etc. It is compatible with most of the mobile phones, tablets, and computers.
In this article, we will share how a BLE device works and how it communicates with Android and iOS devices for transferring and receiving information/data. But prior to that, let’s try to understand where BLE technology is used.
- 1. Device Tracking: BLE device is a tiny device that can transmit the data. It consumes very low power and can be used to track the assets and people within a range of 30 meters.
- 2. Machinery Diagnosis using BLE: Machine Diagnostics is possible through BLE. BLE can be integrated into the machines and used to transfer data. All key statistics as well as detailed diagnosis-related data can be retrieved from machines and transmitted to mobile devices/computers for detailed analysis.
- 3. BLE Proximity real-time location: BLE devices are capable of broadcasting radio signals at regular intervals. These signals can be captured by any mobile device (Android, iOS or any other compatible devices). The mobile application can then establish or pinpoint the BLE location.
- 4. Better retail experience: Marketers can enhance the shopping experience by attaching BLE enabled tags to products. When customers are in the vicinity of the store, they would get the latest offers/coupons/discounts for these products on their mobile app.
- 5. Locating people: BLE technology can be effectively used in events where you need to coordinate with different people within a particular facility.
- 6. Home Automation Systems: BLE is used in Home Automation Systems because of its low power consumption and low cost.
- 7. Health monitoring system: BLE is the best choice for health monitoring systems like fitness bands. It collects information from the human and animal body and transfers data to the mobile device using a Bluetooth connection. Since it has a low power consumption feature, it can be easily integrated with small handheld devices for better battery usage.
There are different steps involved for searching BLE peripherals, establishing the connection, writing and reading characteristics. They are as follows:
- 1. Scan nearby BLE peripherals: To get all available nearby BLE peripheral.
manager.startScan( ).then(availableBLEPeripherals =>{
console.log( availableBLEPeripherals );
}).catch(error => {
handleError( error );
})
- 2. Connection and Disconnection:
-
a. To connect the BLE peripheral:
manager.connectBle( peripheral ).then( peripheral => {
console.log( “Connected peripheral :-”, peripheral );
}).catch( error => {
handleError( error );
})
-
b. To disconnect the BLE peripheral:
manager.disconnectBle( peripheral )then( peripheral => {
console.log( “Disconnected peripheral :-”, peripheral );
}).catch( error => {
handleError( error );
})
-
- 3. Start listening for incoming data:
-
a. To get all the incoming data from BLE:
manager.monitorBle( peripheral.id, peripheral.characteristics).then( ( response ) => {
console.log( response );
}).catch( error => {
handleError( error );
})
-
- 4. Write characteristic:
-
a. To fire query to BLE peripheral:
manager.writeData( peripheral.id, peripheral.service, peripheral.characteristics, dataToSend ).then( response => {
console.log( response );
}).catch(error => {
handleError( error );
})
-
MetaSys Software has developed custom mobile solutions for clients who are in different sectors using React Native technology. For more information on our React Native app development projects – https://development.ikf.in/metasys1/react