This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Interpret SensorTag Barometric Value in objective-c

Other Parts Discussed in Thread: CC2541, CC2650

Hi,

we are working on the SensorTag 2 and want to interpret the Barometric value.

It works fine for the temperature part of the value, but we don't get the pressure value - the second 2 bytes.

Does anyone did this before and may provide an objective-c example on how to do the conversion?

Thanks

Sascha

  • This is our current code:

    NSLog(@"Barometer Data: %@",characteristic.value);
    //self.baroSensor = [[sensorC953A alloc] initWithCalibrationData:characteristic.value];

    char scratchVal[4];
    [characteristic.value getBytes:&scratchVal length:4];
    int16_t temp;
    int16_t pressure;
    int16_t mantissa;
    int16_t exponent;

    temp = (scratchVal[0] & 0xff) | ((scratchVal[1] << 8) & 0xff00);
    NSLog(@"temp: %i", temp);

    // Temp
    mantissa = temp & 0x0FFF;
    exponent = (temp >> 12) & 0xFF;
    float flTemp = mantissa * pow(2, exponent) / 100;
    NSLog(@"flTemp: %f", flTemp);

    // Barometric Air Pressure
    pressure = (scratchVal[2] & 0xff) | ((scratchVal[3] << 8) & 0xff00);
    NSLog(@"pressure: %i", pressure);

    mantissa = pressure & 0x0FFF;
    exponent = (pressure >> 12) & 0xFF;
    float flPressure = mantissa * pow(2, exponent) / 100;
    NSLog(@"flPressure: %f", flPressure);

    Output is the following:

    temp: 2276 << looks okay
    flTemp: 22.760000 << looks okay
    pressure2: 19712 << changes every time
    flPressure: 532.479980 << changes every time

    temp: 2277
    flTemp: 22.770000
    pressure2: 19200
    flPressure: 450.559998
  • I'm having similar issues with the barometer using code similar to yours (although using CF byte swapping methods). The barometer values are very different to those from the iOS/Android app, and jump around wildly, while the temp values seem fine.

    The source for the latest versions of the Android/iOS apps for the SensorTag 2.0 would really help, hopefully they will be released soon.

  • Hi all,

    I am stumbling in the same issue in Python on the sensortag2. It seems that the barometer data format has changed from what is used in the source code for the Android app and the current documentation (as read from the GATT server with the handle 0x31).

    The data size is now 6x 2-byte words : TempLSB, Temp MSB, 0x00, Barometer1, Barometer2, 0x01 (at least this is what I receive when querying the sensortag with that handle).

    I tried various ways of parsing the barometer data, with no results : the reading changes when I increase the pressure, but is not consistent with any unit system.

    I also see in your code that you use calibration data for the barometer : could you develop on this please? I understood that they were no longer necessary nor used in the sensortag2, and that the necessary calibration was now performed internally ?

    Thank you
  • That's very helpful Nicholas. I now seem to get the correct pressure values if I swap the two barometer bytes (i.e. 4th and 5th bytes in the data), interpret them as a uint16 and then scale by 256.0/10000.0. The results then appear to agree with the android app. 

  • Dear Richard,


    Thank you for this contribution, now I also get the same results as the Android App. I was mislead by the Mantissa/Exponent calculation in the Android source.


    OTOH, the results are not correct. Today, I get 825 hPa from the sensortag2, and 975 hPa from the sensortag 1. The latter is the correct value, consistent with the local METAR. The sensortag2 result probably requires some calibration.


    Nicolas

  • Hi,

    It feels like there is perhaps a bug in the firmware - if you copy the mantissa/exponent code, but omit the "& 0x0FFF" in the mantissa calculation, then the correct results appear (i.e. the exponent part will give a multiplier of 256) once you've divided by 10,000.

    Not sure about calibration with the new sensor. The GATT gives a setting to read callibration values from the sensor, but I've not yet explored those.

    Ricard. 

  • The data from the barometer is 6 bytes, 3 bytes temperature followed by 3 bytes of pressure. The calibration and conversion is done in the FW (as opposed to the old SensorTag). On the GATT client side you only need to divide each 3-byte value by 100.0, to get the temperature (C) and pressure (hPa) respectively. 

  • OK... but then there must be an internal calibration issue, since the value given by the Android app is very different from the physical value, as indicated in my previous post. I think this difference goes well beyond normal measure uncertainty.
  • Hi,

    Just compared the iOS app with my program and Android app - the latter two agree, but the iOS app gives a higher value, which seems more in line with weather data. Here I'm getting 995 mBar from iOS, and 871 from Android, which seems similar to the difference you found.

    The source for the iOS app is supposed to be released soon, so we'll be able to see what is being done differently there.

    There is also a calibrate button in the iOS app, but this seems to be related to elevation estimation rather than calibrating the pressure.

  • OK, I should have paid closer attention to Jomar's answer since it gave the solution : there is no calibration needed, all you have to do is reorder the bytes in the right direction, using 3 bytes to code the pressure data. In Python I use the following code :

    rawP = (w[5]<<16)+(w[4]<<8)+w[3]   

    pressure = rawP / 100.0


    The 0x01 that I read from the sensor was the most significant byte of the pressure reading.


    Hope this helps.

    Nicolas

  • Hi Nicolas,
    I'm only getting total 4 bytes from barometer

    f9 78 48 c9

    So only two bytes seems to be related to pressure 
    C9: barometer MSB
    48: barometer LSB

    Can you tell me how can I process it to get real barometer pressure data ?

  • The CC2650 SensorTag provides 6 bytes of Barometer data. Either you are using a CC2541 SensorTag, or CC2650 SensorTag with pre-release firmware. Please provide the firmware version to allow us to investigate fiurther.

  • Device name : SensorTag 2.0
    Firmware revision : 2.0
    Software Revision : 1.20
    Hardware revision : 0.89 (Jan 31 2015)\x00
  • Please upgrade to the release firmware (1.00 or higher, version 1.00 included in the BLE Stack release). It can be done by either of:
    - Over-the-air, iOS SensorTag application
    - Over-the-air, Windows BLE Device Monitor
    - hard-wired using SmartRF06EB as a debugger
  • Thanks but you said to upgrade to 1.0 or higher and mine one was as advertised by SensorTag is 2.0 ?
  • I think you must be interpreting the data wrongly; only the Device Name you provided correspond, the other 3 have been swapped around. What kind of application are you using to read the data?
  • Yes you are right , earlier I was using my custom application now I used official sensortag app and firmware version was found to be 0.89 . OK I will upgrade the firmware and will let you know.
  • Dear TI-Team,

    the easiest would be to post a code snipped which does the job... we don't need a full sample app. There are at least 3-4 other threads on the same issue.

    Just a code snipped, that shows how you do it today in the delegate method didUpdateValueForCharacteristic...

    Thank you very much!

    Sascha

  • This is the code used in the SensorTag iOs application. Note that it requires that you upgrade the firmware to version 1.00:

    -(float) calcPressure:(NSData *)data {
    if (data.length < 4) return -0.0f;
    char scratchVal[data.length];
    [data getBytes:&scratchVal length:data.length];
    uint32_t pres = (scratchVal[3] & 0xff) | ((scratchVal[4] << 8) & 0xff00) | ((scratchVal[5] << 16) & 0xff0000);
    self.lastPress = (float)pres / 100.0f;
    return self.lastPress;
    }
  • Hi,

    I'm having similar issues. I have the SensorTag 2 (CC2650), FW rev. 1.01 (Mar 13 2015) which I've updated with the TI app.

    The barometer is returning 4 bytes, e.g. <08661475>

    I've converted these into UInt16 values, and thus the Pressure MSB/LSB = 7514h in the example above, which is decimal 29972.

    Therefore, the function above, submitted by Jomar, is not applicable, since scratchVal[5] does not exist. I have double checked my code by changing the check for <4 to <5 and sure enough, it returns zero, which confirms my statement, even though my console log, in XCode, already told me all I needed to know.

    This document was the latest I could find when searching online:

    processors.wiki.ti.com/.../BLE_SensorTag_GATT_Server.pdf

    which shows this for barometer data:

    0x51 81 0xAA41
    Barometer Data
    00:00:00:00
    RN
    TempLSB:TempMSB:PressureLSB:PressureMSB

    Am I being stupid? If so, where can I find a *comprehensive* document regarding the CC2650, and what formula would I apply to the number 29972 (decimal) to mbar, which is showing 1022.0 in the TI app (yes, it will be slightly different now that I've taken time to write this) ???


    Regards,

    Giulio
  • I upgraded firmware using iphone app and my issue solved . Did you try updating from iphone ?
  • No. This is not the problem. I'm not really interested in developing for a device that can be totally broken with a firmware update, and which said update can kill my code. However, there are serious discrepancies between the documentation, the answers offered on these forums, and the 'real world'.

    For instance, the 'solution' offered above, by Jomar, is false. I have the latest app version, and you may rest assured that Jomar's statement, that this is the code inside the current version of the IOS app, is 100% not true, for the following, logical reasons:

    I can run the official app, and see the services. My XCode project, which is robust, uses EXACTLY the same hardware, and is based on the official docs, shows the assertions claimed in these forums to be untrue. I am receiving four bytes of data, period.

    My questions remain the same, and remain un-answered...

    Regards,


    Giulio
  • For firmware revision 1.0 and above the data from the Barometer contains 6 bytes. See attached screen shots from BLE Device Monitor. If you run FW 1.01 and still get only 4 bytes you better check if any preprocessing is done to your data before you try the conversion. Also verify that the length of your received data is indeed 6. As for documentation we readily admit some shortcomings and we are continuously working to correct and improve the on-line documentation.

    This is the C++ conversion used in BLE Device Monitor for the 6 byte data format. You have to feed the 24-bit raw value to this function after making sure bits 24-31 are zero.

    double SensorTag::calcBmp280(quint32 rawValue)
    {
        return rawValue/ 100.0f;
    }

      

  • HI,

    Thanks for the reply. I'm calling Apple's

    - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error

    in the latest XCode, and for the latest version of IOS, and is most definitely returning an array which is four bytes in length. I shall investigate further. In the meantime, is there an OSX Yosemite version of Device Monitor?

    Thanks again for the reply.

    Giulio
  • Hi Guilio,

    1) Unfortunately I am not familiar with iOs/Apple at all, so I can only answer for the SensorTag firmware (which definitely returns 6 bytes). I would have to consult our iOs developer to get an authoritative answer on this one (he will be available again next week).
    2) The BLE Device Monitor is a Windows tool and you need a CC2541 USB dongle to use it.
  • Hi Jomar,

    I have fixed my bug, which was entirely my own fault, and feel I must come clean on here, lest I misled others having similar issues. I had blithely copied and pasted the UUIDs from an online example, and they were in error. This will teach me not to be so lazy again, and to thoroughly proof read examples obtained online.

    All is well, your routine above works perfectly, and I thank you for your advice and replies.

    Meantime, and not to distract from my own stupidity, is this document the latest and most comprehensive available: ?

    processors.wiki.ti.com/.../BLE_SensorTag_GATT_Server.pdf

    Thanks again, for helping out an idiot!

    Giulio
  • Hi Giulio,

    This happens to all of us, and as I said: our own SensorTag documentation still has some rought edges. The GATT table you found is actually from the CC2541 SensorTag without this being immediately clear. Please find attached the GATT table for the CC2650 SensorTag.

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>CC2650 SensorTag attribute table</title>
    <link rel=stylesheet type="text/css" href="attr.css" />
    </head>
    
    <body>
    <h1>CC2650 SensorTag attribute table</h1><h2>TI Base UUID: F000<b>XXXX</b>-0451-4000-B000-000000000000. 128 bit UUIDs are typed '<b>bold blue</b>'</h2><table><tbody><tr><th>Handle<br />(hex)</th><th>Handle<br />(dec)</th><th>Type<br />(hex)</th><th>Type (text)</th><th>Hex value</th><th>GATT Server<br />Permissions</th><th>Description/Value (text)</th></tr>
    <tr class="service"><td>0x1</td><td>1</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>0x1800</td><td>R</td><td>Generic Access Service</td></tr>
    <tr class="char"><td>0x2</td><td>2</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:03:00:00:2A</td><td>R</td><td>Device Name</td></tr>
    <tr class="data"><td>0x3</td><td>3</td><td class="short">0x2A00</td><td>Device Name</td><td>53:65:6E:73:6F:72:54:61:67:20:32:2E:30</td><td>R</td><td>SensorTag 2.0</td></tr>
    <tr class="char"><td>0x4</td><td>4</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:05:00:01:2A</td><td>R</td><td>Appearance</td></tr>
    <tr class="data"><td>0x5</td><td>5</td><td class="short">0x2A01</td><td>Appearance</td><td>00:00</td><td>R</td><td></td></tr>
    <tr class="char"><td>0x6</td><td>6</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:07:00:04:2A</td><td>R</td><td>Peripheral Preferred Connection Parameters</td></tr>
    <tr class="data"><td>0x7</td><td>7</td><td class="short">0x2A04</td><td>Peripheral Preferred Connection Parameters</td><td>50:00:A0:00:00:00:E8:03</td><td>R</td><td>P</td></tr>
    <tr class="service"><td>0x8</td><td>8</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>0x1801</td><td>R</td><td>Generic Attribute Service</td></tr>
    <tr class="char"><td>0x9</td><td>9</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>20:0A:00:05:2A</td><td>R</td><td>Service Changed</td></tr>
    <tr class="data"><td>0xA</td><td>10</td><td class="short">0x2A05</td><td>Service Changed</td><td></td><td>I</td><td></td></tr>
    <tr class="data"><td>0xB</td><td>11</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>00:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="service"><td>0xC</td><td>12</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>0x180A</td><td>R</td><td>Device Information Service</td></tr>
    <tr class="char"><td>0xD</td><td>13</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:0E:00:23:2A</td><td>R</td><td>System ID</td></tr>
    <tr class="data"><td>0xE</td><td>14</td><td class="short">0x2A23</td><td>System ID</td><td>85:A9:71:00:00:84:BE:C4</td><td>R</td><td>q</td></tr>
    <tr class="char"><td>0xF</td><td>15</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:10:00:24:2A</td><td>R</td><td>Model Number String</td></tr>
    <tr class="data"><td>0x10</td><td>16</td><td class="short">0x2A24</td><td>Model Number String</td><td>43:43:32:36:35:30:20:53:65:6E:73:6F:72:54:61:67:00</td><td>R</td><td>CC2650 SensorTag</td></tr>
    <tr class="char"><td>0x11</td><td>17</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:12:00:25:2A</td><td>R</td><td>Serial Number String</td></tr>
    <tr class="data"><td>0x12</td><td>18</td><td class="short">0x2A25</td><td>Serial Number String</td><td>4E:2E:41:2E:00</td><td>R</td><td>N.A.</td></tr>
    <tr class="char"><td>0x13</td><td>19</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:14:00:26:2A</td><td>R</td><td>Firmware Revision String</td></tr>
    <tr class="data"><td>0x14</td><td>20</td><td class="short">0x2A26</td><td>Firmware Revision String</td><td>31:2E:30:31:20:28:4D:61:72:20:31:33:20:32:30:31:35:29:00</td><td>R</td><td>1.01 (Mar 13 2015)</td></tr>
    <tr class="char"><td>0x15</td><td>21</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:16:00:27:2A</td><td>R</td><td>Hardware Revision String</td></tr>
    <tr class="data"><td>0x16</td><td>22</td><td class="short">0x2A27</td><td>Hardware Revision String</td><td>50:43:42:20:31:2E:32:00</td><td>R</td><td>PCB 1.2</td></tr>
    <tr class="char"><td>0x17</td><td>23</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:18:00:28:2A</td><td>R</td><td>Software Revision String</td></tr>
    <tr class="data"><td>0x18</td><td>24</td><td class="short">0x2A28</td><td>Software Revision String</td><td>4E:2E:41:2E:00</td><td>R</td><td>N.A.</td></tr>
    <tr class="char"><td>0x19</td><td>25</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:1A:00:29:2A</td><td>R</td><td>Manufacturer Name String</td></tr>
    <tr class="data"><td>0x1A</td><td>26</td><td class="short">0x2A29</td><td>Manufacturer Name String</td><td>54:65:78:61:73:20:49:6E:73:74:72:75:6D:65:6E:74:73:00</td><td>R</td><td>Texas Instruments</td></tr>
    <tr class="char"><td>0x1B</td><td>27</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:1C:00:2A:2A</td><td>R</td><td>IEEE 11073-20601 Regulatory Certification Data List</td></tr>
    <tr class="data"><td>0x1C</td><td>28</td><td class="short">0x2A2A</td><td>IEEE 11073-20601 Regulatory Certification Data List</td><td>FE:00:65:78:70:65:72:69:6D:65:6E:74:61:6C</td><td>R</td><td>experimental</td></tr>
    <tr class="char"><td>0x1D</td><td>29</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>02:1E:00:50:2A</td><td>R</td><td>PnP ID</td></tr>
    <tr class="data"><td>0x1E</td><td>30</td><td class="short">0x2A50</td><td>PnP ID</td><td>01:0D:00:00:00:10:01</td><td>R</td><td></td></tr>
    <tr class="service"><td>0x1F</td><td>31</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>F000AA00-0451-4000-B000-000000000000</td><td>R</td><td>IR Temperature Service</td></tr>
    <tr class="char"><td>0x20</td><td>32</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>12:21:00:00:00:00:00:00:00:00:B0:00:40:51:04:01:AA:00:F0</td><td>R</td><td>IR Temperature Data</td></tr>
    <tr class="data"><td>0x21</td><td>33</td><td class="long">0xAA01</td><td>IR Temperature Data</td><td>00:00:00:00</td><td>RN</td><td>ObjectLSB:ObjectMSB:AmbientLSB:AmbientMSB</td></tr>
    <tr class="data"><td>0x22</td><td>34</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>01:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="char"><td>0x23</td><td>35</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:24:00:00:00:00:00:00:00:00:B0:00:40:51:04:02:AA:00:F0</td><td>R</td><td>IR Temperature Config</td></tr>
    <tr class="data"><td>0x24</td><td>36</td><td class="long">0xAA02</td><td>IR Temperature Config</td><td>00</td><td>RW</td><td>Write "01" to start Sensor and Measurements, "00" to put to sleep</td></tr>
    <tr class="char"><td>0x25</td><td>37</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:26:00:00:00:00:00:00:00:00:B0:00:40:51:04:03:AA:00:F0</td><td>R</td><td>IR Temperature Period</td></tr>
    <tr class="data"><td>0x26</td><td>38</td><td class="long">0xAA03</td><td>IR Temperature Period</td><td>64</td><td>RW</td><td>Period = [Input*10] ms, (lower limit 300 ms), default 1000 ms</td></tr>
    <tr class="service"><td>0x27</td><td>39</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>F000AA20-0451-4000-B000-000000000000</td><td>R</td><td>Humidity Service</td></tr>
    <tr class="char"><td>0x28</td><td>40</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>12:29:00:00:00:00:00:00:00:00:B0:00:40:51:04:21:AA:00:F0</td><td>R</td><td>Humidity Data</td></tr>
    <tr class="data"><td>0x29</td><td>41</td><td class="long">0xAA21</td><td>Humidity Data</td><td>00:00:00:00</td><td>RN</td><td>TempLSB:TempMSB:HumidityLSB:HumidityMSB</td></tr>
    <tr class="data"><td>0x2A</td><td>42</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>01:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="char"><td>0x2B</td><td>43</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:2C:00:00:00:00:00:00:00:00:B0:00:40:51:04:22:AA:00:F0</td><td>R</td><td>Humidity Config</td></tr>
    <tr class="data"><td>0x2C</td><td>44</td><td class="long">0xAA22</td><td>Humidity Config</td><td>00</td><td>RW</td><td>Write "01" to start measurements, "00" to stop</td></tr>
    <tr class="char"><td>0x2D</td><td>45</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:2E:00:00:00:00:00:00:00:00:B0:00:40:51:04:23:AA:00:F0</td><td>R</td><td>Humidity Period</td></tr>
    <tr class="data"><td>0x2E</td><td>46</td><td class="long">0xAA23</td><td>Humidity Period</td><td>64</td><td>RW</td><td>Period = [Input*10] ms, (lower limit 100 ms), default 1000 ms</td></tr>
    <tr class="service"><td>0x2F</td><td>47</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>F000AA40-0451-4000-B000-000000000000</td><td>R</td><td>Barometer Service</td></tr>
    <tr class="char"><td>0x30</td><td>48</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>12:31:00:00:00:00:00:00:00:00:B0:00:40:51:04:41:AA:00:F0</td><td>R</td><td>Barometer Data</td></tr>
    <tr class="data"><td>0x31</td><td>49</td><td class="long">0xAA41</td><td>Barometer Data</td><td>00:00:00:00:00:00</td><td>RN</td><td>TempLSB:TempMSB(:TempEXt):PressureLSB:PressureMSB(:PressureExt). If the length is 6 bytes the extension byte is included.</td></tr>
    <tr class="data"><td>0x32</td><td>50</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>01:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="char"><td>0x33</td><td>51</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:34:00:00:00:00:00:00:00:00:B0:00:40:51:04:42:AA:00:F0</td><td>R</td><td>Barometer Configuration</td></tr>
    <tr class="data"><td>0x34</td><td>52</td><td class="long">0xAA42</td><td>Barometer Configuration</td><td>00</td><td>RW</td><td>Write "01" to start Sensor and Measurements, "00" to put to sleep, "02" to read calibration values from sensor</td></tr>
    <tr class="char"><td>0x35</td><td>53</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:36:00:00:00:00:00:00:00:00:B0:00:40:51:04:44:AA:00:F0</td><td>R</td><td>Barometer Period</td></tr>
    <tr class="data"><td>0x36</td><td>54</td><td class="long">0xAA44</td><td>Barometer Period</td><td>64</td><td>RW</td><td>Period = [Input*10] ms, (lower limit 100 ms), default 1000 ms</td></tr>
    <tr class="service"><td>0x37</td><td>55</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>F000AA80-0451-4000-B000-000000000000</td><td>R</td><td>Movement Service</td></tr>
    <tr class="char"><td>0x38</td><td>56</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>12:39:00:00:00:00:00:00:00:00:B0:00:40:51:04:81:AA:00:F0</td><td>R</td><td>Movement Data</td></tr>
    <tr class="data"><td>0x39</td><td>57</td><td class="long">0xAA81</td><td>Movement Data</td><td>00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00</td><td>RN</td><td>GXLSB:GXMSB:GYLSB:GYMSB:GZLSB:GZMSB, AXLSB:AXMSB:AYLSB:AYMSB:AZLSB:AZMSB</td></tr>
    <tr class="data"><td>0x3A</td><td>58</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>01:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="char"><td>0x3B</td><td>59</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:3C:00:00:00:00:00:00:00:00:B0:00:40:51:04:82:AA:00:F0</td><td>R</td><td>Movement Config</td></tr>
    <tr class="data"><td>0x3C</td><td>60</td><td class="long">0xAA82</td><td>Movement Config</td><td>00:02</td><td>RW</td><td>Axis enable bits:gyro-z=0,gyro-y,gyro-x,acc-z=3,acc-y,acc-x,mag=6 Range: bit 8,9 </td></tr>
    <tr class="char"><td>0x3D</td><td>61</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:3E:00:00:00:00:00:00:00:00:B0:00:40:51:04:83:AA:00:F0</td><td>R</td><td>Movement Period</td></tr>
    <tr class="data"><td>0x3E</td><td>62</td><td class="long">0xAA83</td><td>Movement Period</td><td>64</td><td>RW</td><td>Period = [Input*10]ms (lower limit 100ms), default 1000ms</td></tr>
    <tr class="service"><td>0x3F</td><td>63</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>F000AA70-0451-4000-B000-000000000000</td><td>R</td><td>Luxometer Service</td></tr>
    <tr class="char"><td>0x40</td><td>64</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>12:41:00:00:00:00:00:00:00:00:B0:00:40:51:04:71:AA:00:F0</td><td>R</td><td>Luxometer Data</td></tr>
    <tr class="data"><td>0x41</td><td>65</td><td class="long">0xAA71</td><td>Luxometer Data</td><td>00:00</td><td>RN</td><td>LSB:MSB</td></tr>
    <tr class="data"><td>0x42</td><td>66</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>01:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="char"><td>0x43</td><td>67</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:44:00:00:00:00:00:00:00:00:B0:00:40:51:04:72:AA:00:F0</td><td>R</td><td>Luxometer Config</td></tr>
    <tr class="data"><td>0x44</td><td>68</td><td class="long">0xAA72</td><td>Luxometer Config</td><td>00</td><td>RW</td><td>Write "01" to start Sensor and Measurements, "00" to put to sleep</td></tr>
    <tr class="char"><td>0x45</td><td>69</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:46:00:00:00:00:00:00:00:00:B0:00:40:51:04:73:AA:00:F0</td><td>R</td><td>Luxometer Period</td></tr>
    <tr class="data"><td>0x46</td><td>70</td><td class="long">0xAA73</td><td>Luxometer Period</td><td>50</td><td>RW</td><td>Period = [Input*10]ms (lower limit 1000ms), default 2000ms</td></tr>
    <tr class="service"><td>0x47</td><td>71</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>0xFFE0</td><td>R</td><td>Simple Keys Service</td></tr>
    <tr class="char"><td>0x48</td><td>72</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>10:49:00:E1:FF</td><td>R</td><td>Key press state</td></tr>
    <tr class="data"><td>0x49</td><td>73</td><td class="short">0xFFE1</td><td>Key press state</td><td></td><td>N</td><td></td></tr>
    <tr class="data"><td>0x4A</td><td>74</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>01:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="data"><td>0x4B</td><td>75</td><td class="short">0x2901</td><td>Characteristic User Description</td><td>4B:65:79:20:50:72:65:73:73:20:53:74:61:74:65</td><td>R</td><td>Key Press State</td></tr>
    <tr class="service"><td>0x4C</td><td>76</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>F000AA64-0451-4000-B000-000000000000</td><td>R</td><td>IO Service</td></tr>
    <tr class="char"><td>0x4D</td><td>77</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:4E:00:00:00:00:00:00:00:00:B0:00:40:51:04:65:AA:00:F0</td><td>R</td><td>IO Data</td></tr>
    <tr class="data"><td>0x4E</td><td>78</td><td class="long">0xAA65</td><td>IO Data</td><td>7F</td><td>RW</td><td>Local and remote mode: bit 0 - red led; bit 1 - green led; bit 2 - buzzer. In test mode: sensor self test result (exp. 0x5F)</td></tr>
    <tr class="char"><td>0x4F</td><td>79</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:50:00:00:00:00:00:00:00:00:B0:00:40:51:04:66:AA:00:F0</td><td>R</td><td>IO Config</td></tr>
    <tr class="data"><td>0x50</td><td>80</td><td class="long">0xAA66</td><td>IO Config</td><td>00</td><td>RW</td><td>0:local mode; 1:remote mode; 2:test mode</td></tr>
    <tr class="service"><td>0x51</td><td>81</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>F000AC00-0451-4000-B000-000000000000</td><td>R</td><td>Register Service</td></tr>
    <tr class="char"><td>0x52</td><td>82</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>1A:53:00:00:00:00:00:00:00:00:B0:00:40:51:04:01:AC:00:F0</td><td>R</td><td>Register Data</td></tr>
    <tr class="data"><td>0x53</td><td>83</td><td class="long">0xAC01</td><td>Register Data</td><td>00:00</td><td>RWN</td><td>Data from serial device, variable length (see Register Address)</td></tr>
    <tr class="data"><td>0x54</td><td>84</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>00:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="char"><td>0x55</td><td>85</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:56:00:00:00:00:00:00:00:00:B0:00:40:51:04:02:AC:00:F0</td><td>R</td><td>Register Address</td></tr>
    <tr class="data"><td>0x56</td><td>86</td><td class="long">0xAC02</td><td>Register Address</td><td>02:02:00:00:00</td><td>RW</td><td>length(byte, max 16);internal addr (1 to 4 bytes)</td></tr>
    <tr class="char"><td>0x57</td><td>87</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>0A:58:00:00:00:00:00:00:00:00:B0:00:40:51:04:03:AC:00:F0</td><td>R</td><td>Register Device ID</td></tr>
    <tr class="data"><td>0x58</td><td>88</td><td class="long">0xAC03</td><td>Register Device ID</td><td>00:44</td><td>RW</td><td>byte 1 (interface): 0=I2C0,1=I2C1,2=SPI1,3=SPI2,4=SPI3,5=MCU; byte 2: device addr</td></tr>
    <tr class="service"><td>0x59</td><td>89</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>F000CCC0-0451-4000-B000-000000000000</td><td>R</td><td>Connection Control Service</td></tr>
    <tr class="char"><td>0x5A</td><td>90</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>12:5B:00:00:00:00:00:00:00:00:B0:00:40:51:04:C1:CC:00:F0</td><td>R</td><td>Connection Parameters</td></tr>
    <tr class="data"><td>0x5B</td><td>91</td><td class="long">0xCCC1</td><td>Connection Parameters</td><td>06:00:00:00:64:00</td><td>RN</td><td>ConnInterval,SlaveLatency,SupervisionTimeout (2 bytes each)</td></tr>
    <tr class="data"><td>0x5C</td><td>92</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>00:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="char"><td>0x5D</td><td>93</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>08:5E:00:00:00:00:00:00:00:00:B0:00:40:51:04:C2:CC:00:F0</td><td>R</td><td>Request Connection Parameters</td></tr>
    <tr class="data"><td>0x5E</td><td>94</td><td class="long">0xCCC2</td><td>Request Connection Parameters</td><td></td><td>W</td><td>MinConnInterval,MaxConnInterval,SlaveLatency,SupervisionTimeout (2 bytes each)</td></tr>
    <tr class="char"><td>0x5F</td><td>95</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>08:60:00:00:00:00:00:00:00:00:B0:00:40:51:04:C3:CC:00:F0</td><td>R</td><td>Disconnect request</td></tr>
    <tr class="data"><td>0x60</td><td>96</td><td class="long">0xCCC3</td><td>Disconnect request</td><td></td><td>W</td><td>Change the value to disconnect</td></tr>
    <tr class="service"><td>0x61</td><td>97</td><td class="short">0x2800</td><td>GATT Primary Service Declaration</td><td>F000FFC0-0451-4000-B000-000000000000</td><td>R</td><td>OAD Service</td></tr>
    <tr class="char"><td>0x62</td><td>98</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>1C:63:00:00:00:00:00:00:00:00:B0:00:40:51:04:C1:FF:00:F0</td><td>R</td><td>OAD Image Identify</td></tr>
    <tr class="data"><td>0x63</td><td>99</td><td class="long">0xFFC1</td><td>OAD Image Identify</td><td></td><td>WN</td><td>Write '0' to identify image type 'A', '1' to identify 'B'. Data in notfication 8 bytes: image type (2), size/4 (2), user data (4).</td></tr>
    <tr class="data"><td>0x64</td><td>100</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>01:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="data"><td>0x65</td><td>101</td><td class="short">0x2901</td><td>Characteristic User Description</td><td>49:6D:67:20:49:64:65:6E:74:69:66:79</td><td>R</td><td>Img Identify</td></tr>
    <tr class="char"><td>0x66</td><td>102</td><td class="short">0x2803</td><td>GATT Characteristic Declaration</td><td>1C:67:00:00:00:00:00:00:00:00:B0:00:40:51:04:C2:FF:00:F0</td><td>R</td><td>OAD Image Block</td></tr>
    <tr class="data"><td>0x67</td><td>103</td><td class="long">0xFFC2</td><td>OAD Image Block</td><td></td><td>WN</td><td>Image block (18 bytes). Block no. (2 bytes), OAD image block (16 bytes)</td></tr>
    <tr class="data"><td>0x68</td><td>104</td><td class="short">0x2902</td><td>Client Characteristic Configuration</td><td>01:00</td><td>RW</td><td>Write "01:00" to enable notifications, "00:00" to disable</td></tr>
    <tr class="data"><td>0x69</td><td>105</td><td class="short">0x2901</td><td>Characteristic User Description</td><td>49:6D:67:20:42:6C:6F:63:6B</td><td>R</td><td>Img Block</td></tr>
    </body></html>
    

    body
    {
    	background-color:#bbc;
    	font-family:"Courier";
    	font-size:12px;
    }
    
    
    h1,h2
    {
    	text-align:center;
    }
    
    h2
    {
    	font-size:12px;
    }
    
    table
    {
    	background-color:#667;
    	margin:0 auto;
    	padding:0;
    	width:90%;
    }
    
    th 
    {
    	text-align:center;
    	color:white;
    	background-color:#333;
    }
    
    tr
    {
    	background-color: #ddd;
    }
    
    tr.service
    {
    	color: black;
    	background-color: #ff0;
    }
    
    tr.char
    {
    	color:black;
    	background-color: #cff;
    }
    
    td
    {
    	padding:3px;
    }
    
    td.long,b
    {
    	font-weight:bold;
    	color:blue;
    }
    
    th:nth-of-type(5)
    {
    	width:28%;
    }
    
    td:nth-of-type(3)
    {
    	background-color:#cff;
    }
    
    td:nth-of-type(1),td:nth-of-type(2)
    {
    	background-color:#ff0;
    }
    

  • The version of the Android App that is on git.ti.com and on the Google Play store isn't calculating the barometric pressure correctly.  I cloned the repo and made updated it to use the code above and it now generates the correct barometric pressure.

    I have a merge request in to get the source updated.  Until the merge request is accepted my cloned repo is located here git@git.ti.com:~digitalhack/sensortag-20-android/digitalhacks-sensortag-20-android.git.  The updated copy is in the BarometerFix branch.

    digitalhack

  • Thanks. The Android source is outdated, there will be a new version soon.