Detecting Sound on a Band - microsoft-band

I have an idea that would require detecting sound near the Band. Is it possible to put the Band in listening mode from an app on the Band? If not is there another sensor like the barometer that is sensitive enough to do the job?

The Band audio sensor is not accessible by 3rd party apps.

Related

How to run watchOS app connected to BLE peripheral in the background?

I'm creating a watchOS application. The app should connect to a BLE tag, which sends distance values to the apple watch. If the distance falls below a given value, the application should give some feedback to the user about this.
Reading about core bluetooth and background tasks, it doesn't seems like it's possible. If I'm correct, when the application is suspended, it will no longer receive data from the BLE peripheral. How should I approach this task? Is it possible to run an application like this for 8 hours in the background? I can't find any more information about this, and it seems like it's impossible.
There are restrictions to WatchOS apps using Bluetooth in the background, the main being:-
The minimum connection interval is 30ms instead of 15ms (for iOS
devices).
The Apple watch can only operate as a central device.
The Apple watch can only be connected to two peripherals at one time.
The peripheral gets disconnected when the app goes into the background.
More details about this can be found in the following links:-
https://www.raywenderlich.com/336-core-bluetooth-in-watchos-tutorial
https://developer.apple.com/videos/play/wwdc2017/712/
The only exception to this is if you use the HKWorkoutSession. More information about this can be found here.
I hope this helps.

How do I program this BLE location tag?

I bought one of these:
https://www.aliexpress.com/item/Smart-finder-Key-finder-Wireless-Bluetooth-Tracker-Anti-lost-alarm-Smart-Tag-Child-Bag-Pet-GPS/32806261079.html
As far as I can tell it is a BLE (Bluetooth Low Energy) location tag.
I downloaded the app for it onto my iphone, and the app instantly recognised it and connected to it. The iPhone app seems to know how far away the tag is - it has a little map of the local area and says how many feet away. I was able to set the device name via the app, but I'm not sure if that set it locally or on the tag itself. The iPhone app also has a "find" button - when you press it, the tag beeps.
So I want to know how I can program this thing myself. I want to be able to identify it when it is nearby, connect to it and make it beep. I've searched for quite a while but not come up with much.
I'm assuming (wrongly/rightly?) that there is some general standard or approach for talking to these BLE location devices and carrying out the basic functions with them - but what is that standard - where is the documentation?
Does anyone have any idea how to program these BLE location tag devices?
BLE devices typically communicate using GATT, either using standard GATT services, or custom ones. The command to make it beep is probably implemented using a custom GATT service.
For finding out the distance to the beacon, typically the RSSI is used. This is a measure of the received power. It needs to be compared to the output power at the emitter. Usually beacons will put their output power in advertisement data, so it can be used without connecting to them. Here since the app is also able to send commands to the beacon, chances are it keeps a connection to it and has a custom GATT protocol to retrieve the output power.
Here is what I would suggest:
Read up on BLE, especially advertising and GATT. For instance read this for advertising and this for GATT. The full BLE spec is available here but should be used for reference and not introduction
Sniff the communication between your device and your phone. You can see this other answer of mine to get started
Replicate the communication protocol in you own app. For that you'll need to use your target platform's BLE libraries. For instance for iOS it is CoreBluetooth

Android periipheral mode detection

Can anyone please tel me ,is there any possibility to check in which mode(i.e. central or peripheral mode), the BLE is operating? If so on what basis can we find out. I am using BCM20702. It says it supports both modes. But is there a way in which we can find out as to which mode is the device working in?
Regards,
Sathya
If you are advertising, you're a Peripheral. If you are scanning and initiating connections, you're a Central. It's as simple as that.

Energy efficiency of Android sensors vs Bluetooth low energy sensors?

I am making an android application that requires me to detect the user's motion.
My application also requires me to use an external sensor, which is a Bluetooth smart sensor, for some other purposes.
Now I have two options:
to use the accelerometer and gyrometer of the android phone
fetch motion information from the bluetooth smart sensor.
I understand that Bluetooth Smart (ble) is more energy efficient than Bluetooth sensors.
However, I am confused as to which of the above options will provide me a more energy efficient solution on the Android device. EDIT: I am presently not concerned with the energy efficiency of the bluetooth device.
Also, please see that I want this comparison only because I don't want to detect accurate user motion, otherwise an external device(bluetooth low energy device) would have been better hands down.
The accelerometer and gyrometer will take roughly the same amount of power whether it's on the phone or the external device. The difference is the external device has to transmit that information over a radio signal to the phone. It makes more sense to just use the Phone's existing information if that's sufficient because it won't require any radio transmissions and will require less power. Also, the phone will have a much larger battery.
The sensors on the phone have nothing to do with Bluetooth... they're incorporated right into the hardware.
EDIT: The difference between Bluetooth and BLE is that BLE uses the radio much more sparingly. Radio transmissions take a good chunk of power. So, using on-board sensors is going to (most likely) take far less power than using a radio to communicate with an external sensor. Also, I have a feeling that the accelerometers are always on on the cellphone so getting readings from those is going to take no more power than is already being used, too.

GATT Profile for a BLE device (server) that switches on/off a LED

Not sure if to posted this on SO.
I'm looking at pretty simple BLE Device. It has a two LEDS (to simplify) that can be switched on or off.
While browsing the GATT profiles, i can't find which profile i should use. Most of them send something back (like a temerature) to the client (upon request).
I need the opposite: switch something on/off of the BLE decive (server). In my case, the client (a iPhone) would send a command to switch on/off LED-1 or LED -2.
What service profile i should use?
Thanks.
I'm using the nRF8001 development kit & nRF Studio for making the services.h
If the LED's are just to be turned on/off there probably isn't any specific profile that they belong to. You probably need to know the handle and write directly to the attribute some value that maps to on or off. Maybe you can figure it out by listing all attribute characteristics. (unfortunately I don't know how to do that specifically on the iPhone)
I noticed that you are using the nRF8001 development kit. So, first thing you need to check is whether the LEDs are connected to IO port of the micro-controller on the kit or directly connected to IO port on BLE chip.
If it connected to micro-controller on the kit then you need to program the kit to handle the received bluetooth data to control led. (It would have a high chance it is in this situation)
If it connected to BLE chip, it means you need to program the ble chip first.
Usually, useful GATT profiles are user specified. It means you need to define the profile yourself. And, I believe some part of the kit or the studio would allow you to do modifications to the profile.
There is only one default GATT profile you should use -- GAP which is to define the defaults like name of the ble device. The others usually are user self-defined profiles.

Resources