I'm developing a xamarin android app to connect to a bluetooth low energy weight scale. I can already connect to the device an explore it's services and characteristics, however i'm facing some problems extracting it's value.
The scale implements the Bluetooth SIG standards, so i was expecting it to have an Weight Scale service (org.bluetooth.service.weight_scale) and the Weight Measurement characteristic (org.bluetooth.characteristic.weight_measurement).
Aparently not.
Exploring the device services, the reading service seams to be an "unknown service" (0000ffe0-0000-1000-8000-00805f9b34fb) and the characteristic seams to be "TI SensorTag Keys Data" (0000ffe1-0000-1000-8000-00805f9b34fb).
Here's some sample readings from the refered service:
For 78.4 Kg i got E7-58-01-06-20
For 81.6 Kg i got E7-58-01-06-60
For 81.7 Kg i got E7-58-01-06-62
For 118.6 Kg i got E7-58-01-09-44
The scale supports weight reading, body fat, body water, muscle mass, bone mass, basel metabolic rate, and active metabolic rate. I think i'm using a weight read only mode.
I've already converted the hexadecimal values to decimal but the output values are not direct.
What formula should i use to extract the value?
If you care only about the last two bytes of your characteristic value: 06-20, 06-60, 0--62 and 09-44. You can compare those to the weight displayed on the scale:
> 0x620/78.4 -> 20.0
> 0x660/81.6 -> 20.0
> 0x662/81.7 -> 20.0
> 0x944/118.6 -> 20.0
This means that each digit in the number represented by the lower two bytes of the characteristic value is equal to 1/20th of one kilogram = 50g.
To display the weight in your application, just convert the last two bytes of the characteristic value into your host integer representation (ntohs or equivalent https://linux.die.net/man/3/ntohs) and divide it by 20.
Related
I have a bunch of questions concerning Timing Advance in GSM :
When is it defined ?
Is it the phone or the BTS who's in charge of defining it's value ?
is it dynamic, does it depends on certain situations ?
Let's say that I figured out a way to get the exact value of the Timing Advance (GSM Layer 1 Transmission level) from the phone's modem :
In order to verify my solution, I'm supposed to put my phone over and over in a situation where he have to use/change the Timing Advance while I log its value...
How can I do that ?
Thanks
In the GSM cellular mobile phone standard, timing advance value corresponds to the length of time a signal takes to reach the base station from a mobile phone. GSM uses TDMA technology in the radio interface to share a single frequency between several users, assigning sequential timeslots to the individual users sharing a frequency. Each user transmits periodically for less than one-eighth of the time within one of the eight timeslots. Since the users are at various distances from the base station and radio waves travel at the finite speed of light, the precise arrival-time within the slot can be used by the base station to determine the distance to the mobile phone. The time at which the phone is allowed to transmit a burst of traffic within a timeslot must be adjusted accordingly to prevent collisions with adjacent users. Timing Advance (TA) is the variable controlling this adjustment.
Technical Specifications 3GPP TS 05.10[1] and TS 45.010[2] describe the TA value adjustment procedures. The TA value is normally between 0 and 63, with each step representing an advance of one bit period (approximately 3.69 microseconds). With radio waves travelling at about 300,000,000 metres per second (that is 300 metres per microsecond), one TA step then represents a change in round-trip distance (twice the propagation range) of about 1,100 metres. This means that the TA value changes for each 550-metre change in the range between a mobile and the base station. This limit of 63 × 550 metres is the maximum 35 kilometres that a device can be from a base station and is the upper bound on cell placement distance.
A continually adjusted TA value avoids interference to and from other users in adjacent timeslots, thereby minimizing data loss and maintaining Mobile QoS (call quality-of-service).
Timing Advance is significant for privacy and communications security, as its combination with other variables can allow GSM localization to find the device's position and tracking the mobile phone user. TA is also used to adjust transmission power in Space-division multiple access systems.
This limited the original range of a GSM cell site to 35km as mandated by the duration of the standard timeslots defined in the GSM specification. The maximum distance is given by the maximum time that the signal from the mobile/BTS needs to reach the receiver of the mobile/BTS on time to be successfully heard. At the air interface the delay between the transmission of the downlink (BTS) and the uplink (mobile) has an offset of 3 timeslots. Until now the mobile station has used a timing advance to compensate for the propagation delay as the distance to the BTS changes. The timing advance values are coded by 6 bits, which gives the theoretical maximum BTS/mobile separation as 35km.
By implementing the Extended Range feature, the BTS is able to receive the uplink signal in two adjacent timeslots instead of one. When the mobile station reaches its maximum timing advance, i.e. maximum range, the BTS expands its hearing window with an internal timing advance that gives the necessary time for the mobile to be heard by the BTS even from the extended distance. This extra advance is the duration of a single timeslot, a 156 bit period. This gives roughly 120 km range for a cell.[3] and is implemented in sparsely populated areas and to reach islands for example.
Hope this Answer the question:)
It's defined everytime the BTS needs to set the define the phone's transmission power, which happens quite often.
It's the core system (BTS in GSM) who totally in charge of defining it's value.
It's very dynamic, and change a lot. Globally, the GSM core system is constantly trying to find the exact distance between the BTS and the MS, so it constantly make a kind of "ping" to calculate it. The result of such operations is generally not that accurate since there are a lot of obstacles between the mobile and the BTS (it's not a direct link in an open space).
Such operations happens a lot, so use your smartphone. Simply.
I need to generate Unique ID for the device when the application installed, and store this value on the device, then need to communicate with server using this UUID. And it seems NSSUUD suit for the sitiation, but I am confused is there any chance of duplication of the UUID from multiple device. I already found the answer https://stackoverflow.com/a/6963990/1573209 where it describe that the version 1 type uses MAC address and 60 bit clock to generate UUID, so the duplication chance is negligible. Where as the Version4 uses some fixed number and some random number to generate the UUID, and the doc says that UUIDs created by NSUUID conform to RFC 4122 version 4 and are created with random bytes
Does that mean the chance of duplication higher?.
Then how can I use version 1 type of UUID generator, I cant see any documentation for it.
You can have look at this RFC 4122. UUID conforming to RFC 4122 are practically unique in given space and time. You can also see Random UUID probability of duplicates.
Out of a total of 128 bits, two bits indicate an RFC 4122 ("Leach-Salz") UUID and four bits the version (0100 indicating "randomly generated"), so randomly generated UUIDs have 122 random bits. The chance of two such UUIDs having the same value can be calculated using probability theory (birthday problem). Probabilities of an accidental clash after calculating n UUIDs, with x = 122 is found to be very close to zero
For n=2^36 which is 68,719,476,736 probability of collision is found to be 0.0000000000000004. For lesser value of n, this value will be even less and probability increases as more UUID's are generated. In above estimation n represents number of UUID's generated.
I am working on a RFID project. The RFID tags that i am using are UHF whose frequency range is given i.e. 860-960 MHZ. How can i find the exact frequency on which a tag is working?. Does the value of frequency change with distance?. The only thing i have is RSSI, which i can measured from my equipment at any distance from the tag within the reading capacity of the reading.
Passive RFID tags do not select their frequency. It is completely determined by the reader generating a carrier signal. The 860-960 MHz range indicates it's a passive UHF tag. Depending on your physical location and regulatory requirements, the tag will respond at a single channel (frequency) within that band. Most tag readers report tag reads with optional meta data, such as the channel the tag was read on.
If the reader doesn't support this, you would need some advanced instrumentation to sniff the transaction. This can be accomplished with a filed probe, directional coupler + diode detector, or real time spectrum analyzer.
For reference, readers in the EU will operate at 865-868MHz and in NA at 902-928MHz.
I am currently utilising CTGetSignalStrength(); to obtain the signal strength from an iOS device.
Whilst this function does return a value, the value appears to range from 0-45.
What does this value actually mean in terms of dBm, as this appears to be an Apple graded value that doesn't relate to an actual measurement.
Is there a way to convert the value returned to dBm, or a private API to retrieve the value in dBm
I need to know the RSSI value of non anchor nodes when anchor nodes transmit signal when a simulation is run using Two ray Ground Model. I need to use those values to estimate non anchor node location.
I am a NS2 beginner. Some detailed steps would help me.
you can get the value of Pr, which can be found in the packet object
p->txinfo_.getTxPr();
and
p->txinfo_.RxPr
where p is the received packet
TxPr is the power with which packet is transmitted
RxPr is the power with which packet is received