Understanding RSSI inacurracy on RaspberryPi - bluetooth

I'm experimenting with iBeacon tracking on a RaspberryPi and have a problem with the accuracy of the retrieved RSSI. I use the following hardware:
- RaspberryPi (newest version)
- IOGear Bluetooth 4.0 USB Micro Adapter
- BEACONinside Beacon (Model: B0001-A)
I tested iBeacon advertisment scanning using the official BEACONinside Android app and the retrieved RSSI is intuitively very accurate. Then I tested advertisment scanning using aforementioned hardware on a RaspberryPi and the retrieved RSSI is very inaccurate. Does anybody have an idea what the reason for this inacurracy could be? Possible origins for the problem are in my optinion the Bluetooth adpater, which differs from the one in my Android phone. Another reason could be the library for Bluetooth scanning (on the RaspberryPi, I'm using bluez). What do you think?

RSSI is generally effected by surrounding environments so it should be
averaged for couple of seconds to get accurate value

Related

Receiving data from a BLE device to a raspberry Pi3

I never used a raspberry pi before and I have a project part of which includes receiving data from a BLE blood pressure device over Bluetooth to a raspberry pi 3. I can pair the device to my raspberry but I have no idea what to do next. I need to be able to receive the measurements in my raspberry please help and thank you in advance.
PS: the device I'm trying to use is very similar to this one:
https://ibb.co/71365k5
Thanks for your answers, I have tried "Gatt" and "Gatttool" but the problem is after pairing the device is meant to send the measurement to its application on an android phone, without it I cannot read the blood measurement characteristic or it just does not exist.
Linux uses BlueZ as a default bluetooth stack. It exposes DBus APIs for implementing software using Bluetooth.
If you don't want to use this API directly, which can sometimes feel a bit low level you have many libraries that wrap it, such as https://github.com/getsenic/gatt-python that also comes with examples.
All other solutions requires replacing the Bluetooth stack on Linux and hence your other existing Bluetooth pairings to the system will stop working.

Bluetooth dongle BLED112 on Debian 10 is not working

I just randomly found a Bluegiga BLED112 Bluetooth dongle and I tried to connect it to my Debian 10 laptop as a basic dongle for Bluetooth audio outs.
Unfortunately I wasn't able to solve all the issues I had, starting from the fact that the device is not fully listed once used lsusb and just a mere ID number - namely ID 2458:0001 - pops out and bluetooth or bluez helps weren't successful either.
This given, I tried to follow several of the guides you can find online, also by running available scripts, but again nothing worked.
So if it's possible, what should I do in order to run such a dongle for the basic use I mentioned above - i.e. just for connecting my stereo speakers to my computer?
Thanks
The BlueGiga BLED112 is not a regular Bluetooth USB dongle. It gives you a virtual com port that can be used to access an API that in turn acts as a BLE device.
It is ment to be used for development of IOT solutions.
Also it does not support Bluetooth Classic, it only supports Bluetooth Low Energy.

Issue with 'unknown advertising packet type, invalid advertising data, advertising length corrected' Linux, Raspberry Pi, iOS, Homepod

I have been using a small c program I wrote to get bluetooth ble advertising packets from low cost bluetooth temperature sensors. A number of these sensors broadcast their temperature and humidity readings in either type 0 or type 4 bluetooth advertising packets. This gives me the ability to get this data from low cost sensors and not have to use the vendors app or cloud services.
This has been working great for months using a raspberry pi to collect this data and publish to MQTT. Recently the program started to fail. I tracked down the issue to the bluetooth stack crashing after some number and combination of it logging errors like these:
Bluetooth: hci0: unknown advertising packet type: 0xdf
Bluetooth: hci0: unknown advertising packet type: 0xd8
Bluetooth: hci0: Dropping invalid advertising data
Bluetooth: hci0: advertising data len corrected
I see these errors when I run my program on:
ARM Raspbian GNU/Linux 10 (buster)
Intel Ubuntu 18.04.5 LTS
The bluetooth stack failure and reload seems to occur most often on a Raspberry Pi with a USB Bluetooth adapter. A lower occurrence on Raspberry Pi using internal UART Bluetooth adapter, or any adapter on a beefier i5 x86 Ubuntu machine. However all log some combo of the above messages.
Here is where this starts to get a bit weird. I'm pretty sure the actions that are causing these messages and crashes are my using my iPhone to control my HomePods.....
This is moved quickly out of my pay grade. I have seen some reports of some similar messages well prior to HomePods at seem to indicate that the rate of advertising packets is exceeding some internal of Linux bluetooth stack. But, as I said, my system had been running for months with no issues. Until, I think, I introduced the HomePods into my home, and even then I think it might have been a new version of HomePod firmware that started the issues.
Any ideas or direction to explore would be appreciated.
Thanks!

Is there a way to run iBeacon on Bluetooth 2.0 compat. device?

So I have a Linux with old BT2.0. I want to use it as iBeacon. Energy consumption is not my concern; the only one is API. Is it possible?
Unfortunately no. iBeacon and beacons in general depend on BLE advertisements, and this was introduced as part of the Bluetooth Low Energy features that are part of BT4.0. The only way around this is if you added a BT4.0 HCI dongle or a Bluetooth v4.0 device to your Linux machine.
You can find more information here:-
5 Things to Know about Beacon Technology
BLE Beacon Technology Made Simple
What are BLE Beacons
Pluggable USB Bluetooth v4.0 Dongle
Best Bluetooth Adapters in 2020
You will also need a relatively new version of Linux in order to have BlueZ support for BLE. Ideally your laptop should be on Linux v4.4 or later, but theoretically this should work from Linux v3.13 onwards. More details are found here:-
Bluetooth Linux Kernel Supported Versions
Checking BLE Capability on Linux

Android Things and Bluetooth

As far as I read about the dev boards, every SoC is capable to use Bluetooth.
I didn't tested it yet, but can I use Android Things with a Bluetooth connection? My question is, how can I enable Bluetooth without an input device? If I want to enable Bluetooth on my phone (with code), I had to confirm it, but this can't be possible on Android Things.
Update: Since the release of Android Things developer preview 3, Bluetooth and BLE are now available.
Old Answer
No. You can not use Bluetooth with the current version of AndroidThings (developer preview 1).
It is said in the known issues part of the release notes that Bluetooth is currently disabled (and so is USB).
It is supposed to be included at some point, but at the moment if you try to get a BluetoothAdapter it does return null.
Android Things will use the latest version of Bluetooth called Bluetooth Low Energy and the only similarity between the two is that they have Bluetooth in the name!
Can I use Android Things with a Bluetooth connection?
Yes, well a Bluetooth Low Energy connection
https://www.link-labs.com/bluetooth-vs-bluetooth-low-energy/
In summary, Bluetooth and Bluetooth Low Energy (BLE) are used for very different purposes. Bluetooth can handle a lot of data, but consumes battery life quickly and costs a lot more. BLE is used for applications that do not need to exchange large amounts of data, and can therefore run on battery power for years at a cheaper cost. It all depends on what you’re trying to accomplish.
Everything you need to know about BLE is written here:
https://developer.android.com/guide/topics/connectivity/bluetooth-le.html
how can I enable Bluetooth without an input device?
You do not pair BLE devices like you used to with the older Bluetooth (but you can use Bonding). Check this out:
Android Bluetooth Low Energy Pairing
https://stackoverflow.com/a/20093695/413127
But as stated by #shalafi Android Things doesn't currently support Bluetooth

Resources