Bluetooth Basic

Practical - 2
Write a program that identifies the Bluetooth devices in the wireless range.


Download Practical


Bluetooth:
Bluetooth is a standardized protocol for sending and receiving data via a 2.4GHz wireless link. It’s a secure protocol, and it’s perfect for short-range, low-power, low-cost, wireless transmissions between electronic devices.

How Bluetooth Works:
The Bluetooth protocol operates at 2.4GHz in the same unlicensed ISM frequency band where RF protocols like ZigBee and WIFI also exist. There is a standardized set of rules and specifications that differentiate it from other protocols. If you have a few hours to kill and want to learn every nook and cranny of Bluetooth, check out the published specifications, otherwise here’s a quick overview of what makes Bluetooth special.

Masters, Slaves, and Piconets:

Bluetooth networks (commonly referred to as piconets) use a master/slave model to control when and where devices can send data. In this model, a single master device can be connected to up to seven different slave devices. Any slave device in the piconet can only be connected to a single master.

The master coordinates communication throughout the piconet. It can send data to any of its slaves and request data from them as well. Slaves are only allowed to transmit to and receive from their master. They can’t talk to other slaves in the piconet. A graphical representation is shown below.


Bluetooth Addresses and Names:

Every single Bluetooth device has a unique 48-bit address, commonly abbreviated BD_ADDR. This will usually be presented in the form of a 12-digit hexadecimal value. The most-significant half (24 bits) of the address is an organization unique identifier (OUI), which identifies the manufacturer. The lower 24-bits are the more unique part of the address.

This address should be visible on most Bluetooth devices. For example, as shown in below figure, the address printed next to “MAC NO.” is 000666422152:



The “000666” portion of that address is the manufacturer of the module. The “422152” portion of the module is the more unique ID of the device.

Bluetooth devices can also have user-friendly names given to them. These are usually presented to the user, in place of the address, to help identify which device it is.



The rules for device names are less stringent. They can be up to 248 bytes long, and two devices can share the same name. Sometimes the unique digits of the address might be included in the name to help differentiate devices.

Connection Process:

Creating a Bluetooth connection between two devices is a multi-step process involving three progressive states:
  1. Inquiry – If two Bluetooth devices know absolutely nothing about each other, one must run an inquiry to try to discover the other. One device sends out the inquiry request, and any device listening for such a request will respond with its address, and possibly its name and other information.
  2. Paging (Connecting) – Paging is the process of forming a connection between two Bluetooth devices. Before this connection can be initiated, each device needs to know the address of the other (found in the inquiry process).
  3. Connection – After a device has completed the paging process, it enters the connection state. While connected, a device can either be actively participating or it can be put into a low power sleep mode.
    • Active Mode – This is the regular connected mode, where the device is actively transmitting or receiving data.
    • Sniff Mode – This is a power-saving mode, where the device is less active. It’ll sleep and only listen for transmissions at a set interval (e.g. every 100ms).
    • Hold Mode – Hold mode is a temporary, power-saving mode where a device sleeps for a defined period and then returns back to active mode when that interval has passed. The master can command a slave device to hold.
    • Park Mode – Park is the deepest of sleep modes. A master can command a slave to “park”, and that slave will become inactive until the master tells it to wake back up.

Bonding and Pairing:

When two Bluetooth devices share a special affinity for each other, they can be bonded together. Bonded devices automatically establish a connection whenever they’re close enough. When I start up my car, for example, the phone in my pocket immediately connects to the car’s Bluetooth system because they share a bond. No UI interactions are required!

Bonds are created through one-time a process called pairing. When devices pair up, they share their addresses, names, and profiles, and usually store them in memory. The also share a common secret key, which allows them to bond whenever they’re together in the future.

Pairing usually requires an authentication process where a user must validate the connection between devices. The flow of the authentication process varies and usually depends on the interface capabilities of one device or the other. Sometimes pairing is a simple “Just Works” operation, where the click of a button is all it takes to pair (this is common for devices with no UI, like headsets). Other times pairing involves matching 6-digit numeric codes. Older, legacy (v2.0 and earlier), pairing processes involve the entering of a common PIN code on each device. The PIN code can range in length and complexity from four numbers (e.g. “0000” or “1234”) to a 16-character alphanumeric string.


Bluetooth Profiles:

Bluetooth profiles are additional protocols that build upon the basic Bluetooth standard to more clearly define what kind of data a Bluetooth module is transmitting. While Bluetooth specifications define how the technology works, profiles define how it’s used. Some profile names are given below:
·         Serial Port Profile(SPP) – for serial communication.
·         Human Interface Device(HID) – For Bluetooth-enabled user-input devices like mice, keyboards, and joysticks.
·         Advanced audio distribution profile (A2DP) - Defines how audio can be transmitted from one Bluetooth device to another.
·         audio/video remote control profile (AVRCP) -  For remote controlling of a Bluetooth device.

Common Versions:

Bluetooth has been constantly evolving since it was conceived in 1994. The most recent update of Bluetooth, Bluetooth v4.0, is just beginning to gain traction in the consumer electronics industry, but some of the previous versions are still widely used. Here’s a rundown of the commonly encountered Bluetooth versions:

Bluetooth v1.2

The v1.x releases laid the groundwork for the protocols and specifications future versions would build upon. Bluetooth v1.2 was the latest and most stable 1.x version.
These modules are rather limited compared to later versions. They support data rates of up to 1 Mbps (more like 0.7 Mbps in practice) and 10 meter maximum range.

Bluetooth v2.1 + EDR

The 2.x versions of Bluetooth introduced enhanced data rate (EDR), which increased the data rate potential up to 3 Mbps (closer to 2.1 Mbps in practice). Bluetooth v2.1, released in 2007, introduced secure simple pairing (SSP), which overhauled the pairing process.
Bluetooth v2.1 modules are still very common. For low-speed microcontrollers, where 2 Mbps is still fast, v2.1 gives them just about everything they could need.

Bluetooth v3.0 + HS

You have Bluetooth v3.0’s optimum speed – 24 Mbps. That speed can be a little deceiving though, because the data is actually transmitted over a WIFI (802.11) connection. Bluetooth is only used to establish and manage a connection.
Some devices can be “Bluetooth v3.0+HS”, and others might be labelled “Bluetooth v3.0”. Only those devices with the “+HS” suffix are capable of routing data through WIFI and achieving that 24 Mbps speed. “Bluetooth v3.0” devices are still limited to a maximum of 3 Mbps, but they do support other features introduced by the 3.0 standard like better power control and a streaming mode.

Bluetooth v4.0 and Bluetooth Low Energy

Bluetooth 4.0 split the Bluetooth specification into three categories:
·         Classic
·         high-speed
·         low-energy
Classic and high speed call back to Bluetooth versions v2.1+EDR and v3.0+HS respectively. The real standout of Bluetooth v4.0 is Bluetooth low energy (BLE).

BLE is a massive overhaul of the Bluetooth specifications, aimed at very low power applications. It sacrifices range (50m instead of 100m) and data throughput (0.27 Mbps instead of 0.7-2.1 Mbps) for significant savings in power consumption. BLE is aimed at peripheral devices which operate on batteries, and don’t require high data rates, or constant data transmission. Smartwatches are a good example of this application.

Comments

Popular posts from this blog

Study of DB Miner Tool

Study of WEKA tool

Create calculated member using arithmetic operators and member property of dimension member