Possible to read sensor values of phone just by bluetooth? - android

When you connect bluetooth speakers or an external device you are connecting them using the Android/iPhones bluetooth settings. The android OS is doing this. Example:iPhone Bluetooth Menu
These bluetooth speakers do not need an additional app that is required to download to work with the speakers. The phone seems to recognize the bluetooth device's profile as a headset/speaker and automatically gives any audio output to the speaker.
Is it possible to replace the bluetooth speakers with a device that could read sensor values (GPS,Gyro,etc). For example, could you pair a device through the phone's bluetooth settings menu and then have sensor values of the phone given to that device.
From my reading the device would have to have a "Health Device Profile" in order to read sensor information, but I have no idea what kind of chip to use, or if this is even possible.
Any insight, suggestions, or knowledge would help a million. Thank you!

Yes its possible, my experience with anadafruit board, and an accidently ordered BLE addon. BLE(Bluetooth Low Energy) is nice for low power uses, but with optimized Bluetooth use it doesnt take much battery either.
So yes it is possible.

Well you can certainly scan and pair a BLE device through Android's Bluetooth settings, but the only GATT profile that can be used as far as I know without any app, i.e. built into the system is the HID profile.
On iOS the same applies there almost, except that you can only scan devices which advertise specific GATT service in the Bluetooth settings UI. But iOS supports at least HID, Battery status profile and midi (I think).

Related

Bluetooth BLE Implementation

I'm trying to implement a Bluetooth (BLE) gateway into a project to transfer data between hardware and a mobile device with an application. The hardware is not unique, it could be mass produced with the controller having the same program flashed into it.
If 100 of the hardware product is made, powered up sitting side by side, what is the best way to set up the information that the BLE broadcasts to advertise so that it can be received by a mobile device, and only 1 hardware and mobile device can be connected at any time.
For example, if you have 3 of the same fitness tracking watches side by side, and you only want to connect to 1 of them, how do you distinguish which is which on say the phones bluetooth pairing menu.
Does each of the manufactured hardware need to have a unique ID that shows on the mobile device (eg ABC11, ABC112, ABC113 etc), and how do you program 100 unique programs into the hardware quickly.
On the other hand, should each of the hardware have the same ID broadcast, and then the user just hopes for the best if the correct hardware is paired.
(BTW, the hardware is an arduino based microcontroller using a BM70 BLE module. neither of which are intended to be modified by the user)
Assistance appreciated.
Thanks. Nunya
You do not have to manually program a different MAC addresses for each device, the BM70 module is the one that provides the BLE MAC address and they are supposed to have unique ones. Sometimes manufacturer recycle (reuse) the addresses, but I think the chance to hit a MAC twice with 100 devies is pretty low.
If your devices are all the same and use the same program they all offer and advertise the same BLE service. The service and containing characteristics are the feature that distinguishes your devices from other BLE devices. A true BLE device that does not also use Bluetooth Classic will not show up in your phones bluetooth settings or pairing menu. BLE requires a dedicated app where you scan for BLE devices and idealy filter for the special service you are using to only find your own devices.
To distinguish between 100 devices placed next to each other (if this even matters since they are all the same) you need to either read the MAC address and prit it on a label for each device or use some status LEDs to show the connection status on your arduino. If you connect to one device the LEDs could start blinking to show which device you are connected to.

What signal of a phone can another phone detect? (Exclude BLE)

What signal (that is turned on permanently or most of the time) of our phones can another phone detect?
For example, if we turn on BLE then another phone is able to detect it using their BLE. However, people do not tend to leave their phone's BLE on all the time.
So, what else can I use?
Besides Bluetooth, your only other options are WiFi and NFC. However, similar to Bluetooth, WiFi and NFC can be turned of for long periods of time to save power (e.g. airplane mode). Moreover, not all phones support NFC or expose API to use it.
I would say your best bet is WiFi due to its more frequent use (relative to Bluetooth and NFC). It still has restrictions though and I would say Bluetooth is more suitable for your purpose. Below you can find a list of links that might be useful for your research:-
iOS API to scan WiFi networks
iOS - How to programmatically connect to a WiFi network given the SSID and password
Android WiFiManager
Android connecting to devices wirelessly
I hope this helps.

Switch model from BLE to Bluetooth Classic in Android

