in regards to bluetooth, what is the inquiry procedure?
Contributors: jimblom
What is Bluetooth?
Bluetooth is a standardized protocol for sending and receiving information via a two.4GHz wireless link. It's a secure protocol, and it's perfect for brusque-range, depression-power, depression-cost, wireless transmissions betwixt electronic devices.
These days information technology feels like everything is wireless, and Bluetooth is a big part of that wireless revolution. You'll observe Bluetooth embedded into a cracking variety of consumer products, similar headsets, video gamecontrollers, or (of course) livestock trackers.
In our world of embedded electronics hackery, Bluetooth serves as an excellent protocol for wirelessly transmitting relatively small-scale amounts of information over a short range (<100m). It'due south perfectly suited as a wireless replacement for serial communication interfaces. Or y'all can use it to create a DIY HID Computer Keyboard. Or, with the right module, it tin be used to build a homebrew, wireless MP3-playing speaker.
This tutorial aims to provide a quick overview of the Bluetooth protocol. We'll examine the specifications and profiles that form its foundation, and we'll get over how Bluetooth compares to other wireless protocols.
Looking to get hands-on with Bluetooth development?
We've got you covered!
SparkFun Bluetooth Mate Silver
WRL-12576
The Bluetooth Mate is very similar to our BlueSMiRF modem, but information technology is designed specifically to be used with our [Arduino Pros]…
Retired
Suggested Reading
- Serial Communication -- Bluetooth is similar a RF version of serial communication.
- Hexadecimal -- Bluetooth devices all take a unique address, which is usually presented equally a hexadecimal value.
Suggested Viewing
How Bluetooth Works
The Bluetooth protocol operates at ii.4GHz in the aforementioned unlicensed ISM frequency band where RF protocols like ZigBee and WiFi likewise be. There is a standardized gear up of rules and specifications that differentiates it from other protocols. If you take a few hours to kill and want to learn every nook and cranny of Bluetooth, cheque 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) utilise a master/slave model to command 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 unmarried master.
Examples of Bluetooth master/slave piconet topologies.
The principal coordinates communication throughout the piconet. It can send data to any of its slaves and asking information 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.
Bluetooth Addresses and Names
Every single Bluetooth device has a unique 48-bit address, normally abbreviated BD_ADDR. This will usually be presented in the grade of a 12-digit hexadecimal value. The most-significant half (24 bits) of the accost is an organization unique identifier (OUI), which identifies the manufacturer. The lower 24-bits are the more unique part of the accost.
This address should exist visible on near Bluetooth devices. For instance, on this RN-42 Bluetooth Module, the address printed adjacent to "MAC NO." is 000666422152:
The "000666" portion of that accost is the OUI of Roving Networks, the manufacturer of the module. Every RN module will share those upper 24-bits. The "422152" portion of the module is the more unique ID of the device.
Bluetooth devices tin can also have user-friendly names given to them. These are usually presented to the user, in place of the address, to assistance identify which device information technology is.
The rules for device names are less stringent. They can be up to 248 bytes long, and 2 devices tin can share the same name. Sometimes the unique digits of the address might be included in the proper name to help differentiate devices.
Connexion Process
Creating a Bluetooth connection between 2 devices is a multi-step process involving three progressive states:
- 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 enquiry request, and any device listening for such a request will respond with its address, and perchance its name and other information.
- Paging (Connecting) -- Paging is the process of forming a connectedness between two Bluetooth devices. Before this connectedness tin be initiated, each device needs to know the address of the other (institute in the inquiry process).
- Connection -- After a device has completed the paging process, it enters the connexion country. While connected, a device can either exist actively participating or it tin can be put into a low power slumber mode.
- Active Manner -- This is the regular connected mode, where the device is actively transmitting or receiving data.
- Sniff Style -- This is a power-saving mode, where the device is less active. It'll slumber and only listen for transmissions at a gear up interval (e.one thousand. every 100ms).
- Concord Mode -- Hold mode is a temporary, power-saving mode where a device sleeps for a defined menstruum and so 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 upwards.
Bonding and Pairing
When ii Bluetooth devices share a special affinity for each other, they tin can be bonded together. Bonded devices automatically found a connection whenever they're close enough. When I kickoff up my car, for instance, 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 old a procedure called pairing. When devices pair up, they share their addresses, names, and profiles, and unremarkably store them in retentivity. The besides share a common secret key, which allows them to bond whenever they're together in the time to come.
Pairing commonly requires an authentication procedure where a user must validate the connectedness between devices. The period of the authentication process varies and usually depends on the interface capabilities of 1 device or the other. Sometimes pairing is a elementary "But 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 lawmaking on each device. The Pivot lawmaking can range in length and complexity from iv numbers (e.chiliad. "0000" or "1234") to a 16-grapheme alphanumeric cord.
Power Classes
The transmit power, and therefore range, of a Bluetooth module is defined by its power class. There are three defined classes of power:
Class Number | Max Output Power (dBm) | Max Output Ability (mW) | Max Range |
---|---|---|---|
Class 1 | 20 dBm | 100 mW | 100 m |
Class 2 | 4 dBm | 2.five mW | x yard |
Form 3 | 0 dBm | ane mW | 10 cm |
Some modules are simply able to operate in one power class, while others can vary their transmit ability.
Bluetooth Profiles
Bluetooth profiles are additional protocols that build upon the basic Bluetooth standard to more clearly ascertain what kind of data a Bluetooth module is transmitting. While Bluetooth specifications define how the technology works, profiles define how it's used.
The profile(due south) a Bluetooth device supports make up one's mind(south) what application it's geared towards. A easily-free Bluetooth headset, for example, would use headset profile (HSP), while a Nintendo Wii Controller would implement the human being interface device (HID) profile. For two Bluetooth devices to be compatible, they must back up the same profiles.
Let's take a await at a few of the more commonly-encountered Bluetooth profiles.
Series Port Contour (SPP)
If you're replacing a serial communication interface (like RS-232 or a UART) with Bluetooth, SPP is the contour for yous. SPP is great for sending bursts of information between two devices. It's is one of the more fundamental Bluetooth profiles (Bluetooth's original purpose was to replace RS-232 cables after all).
Using SPP, each connected device can transport and receive data just as if there were RX and TX lines connected between them. Two Arduinos, for case, could converse with each other from across rooms, instead of from across the desk-bound.
Human Interface Device (HID)
HID is the go-to profile for Bluetooth-enabled user-input devices similar mice, keyboards, and joysticks. It's as well used for a lot of modernistic video game controllers, like WiiMotes or PS3 controllers.
Instance HID interface, from RN-42-HID User's Guide.
Bluetooth'south HID profile is actually a riff on the HID profile already defined for human input USB devices. Only every bit SPP serves as a replacement for RS-232 cables, HID aims to supercede USB cables (a much taller task!).
Hands-Free Profile (HFP) and Headset Contour (HSP)
Those Bluetooth earpieces that makes important business guys await like cocky-conversing wackos? Those usually employ headset profile (HSP) or easily-complimentary profile (HFP).
HFP is used in the hands-free audio systems congenital into cars. It implements a few features on summit of those in HSP to allow for mutual phone interactions (accepting/rejecting calls, hanging up, etc.) to occur while the phone remains in your pocket.
Advanced Audio Distribution Profile (A2DP)
Advanced audio distribution profile (A2DP) defines how sound tin can exist transmitted from one Bluetooth device to another. Where HFP and HSP send audio to and from both devices, A2DP is a one-way street, but the audio quality has the potential to exist much college. A2DP is well-suited to wireless audio transmissions between an MP3 actor and a Bluetooth-enabled stereo.
A2DP instance configurations. Prototype from A2DP specification (v1.3).
Most A2DP modules support a limited prepare of audio codecs. In the least they'll suport SBC (subband codec), they may also support MPEG-1, MPEG-2, AAC, and ATRAC.
A/V Remote Control Profile (AVRCP)
The audio/video remote control profile (AVRCP) allows for remote controlling of a Bluetooth device. Information technology's usually implemented alongside A2DP to let the remote speaker to tell the audio-sending device to fast-forward, rewind, etc.
Remote control and audio stream between two devices. Image from AVRCP specification (v1.v).
Common Versions
Bluetooth has been constantly evolving since it was conceived in 1994. The most recent update of Bluetooth, Bluetooth v4.0, is just get-go to gain traction in the consumer electronics industry, but some of the previous versions are nevertheless widely used. Here's a rundown of the usually encountered Bluetooth versions:
Bluetooth v1.2
The v1.x releases laid the background 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 express compared to later versions. They support data rates of up to 1 Mbps (more like 0.seven Mbps in practice) and 10 meter maximum range.
Bluetooth v2.ane + EDR
The 2.x versions of Bluetooth introduced enhanced data rate (EDR), which increased the data rate potential upwardly to three Mbps (closer to 2.ane Mbps in practice). Bluetooth v2.1, released in 2007, introduced secure simple pairing (SSP), which overhauled the pairing procedure.
Bluetooth v2.i modules are still very common. For low-speed microcontrollers, where two Mbps is even so fast, v2.1 gives them just about everything they could demand. The RN-42 Bluetooth module, for case, remains pop in products similar the Bluetooth Mate and BlueSMiRF HID.
Bluetooth v3.0 + HS
You thought 3 Mbps was fast? Multiply that by eight and you take Bluetooth v3.0'due south optimum speed -- 24 Mbps. That speed can exist a little deceiving though, because the data is actually transmitted over a WiFi (802.eleven) connection. Bluetooth is simply used to plant and manage a connection.
It can be tricky to nail down the maximum data rate of a v3.0 device. Some devices can be "Bluetooth v3.0+HS", and others might be labeled "Bluetooth v3.0". Merely those devices with the "+HS" suffix are capable of routing data through WiFi and achieving that 24 Mbps speed. "Bluetooth v3.0" devices are yet limited to a maximum of 3 Mbps, only they do support other features introduced by the three.0 standard like ameliorate ability control and a streaming way.
Bluetooth v4.0 and Bluetooth Low Free energy
Bluetooth 4.0 split the Bluetooth specification into 3 categories: classic, high-speed, and depression-energy. Archetype and loftier 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 information throughput (0.27 Mbps instead of 0.7-ii.one Mbps) for a significant savings in power consumption. BLE is aimed at peripheral devices which operate on batteries, and don't require high information rates, or constant data transmission. Smartwatches, like the MetaWatch, are a good example of this application.
Wireless Comparing
Bluetooth is far from the only wireless protocol out there. You might be reading this tutorial over a WiFi network. Or maybe you've even played with ZigBees or XBees. And so what makes Bluetooth different from the rest of the wireless data transmission protocols out at that place?
Let's compare and dissimilarity. We'll include BLE every bit a split entity from Classic Bluetooth.
Name | Bluetooth Classic | Bluetooth 4.0 Low Energy (BLE) | ZigBee | WiFi |
---|---|---|---|---|
IEEE Standard | 802.fifteen.ane | 802.15.1 | 802.fifteen.4 | 802.11 (a, b, g, n) |
Frequency (GHz) | 2.4 | 2.4 | 0.868, 0.915, 2.4 | 2.4 and 5 |
Maximum raw scrap rate (Mbps) | i-3 | 1 | 0.250 | 11 (b), 54 (g), 600 (n) |
Typical data throughput (Mbps) | 0.vii-2.1 | 0.27 | 0.2 | seven (b), 25 (m), 150 (northward) |
Maximum (Outdoor) Range (Meters) | x (class 2), 100 (class 1) | 50 | 10-100 | 100-250 |
Relative Power Consumption | Medium | Very depression | Very low | High |
Instance Battery Life | Days | Months to years | Months to years | Hours |
Network Size | 7 | Undefined | 64,000+ | 255 |
Bluetooth isn't the all-time choice for every wireless job out at that place, but it does excel at short-range cable-replacement-type applications. It as well boasts a typically more convenient connection process than its competitors (ZigBee specifically).
ZigBee is often a good choice for monitoring networks -- like home automation projects. These networks might have dozens of wireless nodes, which are only sparsely active and never take to send a lot of data.
BLE combines the convenience of classic Bluetooth, and adds significantly lower power consumption. In this manner it can compete with Zigbee for battery life. BLE can't compete with ZigBee in terms of network size, merely for unmarried device-to-device connectivity it'southward very comparable.
WiFi is probably the almost familiar of these four wireless protocols. Nosotros're all pretty familiar with what purpose it's best for: Net(!). It's fast and flexbile, only besides requires a lot of power. For broadband Cyberspace access it blows the other protocols out of the water.
Resources and Going Farther
Now that you're familiar with the concepts behind Bluetooth, consider checking some of these related tutorials out:
- RN-52 Hookup Guide -- The RN-52 is a Bluetooth audio module, which supports all sorts of nifty profiles we talked about in this tutorial: HSP/HFP, A2DP, AVRCP, and SPP. Bank check out this module if you want to add together wireless audio to your project.
- BlueSMiRF Hookup Guide -- The BlueSMiRF, using the RN-42 Bluetooth module, is simple-to-utilize and supports the SPP profile. If you want to supplant a serial cablevision, check this module out.
- MetaWatch Teardown and Hookup Guide -- The MetaWatch is a "smartwatch", and information technology uses Bluetooth to communicate with and receive notifications from a smart phone. Look at the guts of this lookout to see where the Bluetooth module fits in. Or follow along to control the watch from a Bluetooth module continued to an Arduino.
Or, if you're sick of Bluetooth, but still interested in doing something wireless:
- ATmega128RFA1 Dev Board Hookup Guide -- The ATmega128RFA1 sports an RF module which operates on the same standards as ZigBee (802.eleven.4). If yous want to dig downwards into the nitty, gritty area of RF communication, check out this board.
- Electrical Imp Hookup Guide -- The Electric Imp makes connecting to WiFi incredibly easy. Follow forth with this tutorial, and you'll have an embedded module able to collaborate with web pages!
Here are some more neat reads, if you want to learn more about Bluetooth:
* Bluetooth.org Specifications -- Thousands of pages covering the specifications of every Bluetooth version and contour known to mankind. * Althos Bluetooth Tutorial -- This is a well done beginner tutorial presented in slide form.
Or check out some of these weblog posts for ideas:
chesneytistonedide47.blogspot.com
Source: https://learn.sparkfun.com/tutorials/bluetooth-basics/all
0 Response to "in regards to bluetooth, what is the inquiry procedure?"
Post a Comment