Organizing bluetooth LE services - bluetooth-lowenergy

I'm using bluetooth LE to stream some pressure sensor data, along with an inertial motion unit data.
The IMU sensors need self-calibration to provide useful data. Some example of the calibration is moving it in a 8-figure path, or lay it down still for about 1 second. The IMU provide data, along with the calibration level (uncalibrated -- partially calibrated -- totally calibrated).
I currently stream pressure sensor + IMU data through a single service. Where should I put the IMU calibration data? In a different service, or a different characteristic?
Ideally, I want to be able to check the calibration level, perform the self-calibration, and then will start recording real data.

I would suggest you use one service and different characteristic.
Actually on Bluetooth SIG there is are many similar BLE profiles which may same with your requests, you may refer them.
There was an ongoing profile named TPMS but not adopted yet.

Related

How to get images at 60 fps and imu data at 500hz at the same time with zedmini camera?

We know that IMU sampling rate is much higher than image taken from the sensor (FPS), so can I get images at 60FPS and IMU data at 500hz at the same time?
Is there an easy way? Or maybe I need to use two threads to achieve my goal ?
Actually, you have two options.
1. Bound readout from the sensor to an IMU module
Sounds unrealistic, but some advanced IMU s, such as (no advertisements here) InvenSense allows to bind readings from the IMU to a sensor event (readout). To get familiar with the concept, please take a closer look at FSYNC register. You can refer to the most advanced chip: MPU9250.
Quote from the invensense.com:
The FSYNC (Frame Sync) input allows precise timing to be achieved with Video Frame Sync at the host level for read out of the frame data.
2. Store the last read data value
The one you mentioned. Have a separate producer thread which reads the data from the IMU with required speed and puts it into the storage; and another one (consumer) which reads the data from the local storage.

Can't get temperature reading out of ble beacon .. at my wits end now. This needs a super-hero I guess

I have a task where I need to read 2 parameters from a BLE Beacon. The documentation was seriously lacking and after a fair amount of effort, I managed to get some basic information about reading the data from the BLE Beacon.
The parameters to read are
1) Battery Voltage of the sensor
2) Temperature the beacon has a built in temperature sensor.
I think I have tried almost every popular Python BLE library out there but I just can't seem to get the temperature reading out of the beacon. "I think" I am able to read the voltage. The reason why I said "I think" is because the value seems to match what was provided in the minimal document. And also when I put the beacon into the charger, I can see the value go up - an indication that it is the voltage reading. As I could not read the temperature ( because the UUIDs that are mentioned in the document, the value doesn't seem to change ). I have tried enabling the sensor in every possible way and method described - by writing 01:00 etc. I spent a fair amount of time to reverse engineer the thing. I ran a packet sniffer and managed to capture the data that was being transferred between the beacon and the mobile app ( They have a mobile app ). But then again I am not able to figure out how the temperature readings are being communicated between the beacon and the app. Let me break the whole stuff in smaller blocks.
Hardware: BLE beacon from which voltage and temperature can be read. The temperature sensor is built into the beacon. And the beacon itself is from Texas Instruments but the temperature, voltage sensing part is done by a third party. They provided us with some minimal information and it was difficult to make sense of some of the sentences as they have trouble communicating in English.
The sequence to get the data goes like this
Scan for beacons
When the beacon is found then connect to it
Enable notification
Set notification interval
Get the voltage and temperature reading.
I have been able to do the first 4 real fast, and "half" of No. 5, i.e getting the voltage part. When I say real fast I mean I got that stuff with nearly no documentation available at that time.
As per the info that I have the data resides in these characteristics/UUIDs. Also please note that the UUID are not standard 128 bit and this caused me issues when using certain libraries. But after some tries I got to read/write to them using handles etc. The handles and other stuff I printed are ones that I read using PYGATT (A Python wrapper for gatttool).
The UUIDs are marked as 1st, 2nd, 3rd and 4th parameters and it has the following to say about the parameters
- A: 1 byte (2nd Param)
- B: Maj + Min values, 4 bytes (4th Param)
- C: 4 bytes (3rd Param)
- D: Enable/disable notification ( I have been able to turn this on )
- E: Set notification interval ( I have been able to set this and can notice the change in notification interval )
This is minimal so as to not have a large file. All it does is this - the mobile app connects to the beacon, then the notifications start and the temperate readings are retrieved by the mobile app. Like I had mentioned, I don't seem to have problem reading the voltage, it's only the temperature that I am getting stuck at. I have been at it for a week now. I think I have tried nearly everything that I could think of. I even enumerated all the writable characteristics and tried writing numbers like 1 ( enables the sensor? ). I could have offered a bounty for this straight away if it were possible. I rarely get stuck for so long with a problem. This is driving me a little crazy. I am getting close to my wits end - I guess it's time for a super hero - anyone out there? :) I can provide for every bit of information needed if someone could indicate what is wrong. I even wrote a cordova app ... and tried a bunch of stuff from my Android phone. I can connect ... write to characteristics, read stuff etc but temperature ready, nah!!! It just won't budge. All I get is the same set of values ( I used a JSON.stringify to display A, B and C). I can bother about the byte order later. I guess that is a smaller problem.
The communication between the beacon and a third party mobile app is fine, it is able to read the temperature info just fine.
I have been looking at wireshark data and I am fairly sure that the temperature data is being communicated at this stage. But then when I decode the "value", it looks like it's the voltage. It mentions l2cap but I am not sure how that is being used here to send the temperature readings ( if it is using that in the first place ).
Update: Wrote to every writable characteristics. Wrote values like 1, 0100, 2, 7 on every writable characteristics. At the same time I was reading every readable characteristic ( in a loop ) and doing a comparison (just true/false) with the previous set of values. This seemed like a quick and easier way to know if something changed. Didn't want to take chances with converting the hex to a float. I can figure out the byte order later.
From the sniffed data (wireshark) I can only see 3 writes happening on the beacon.
I am not fully sure, even after a long discussion, but it seems that the four bytes of the notification are used for the voltage as well as the temperature, since the temperature can most probably be derived from the voltage.
From the values it seems that those four bytes represent the voltage in float (if you ignore the absurd factor of 10^-38 that comes in because only 4 bytes instead of 8 bytes are used).
Since typically the temperature T is derived from a resistivity measurement, where the resistivity R is proportional to the voltage U (if the current is constant), you can in principle calculate the temperature T from the voltage U.
The problem is that T(R) is relatively linear, but not perfectly (in contrast to U(R) which is assumed to be U=RI). So you may need to plot the values for T(U) to find out the curve that they are using.
To add to the confusion, I got the best results when only using the first five bits of the third byte and the eight bits of the fourth byte. I am not aware why this is the case, and it might point to some trouble still.
The best option is to ask for their function T(U) that they are using. If they can and will provide it for you...