I'm setting up a mobile application to support bluetooth communication between an android phone and one dual-mode bluetooth module. Two devices must init a BLE connection and transfer sound through HandsFree profile. At any time, two device must be able to re-establish these communications.
Should application shut down the Classic bluetooth process after sound transferring is done and always connect by BLE??
If I understood your question correctly, you don't need Bluetooth Low Energy (BLE) for your application. If you just want to transfer sound through the HandsFree profile, then this can be accomplished with classic Bluetooth alone and you can even turn BLE for the entirety of the application.
Please see this Android Developer page which gives a step-by-step guide on how to do this and provide sample code:-
https://developer.android.com/guide/topics/connectivity/bluetooth#Profiles
Finally, please note that for the most part BLE and classic Bluetooth are mutually exclusive; even though they are part of the same specification, they are like two different wireless technologies and in almost all cases your application will need one or the other, but not both. Please see this post for more details:-
Can a Bluetooth LE powered device discover a classic Bluetooth device and vice-versa?
I hope this helps.

Bluetooth proximity scan while paired

I have been doing a ton of research on this project I want to do, probably read every SO post (bluejacking, RFCOMM, beacons, etc...) and my head is spinning.
I want to create a system at home, using Arduino (with bluetooth le) that will scan bluetooth and detect when my phone or any of my family members phones are in proximity. Whether this is a MAC scanner or simply getting the friendly name. I would also like to get the RSSI. I dont need to do accurate distance measurement but I would like to know approximately how close they are. Does anybody have any suggestions for this approach? I know I can create an app on the phone and have it become a beacon and this may be an option but I am concerned with Android, it would have to be Marshmallow 5.0 at a minimum. I would like support to be a little lower than that, like JB or KK. So, it seems like there should be a simple scan, just looking for the MAC or name. That is all I really need.
That said, the main question I have is, can you scan for and see bluetooth devices in range if they are already paired to something? Like a Bluetooth headset? I understand bluetooth is point to point but does it allow multiple connections or at least broadcast the mac or name when paired?
This question, along with any general suggestions will help me out tremendously!
Thanks!
Bluetooth Discovery from the Listener involves Listening for Bluetooth Inquiry packets(RX) and inquiry response (TX).if done continuously this will deplete the battery. Hence most devices (including Mobile Phones and Headsets) has a policy of when to be discover-able and connectable. Headsets in particular are discoverable only when they are instructed and connectable until one device is connected to it ( There are probably exceptions where the headset has the capability to be connected to multiple phones at the same time). Most Mobile Phones are discoverable only when they are in settings screen ( Android,IOS and Windows Phones), but unlike the headset case they are connectable.
so one option with the MobilePhone is to see if it is possible to connect to them after pairing once ( for example by trying a service search on the remote device and see if it returns the service attributes, this internally makes a connection and indirectly ensures the presence of the device).
if you are specific about a mobile phone which is already paired then you might need to establish a higherlayer connection ( such as SPP) with Authentication and encryption. This would force a two way check between devices to see whether they are already paired. other less secure option is to rely on the Phone (Android and IOS phones doesn't generally Allow a higher layer connection without encryption/pairing) and try to establish an SPP connection to the phone.
Another option is to use Bluetooth-LowEnergy. But Note that security in BT was superior to BLE till BTv4.1 and same on BTv4.2.

Can a mobile application that is developed to work on Bluetooth technology be used on Bluetooth LE technology?

Can a mobile application that is developed to work on Bluetooth technology be used on Bluetooth LE technology?
Or does the developer need to modify code to handle Bluetooth LE (Smart) signals, input, output etc. ?
EDIT
While i was asking this question i want to know
if i write a code piece, can i run it on BLE devices, also with BLE performance?
Is it possible, or not?
If a device can have both B and BLE then i have one more question:
Should we write code with different APIs for ordinary B and BLE?
I don't know of any phone that is doing BTLE but not classic Bluetooth as well. So the application should still work but it will still just be using the classic Bluetooth portion of the hardware.
Of course from the sensor of other device your talking to point of view the situation may well be different as there are BTLE only sensors for example that may have a similar function to an old style Bluetooth sensor but they want be compatible. E.g. some classic Heart Rate sensors and modern BTLE heart rate sensors.
If you want to connect to only BLE devices(LE profiles) , then you need to definitely modify code as profiles on LE devices are GATT based , unlike Bluetooth Classic.
You will need to implement GATT Client and GATT server in your code.

Categories

Resources