Bluetooth protocol over wifi? - bluetooth

I'm looking to implement the Bluetooth protocol over a physical Wi-Fi based transport, if that makes sense.
Basically my phone has Bluetooth, and my laptop has a Wi-Fi card (802.11a/b/g).
I know that Wi-Fi operates over the range 2.412 GHz - 2.472 GHz, and that Bluetooth operates over the range 2.402 GHz - 2.480 GHz.
I couldn't help but notice the overlap here. So my questions are:
What sort of low-level APIs would I need (preferably in C, on Windows) in order to send a signal out at certain frequencies on the Wi-Fi card?
Would I be able to implement a Bluetooth stack on top of this?
So basically, can I transmit Bluetooth using my Wi-Fi card as essentially a radio transmitter?
Thanks

Implementing the Bluetooth protocol over a physical Wi-Fi based transport does make sense!
Bluetooth high speed (v3.0) defines the possibility to use alternate MAC/PHY layers, known as AMP feature. The L2CAP and higher layer protocols from Bluetooth can be transmitted over a Wi-Fi MAC/PHY layer rather than a Bluetooth MAC/PHY layer with a resulting higher throughput. Some products are on the marked supporting this - look for 'Bluetooth High Speed', AMP or Bluetooth v3.0 support.

No, you can't do this. Bluetooth devices are typically wrapped up all in one chip. Plus, they use completely different modulation techniques. No low-level anything is going to allow you to transmit anything different, unless you are flashing the device. Even then, it may not get you much closer.
Bluetooth Modulation Information:
http://www.palowireless.com/infotooth/tutorial/radio.asp and http://classes.engr.oregonstate.edu/eecs/spring2003/ece44x/groups/g9/jon_gillen/white_paper_jon.pdf
About the only thing you can share between WiFi and Bluetooth devices is the antenna. (Assuming only one device is using it at a time... don't blast 32mW into the receiver of the other radio!) The radio itself is all wrapped up into the same chip. The same is generally true for WiFi.

Bluetooth and Wifi have different phy layer protocols and thats what is coded into their chips, hence you can't use one chip to transmit packets of the other protocol.
Moreover most of the chip vendors, do not expose any RF logic.

Technically yes but there are some things to consider such as the pre existing coding on the chip and if the chip can support Bluetooth coding as well as wifi coding, I mean if you have two separate wifi chips go ahead and try but be warned I tried and nearly killed my computer because of preexisting copyright protection coding on other parts of my pc that prevented any programs on the chip from starting until I reset the chip to factory defalts.

Related

What is the difference between Bluetooth 3.0 and BLE?

i want to know the fundamental difference between BLE and Classic Bluetooth and why exactly is BLE low power?
There are quite a few differences between Bluetooth Classic and Bluetooth Low Energy including:
Classic Bluetooth operates on 79 frequency channels, whereas BLE uses only 40.
Classic Bluetooth has a higher throughput than BLE, although the gap is becoming narrower with newer versions of BLE.
A classic Bluetooth device can only be connected to 7 other devices, there is no theoretical maximum to BLE.
The two use different mechanisms for broadcasting/connection. Classic only devices cannot find or connect to BLE only devices and vice versa.
The list goes on beyond the above to the point that it is more common to assume that they are two protocols only sharing a few technical similarities and the same standardisation body (The Bluetooth SIG).
As to what makes BLE low power, this lies in the duty cycle of the protocol. BLE devices sleep for most of the time they are not in operation, and only wake up to send bursts of data and then go back to sleep. Of course this depends on the use case; if an application continuously sends BLE data then there will be fewer sleep intervals and therefore the power consumption will match that of classic Bluetooth.
For more references regarding this question, please see the list below:
4 Key Differences between Classic Bluetooth and BLE
The difference between Classic Bluetooth and BLE
Bluetooth vs Bluetooth Low Energy (BLE)
Bluetooth vs BLE
Can a Bluetooth LE powered device discover a classic Bluetooth device and vice-versa?
I hope this helps.

Location of Bluetooth Profile in Bluetooth System

My question is very basic.I need to know where does all Bluetooth profile such HID, HFP or HSP loaded in Bluetooth stack? Is it in Host layer or in Bluetooth Hardware Chipset such as USB dongle/module or in both Host and Chipset Side?
According to my understanding, we can implement Bluetooth profiles on Host side using packages like BlueZ but at same time Bluetooth chipset which is connected to Host should need some sort of firmware and logic(like CSVD, A-law ) inside its chipset.
A quote found in BlueZ Android package doc: "Wideband Speech support in HFP it is required that BT chip assumes mSBC codec". This means Host layer can implement that Profile only if BT chipset provides the low-level support like mSBC.
My Answer is like this: " We can build any Bluetooth Profile say 'X' on Host layer if BT chipset is equipped with underlining Low-level firmware which support the Profile 'X'".Please agree or disagree with my understanding.
PFA diagram of my understanding
Position of profile and its low-level firmware
I need to select a USB Bluetooth dongle compatible to Raspberry Pi and customize the HID and HFP using BlueZ.
Advance Thanks to all Bright minds!
There are multiple ways how Bluetooth functionality is implemented in a system based on how much is implemented in the controller and host.
Everything in the controller - App, Upper stack, may or may not HCI(lower and upper stacks communicate through HCI commands and events), Lower stack. Example: Most of Bluetooth Mouse, Keyboard etc, where a single controller is responsible for everything (Bluetooth, RTOS/scheduler, Controlling LED's in the device, etc)
App in Host and lower and upper part of stack in controller. May or may not implement HCI in controller.
Example: Where we use a dedicated Bluetooth chip and integrate it with the Device. Here device will transmit application data to the Dedicated Bluetooth chip. All the Bluetooth protocol related things will be done from BT controller/chip. If you are using an HC-05 module with Arduino module, Arduino will transfer the serial data to the HC-05 module.
App and upper stack in host and lower stack in the controller. Bluez, Bluedroid and all other stacks in Operating systems are of this type. This will communicate with the controller with HCI commands and events.
Example: Mobile phones, Computers, TV with Bluetooth etc (Devices having a powerful Application processor)
So lets assume you are asking about the 3rd type. In this case your assumption is correct. Here all profiles are implemented in the host only. But protocols/codec needed to support them will be implemented in the controller(either firmware or hardware block). For example GAP(For BR-EDR) is implemented in the host but encryption and decryption algorithms are implemented in the controller as Firmware or hardware blocks. For A2DP profiles audio codec/decoders will be implemented in the controller. BT chip then transfers this audio data to host with I2S or other protocols. For BLE Security manager profile, encryption/decryption algorithm is implemented in the host itself, But whitelist, auto connection etc, will be implemented in the controller.
My Answer is like this: " We can build any Bluetooth Profile say 'X' on Host layer if BT chipset is equipped with underlining Low-level firmware which supports the Profile 'X'".Please agree or disagree with my understanding.
For BlueZ use case this is correct. You need to use the controller with the required hardware capabilities(Firmware + hardware resources).
For the scenarios 1 and 2 the profiles and supporting protocols will be implemented in the controller.

Emulate a Bluetooth Device from PC

I wonder whether it is possible to emulate a specific bluetooth device like a Remote Controller for a TV or another device with my PC. I'd be okay with installing an additional hardware device for my computer (e. g. a BlueTooth PCIe card).
I imagined something like "recording" all single commands of my original remote controller using my Bluetooth card and afterwards use these recorded commands to turn on my TV for example.
Is something like this possible (with additional hardware maybe)?
Of course this is possible. Bluetooth is just a protocol and you can impliment it in your custom software to emulate all kinds of devices. If you need to emulate simple devices like keyboard or mouse, there are many ready solutions like this.
But if you have non standard device, there won't be any ready solutions and you will have to implement it yourself. What can help you:
If you have some kind of controller for PC and you want to emulate device with unknown protocol, you can use WireShark or other sniffer to understand what's going on.
There is an emulator called BT-Sim, but it is so poorly documented that I can't even guess what it does.
You can can take as example different android software like described in answers to this question.
You can check different program samples for PC like this.
For hardware you need only simple Bluetooth dongle. However, if you want to spy on some BLE (Bluetooth Low Energy) devices, you can buy hardware sniffer like this.
(At least in Windows 10) Microsoft Store has an application called "Bluetooth LE Explorer" which is able to simulate different kind of Bluetooth GATT profiles as a peripheral.

Implement SDIO to interface SPI device

People,
I have always seen references about how to use a SPI interface to operate a SD memory card.
This is not what I want. I need to do exactly the opposite.
I want to be able to use the SDIO controller (through SD slot) in my "host" (any PC having a SD-card interface) to talk to my devices (basically microcontrollers) that can only "speak" SPI.
If my understanding is not too wrong, I cannot simply tell my SD controller to talk in a raw SPI mode but I can teach my microcontrollers to behave as a SDIO device that can be controlled by my host.
This way I still have two challenges left:
Correctly implement a generic SDIO device in my microcontroller.
Implement/configure the correct drivers in the host to be able to interact with my devices.
Implement the SDIO device seems to be a matter of following the spec.
The host-side driver, though, is something I hope I can accomplish with a user-space driver in Linux using some already existing kernel-space driver to SDIO.
That's the point that I come to ask for help.
Can anyone please point me any samples, documents or any kind of resources that can help me in my task?
On the PC side, this is all you need: http://sourceforge.net/projects/sdio-linux/
This may be useful for reference: http://www.varsanofiev.com/inside/WritingLinuxSDIODrivers.htm (although, I don't think you would be writing a driver)
On the microcontroller side, use "bit-banging" to implement the SDIO spec.
However, first consider why do this. SDIO and SPI are just serial protocols, so is USB; wouldn't you rather make an SPI-to-USB bridge? USB is much more user-friendly on the host side, as well as being more standard/more common. And if you do want a SPI-to-USB bridge, turns out it already exists, the SPI Shortcut (probably other options, this is just the first one that comes to mind)
EDIT Or, you could bit-bang I2C on the micro, if the host supports I2C (many do). Actually, go through every serial protocol the host supports, and see if you can support it easily from the micro side (by bit banging, since the micro is likely to not have a slave mode for that protocol built-in). RS232 (with level shifter), I2C, and SPI are likely to be the preferred choices. SDIO is pretty much the last choice, I think.
SDIO is very tightly specified. Unless your microcontroller has an SDIO block that is designed to act as a device rather than host, I don't think this will be possible. I know of a few special purpose communications controllers that implement an SDIO device, but I haven't come across any general purpose microcontrollers.
You would need a fairly fast microcontroller to be able to bit-bang SDIO initialization at up to 400 kHz. If running an STM32F4 at 180 MHz, this gives you only microcontroller cycles between SDIO clock cycles. If the host turns up the clock speed to the maximum of 25 MHz after initialization, then you're down to 7 cycles between SDIO clocks.
For perspective on the SDIO spec, the one you linked is a simplified spec that doesn't cover the signalling and timing of the bus. The full spec is many times larger.
As Alex I mentioned, there may be better alternatives for what you need. If your SDIO host supports SPI mode, most microcontrollers do have SPI peripherals that can act as slaves rather than hosts, so this may be an avenue without a peripheral. If your data rates are low enough, a simple UART may suffice (you can reasonably hit 1 Mbit over short distances).

Bluetooth UUID discovery

Does anyone know how a bluetooth device could pick up the discoverable devices' device IDs in range?
I am ideally looking for the simplest solution that involves the smallest implimentation of the bluetooth protocols.
A starting point would be good, I just wish to create a device that can store all the device ids of nearby bluetooth devices with minimal power consumption, preferably just using radio frequencies and not SDP and whatever else.
If you can't help me with this, please can you help me find good reading material for low level bluetooth (step by step) communication. The reading online is so high level that I cant work out what is actually sent, when.
Laalto nailed the answer from the Bluetooth spec/stack POV, but your question implies your looking for a stand-alone Bluetooth device - not just a laptop app scanning surrounding devices.
I can only speak for the BT chips that the company I work for manufactures (Cambridge Silicon Radio - CSR) but our chips can do that pretty much out of the box. Our chips have an on-board Virtual Machine sandbox that allows access to the firmware functions and Bluetooth stack of the chip. You can easily write a C code app to run in the virtual machine sandbox, on chip, that periodically scans for discoverable devices around, grab their ids and then download them when connected via USB or Serial, or maybe over BT when a device connects to the listener directly.
www.csr.com and www.csrsupport.com for chips, dev-kits, design references, etc.. etc...
You probably want a module with the extra HW (UARTs, USB etc...) as well as just the chip but you could implement this with something the size of a BlueTooth USB or probably smaller.
It would really help to know more about what your trying to achieve, why you want something that just scans the surrounding bluetooth devices and how big the device needs to be.
Sorry if this sounds like advertising. For balance: Broadcom make BT chips too!
The Bluetooth specs from http://www.bluetooth.org are a good starting place for low-level information. You need an account to access the specs, but you can create one for free.
Basically what you need to do is to go into Inquiry mode periodically and grab the response packets as they arrive. The more time you spend in Inquiry mode, the more likely you will discover devices in range: discoverable devices enter the Inquiry Scan mode only relatively rarely; it takes some time (10.24s at least with older Bluetooth versions) to scan all the possible frequencies in the Inquiry/Inquiry Scan frequency hopping schemes. And even then you can have suboptimal radio conditions.
For implementation I suggest you at least start with existing Bluetooth libraries such as BlueZ and do not attempt to create your own from scratch.

Resources