HM-10 AT Commands: Using Beacon Way to Broadcast Sensor's Data

I try to use beacon(HM-10) to broadcast my sensor's data, but there is a problem that I use a loop to write AT commands, after a while, it doesn't respond anything.
Here is the part of the code:
String pre = "AT+MARJ0x";
int sensorData = 0;
loop () {
sensorData = getSensorData(); // always returns 100 ~180
String atCommand = pre + sensorData; // ex: AT+MARJ0x100
BTSerial.print (atCommand);
delay (200);
}
It initially work successfully about 3-mins, and then it doesn't work and can't be sent any at commands.
Can anybody help me fix this problem?
What you are trying is not possible with an Ibeacon.
All you do is set-up the major number of Ibeacon data in your HM-10device over and over again with sensor data.
major number is a part of the Ibeacon data spec:
(source: https://developer.mbed.org/blog/entry/BLE-Beacons-URIBeacon-AltBeacons-iBeacon/)
Data Spec:
IBeacons broadcast four pieces of information:
A UUID that identifies the beacon.
A Major number identifying a subset of beacons within a large group.
A Minor number identifying a specific beacon.
A TX power level in 2's compliment, indicating the signal strength one meter from the device.
This number must be calibrated for each device by the user or manufacturer.
A scanning application reads the UUID, major number and minor number and references them against a database
to get information about the beacon;
the beacon itself carries no descriptive information - it requires this external database to be useful.
The TX power field is used with the measured signal strength to determine how far away the beacon is from the smart phone.
Please note that TxPower must be calibrated on a beacon-by-beacon basis by the user to be accurate.
For a HM-10 device AT-commands are normally only used to set-up the device, not for sending data.
Google some examples and learn how to setup communication between BLE devices.

Query on Iot device

Can any one help me find a solution on this.
I would like to know whether there is any sensor that can sense and send data below -30°C. I came to know that arduino cant work on that temperature range.
I need to deploy something into a freezer like thing which can sense the -°C temperature and send it to the cloud or send it to some controller(wire less) near by and that controller will send the data to raspberry-pi or cloud.
Thank you for the valuable commands.
Temperature range depends on used sensor (some sensors can measure temperatures from -200°C).
Temperature range for other electronic is not so good.
Basically you can use internally heated encapsulation, but it is not suitable for battery application.
Or you can place inside only the sensor and rest of circuit will be outside.

Can you develop an app for the Microsoft band, without a corresponding mobile app always being connected?

I have several Microsoft bands, to be used as part of a group health initiative. I intend to develop a single app on a tablet which will pull the data from the bands. This will be a manual process, there will not be a constant connection to the tablet and no connection to Microsoft Health.
Does anyone know if this is possible?
Thanks
Emma
The general answer is no: Historical sensor values are not stored or buffered on the Band itself.
It does however depend on what sensors you are interested in. The sensor values are not buffered, so you can only read the current (realtime) value of the sensors.
But sensors such as pedometer and distance are incrementing over time, so these values will make sense even though you are only connected once in a while. Whereas for, e.g., the heart rate and skin temperature, you will only get the current (realtime) value.
So it depends on your use case.

Resources