TI CC2650/MPU-9250 acceleration sensor range

Discuss mobile apps for Texas Instruments products.
Juergen
Posts: 4
Joined: 14:26, 31 Dec 2015

TI CC2650/MPU-9250 acceleration sensor range

Postby Juergen » 14:35, 31 Dec 2015

I just stumbled across your website and downloaded your Evothings Workbench.
It is a joy to work with this wonderful piece of software - thank you!

I am doing my first steps with the TI CC2650 and I am wondering how to set up
the acceleration sensor range properly with javascript.

In den documentation I found

AFS_SEL=0 2g
AFS_SEL=1 4g
AFS_SEL=2 8g
AFS_SEL=3 16g

Configuration AA82* R/W 2 One bit for each gyro and accelerometer axis (6), magnetometer (1), wake-on-motion enable (1), accelerometer range (2). Write any bit combination top enable the desired features. Writing 0x0000 powers the unit off.
The configuration characteristic is used to decide which data (axis) should be activated, if wake-on-motion is to be enabled, and the range of the accelerometer (2, 4, 8 and 16 G).
Bits Usage
0 Gyroscope z axis enable
1 Gyroscope y axis enable
2 Gyroscope x axis enable
3 Accelerometer z axis enable
4 Accelerometer y axis enable
5 Accelerometer x axis enable
6 Magnetometer enable (all axes)
7 Wake-On-Motion Enable
8:9 Accelerometer range (0=2G, 1=4G, 2=8G, 3=16G)
10:15 Not used

Could anyone help me how to set and switch the range within javascript?

Thanks and kind regards,
Good slide ;-)

Juergen

Juergen
Posts: 4
Joined: 14:26, 31 Dec 2015

Re: TI CC2650/MPU-9250 acceleration sensor range

Postby Juergen » 18:20, 31 Dec 2015

instance.movementCallback = function(fun, interval, sensors)

It looks like 'sensors' supports the first 8 Bits only :o ? How to set the next 8 Bits?

Thanks in advance for any advice.

Kind regards,

Juergen

gokr
Posts: 13
Joined: 12:50, 02 Nov 2015

Re: TI CC2650/MPU-9250 acceleration sensor range

Postby gokr » 13:43, 02 Jan 2016

Hi!

Just wanted to say we do track the forum carefully, but... I don't know anything about this. But I have forwarded internally to see if anyone can help :)

regards, Göran

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

Re: TI CC2650/MPU-9250 acceleration sensor range

Postby micke » 21:21, 02 Jan 2016

Hi Juergen,

The high-level SensorTag library used by for instance the "TI SensorTag Accelerometer" example app is hard-coded internally for which bits are set when enabling motion sensors.

Here the 3-axis accelerometer + 3-axis gyro + magnetometer is turned with the byte value 127:

Code: Select all

         instance.movementCallback(
            function(data)
            {
               instance.accelerometerFun && instance.accelerometerFun(data)
               instance.magnetometerFun && instance.magnetometerFun(data)
               instance.gyroscopeFun && instance.gyroscopeFun(data)
            },
            interval,
            127)


https://github.com/evothings/evothings- ... 50.js#L137

And here the byte value is used, passed as you write in variable "sensors":

Code: Select all

      instance.movementCallback = function(fun, interval, sensors)
      {
         // Callback for all movement sensors (accelerometer, gyroscope, magnetometer).
         instance.movementFun = fun

          // Set the config that turns on the needed sensors.
         instance.movementConfig = [sensors, 0]
         instance.movementInterval = interval
         instance.requiredServices.push(instance.MOVEMENT.SERVICE)

         return instance
      }


https://github.com/evothings/evothings- ... 50.js#L162

Have not tested this myself, but I would guess you can add another byte value for the next byte, for example in a variable "sensors2", like this:

Code: Select all

      instance.movementCallback = function(fun, interval, sensors1, sensors2)
      {
         // Callback for all movement sensors (accelerometer, gyroscope, magnetometer).
         instance.movementFun = fun

          // Set the config that turns on the needed sensors.
         instance.movementConfig = [sensors1, sensors2 || 0]
         instance.movementInterval = interval
         instance.requiredServices.push(instance.MOVEMENT.SERVICE)

         return instance
      }


Using logical OR to set zero as second value in the config value array in case it is omitted (is undefined/null).

Have not tested this, so not sure it will work!

Here the actual buffer sent to the SensorTag is created:

Code: Select all

new Uint8Array(configValue),


https://github.com/evothings/evothings- ... le.js#L761

Hope this is of some help! We should extend the SensorTag library to support the functionality you request. Please feel free to provide advice/suggestion/pull requests.

Best regards, Mikael

Juergen
Posts: 4
Joined: 14:26, 31 Dec 2015

Re: TI CC2650/MPU-9250 acceleration sensor range

Postby Juergen » 16:22, 03 Jan 2016

Hi Mikael,

Thanks for thinking along.

It's a bit weird. I have tried several approaches including your suggestion.

My impression is that the second byte at

Configuration AA82* R/W 2 One bit for each gyro and accelerometer axis (6), magnetometer (1), wake-on-motion enable (1), accelerometer range (2). Write any bit combination top enable the desired features. Writing 0x0000 powers the unit off.

is never written.

Reason:

This

var divisors = {x: -16384.0/4, y: 16384.0/4, z: -16384.0/4}

are to change in case you alter the accelerator range
(MPU-9250 Product Specification , page 9). With these divisors
the sensor is in 8G mode. Switching to i.e. 4G should result in

var divisors = {x: -16384.0/2, y: 16384.0/2, z: -16384.0/2}

I didn't change this for testing purposes, so the g values should
be different with changing the range - but they are always the same!

Very strange.

Kind regards and thanks again,

Juergen

Juergen
Posts: 4
Joined: 14:26, 31 Dec 2015

Re: TI CC2650/MPU-9250 acceleration sensor range

Postby Juergen » 12:45, 04 Jan 2016

Just to clarify, I forgot this:

Line 319 in tisensortag-ble-cc2650.js was:

var divisors = {x: -16384.0, y: 16384.0, z: -16384.0}

I changed this to:

var divisors = {x: -16384.0/4, y: 16384.0/4, z: -16384.0/4}

to get the correct values for 8g range (default).

Sorry for the confusion.

Setting the second byte for g-range still remains unclear.

Kind regards,

Juergen


Return to “Texas Instruments”

Who is online

Users browsing this forum: No registered users and 10 guests