TI Sensor Tag - Gyroscope

Discuss mobile apps for Texas Instruments products.
User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: TI Sensor Tag - Gyroscope

Postby micke » 22:40, 08 Oct 2014

Hi Klemens,

10 updates per second sounds very slow. Is this for the gyroscope?

Will take a look and investigate. I have only tested on an iPad and an iPhone, it looked much faster than that, will do some measurements. May I ask, did you set the update rate? To what value?

Many thanks for sharing the iOS app!

Very best, Mikael

klemens2014
Posts: 12
Joined: 16:22, 17 Sep 2014

Re: TI Sensor Tag - Gyroscope

Postby klemens2014 » 04:40, 09 Oct 2014

I had a curious side effect yesterday. I was suspect that the slow readings are due to writing to the file and so I changed writing to a buffered writing gathering some 100 measurements and then write. Once I did this the measurement rate was extremly fast, nearly 100 measures per second. I have two sensors, so I switched between them. And after I did this the measures went down again - for both. Really mysterious.

I now think there is some nasty bug in the code. Although the barometer stuff is curious. Although I follow the formula and reading the characteristics the value of pressure is still wrong.

The latest version for Android is in, iOS I had no time to update.

Remark: newest version for iOS and Android online.

I found this [url]processors.wiki.ti.com/index.php/SensorTag_User_Guide[/url] . Maybe I have to increase the connection speed?

"Operation: On start-up, the SensorTag is advertising with a 100ms interval. The connection is established by a Central Device and the sensors can then be configured to provide measurement data. " Will give it a try...

Note: This seems to be the reason for the slow measurement rate. I started another TI Sensor tool, set there the sensor rates to maximum, closed it. Next I started my cordova app and then the measurements went up to about 30 per seconds. Need now to add to this feature to the code...

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: TI Sensor Tag - Gyroscope

Postby micke » 19:03, 28 Oct 2014

I am slow to respond here, but did it work to increase the update rate?

I am planning to do more work on the SensorTag over the coming months, lets stay in touch.

Best regards, Mikael

klemens2014
Posts: 12
Joined: 16:22, 17 Sep 2014

Re: TI Sensor Tag - Gyroscope

Postby klemens2014 » 19:17, 28 Oct 2014

I think I have found the reason for the slow rates. I should have studied your code. You divide the intervall by 10 to get it into the 10ms unit rates. When i used 100 for the intervall on my iOS version it became quite fast. Same with a vlaue of 10, curious. I'll try to check if this applies to Android too.

A general problem i have found on Android that the Bluetooth stack there is quite unstable. Connecting there makes a lot of problems.

BTW: Maybe we can worj together on adding conversion to real rates from the raw data? I still have trouibles with the barometer stuff.

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: TI Sensor Tag - Gyroscope

Postby micke » 20:01, 28 Oct 2014

Hi Klemens,

Sorry for the confusion regarding the unit of the update interval! The rationale was that milliseconds is more widely used, but for people who read up on the TI SensorTag documentation they use 10 ms units. Should document all this much more clearly!

We have also experienced some instability on Android. What Android device/version are you using?

Lets stay in touch.

Best regards, Mikael

ardiri
Posts: 58
Joined: 16:13, 28 May 2014

Re: TI Sensor Tag - Gyroscope

Postby ardiri » 15:05, 07 Nov 2014

i put a bit of work into this earlier (as part of a cleanup) - will let the guys review it later on; but these are the routines i implemented for data extraction:

Code: Select all

    function getInt8Value(data, offset)
    {
      return data[offset]
    }

    function getUInt8Value(data, offset)
    {
      var x = getInt8Value(data, offset)
      if (x & 0x80) x = x + 256;
      return x
    }

    function getInt16Value(data, offset)
    {
      return (getInt8Value(data, offset+1) << 8) + getUInt8Value(data, offset)
    }

    function getUInt16Value(data, offset)
    {
      return (getUInt8Value(data, offset+1) << 8) + getUInt8Value(data, offset)
    }


this simplifies things a lot and means it is much easier to simply use the documentation provided by TI on their website to implement the various raw data sensor conversion into values that make sense. an example of one of the new routines - working with the humidity callback:

Code: Select all

  function humidityHandler(data)
  {
        var string = 'raw: 0x' + RawToHex(data[0],2)
                               + RawToHex(data[1],2)
                               + RawToHex(data[2],2)
                               + RawToHex(data[3],2)

        // calculate the humidity temperature (C and F)
        var tc = -46.85 + 175.72 / 65536.0 * getInt16Value(data, 0)
        var tf = (tc * 9 / 5) + 32

        // calculate the relative humidity
        var h = -6.0 + 125.00 / 65536.0 * (getInt16Value(data, 2) & ~0x03)

        // prepare the information to display
        string = '<tt>'
                 + string + '<br/>'
                 + (tc >= 0 ? '+' : '') + tc.toFixed(2) + 'C '
                    + '(' + (tf >= 0 ? '+' : '') + tf.toFixed(2) + 'F)' + '<br/>'
                 + (h >= 0 ? '+' : '') + h.toFixed(2) + '% RH' + '<br/>'
                 + '</tt>'

        // update the value displayed
        displayValue('HumidityData', string)
  }


which gives a great looking set of information - i did not have time yet to look into obtaining the calibration data for the barometer sensor so if you managed to get that code up and running, provide it here and we can see how we can integrate it into our examples. i have attached how the current screenshots of version i modified looks like - hopefully we can have this included in our 1.0.0 release examples
Attachments
ti-sensor-screenshot2.jpg
SensorTag Sensors ScreenShot 2
ti-sensor-screenshot2.jpg (135.87 KiB) Viewed 33994 times
ti-sensor-screenshot1.jpg
SensorTag Sensors ScreenShot 1
ti-sensor-screenshot1.jpg (132.63 KiB) Viewed 33994 times
// Aaron
Chief Technology Officer
Evothings AB http://www.evothings.com/


Return to “Texas Instruments”

Who is online

Users browsing this forum: No registered users and 13 guests