Parallel read data from multi tisensortag

Discuss mobile apps for Texas Instruments products.
lapserdaq
Posts: 7
Joined: 17:59, 23 Sep 2015

Parallel read data from multi tisensortag

Postby lapserdaq » 18:33, 23 Sep 2015

Hi,
i've managed to scan, connect and read data from sensor's services in Angular, but would it be possible somehow to connect and read from multi sensortag parallel eg.

sensortag
.temperatureCallback(temperatureHandler, 1000)
.accelerometerCallback(accelerometerHandler, 1000)
.connectToDevice($scope.devices[i].deviceInfo);

Those callback returns values in circle with specified time.
How can i read data from next device in the same time ? Is it possible to accomplish this with javascript api at all ?
I'm aware that JS processes remains in one thread. I'm trying to simulate parallel tasks using the setTimeout() or setInterval(), but with no luck.
Maybe you can help me somehow ?

One more thing, i've noticed that there's a problem with accelerometer and gyroscope service, it returns values more or less 10 times and stops broadcasting.
Same story is on my app and your official Evothings apps (eg. TISensorTag Sensors), that i've downloaded from Google Play.
I'm using CC2650 Sensors

ps.
Love the job you guys doing :)

Cheers
Michal

Fredrik
Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: Parallel read data from multi tisensortag

Postby Fredrik » 18:54, 23 Sep 2015

I haven't tried it, so I don't know if it can work, but what you would want to do is add another sensortag instance (evothings.tisensortag.createInstance), but do scanning on only one of them, wait for two different devices, then connect each instance to a device.

We're aware of the problem with the accelerometer service. It's a bug in the TI firmware. We can't fix it. You might try upgrading the firmware on your tag using the TI's own sensortag app.

alex
Posts: 92
Joined: 00:59, 19 Nov 2013

Re: Parallel read data from multi tisensortag

Postby alex » 19:12, 23 Sep 2015

As I remember, downloading TI's own app for the cc2650 tag brings about a OTA firmware upgrade option once you connect it to the tag, that's probably the easiest way to go about it. It works for iOS, we've done that a couple of times in the past.

Here is a good starter link for altering other properties, like having the tag advertise indefinitely rather than the 2 minutes after a button press, altering the signal strength (in a trade-off for battery life): http://stackoverflow.com/questions/2209 ... definitely

lapserdaq
Posts: 7
Joined: 17:59, 23 Sep 2015

Re: Parallel read data from multi tisensortag

Postby lapserdaq » 20:27, 23 Sep 2015

Ok, sensors firmware updated, accelerometer seems working fine now. Thanks.
Still strugling with reading from multi sensors. I'll try manage it with your suggest. If someone had done it please let me know.

lapserdaq
Posts: 7
Joined: 17:59, 23 Sep 2015

Re: Parallel read data from multi tisensortag

Postby lapserdaq » 02:16, 25 Sep 2015

Guys would it be possible to add to data returned from callbacks (eg. from temperature, accelelometer) information about device let's say address ?

So in case of temperature it might have look :

before change:
data = [96, 11, 4, 14]

after change:
data = [96, 11, 4, 14], "68:C9:0B:17:BF:03"

That would solve problem with parallel reads from couple sensors.

Fredrik
Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: Parallel read data from multi tisensortag

Postby Fredrik » 11:04, 25 Sep 2015

You should be able to add enough state to your callback to know which device it was called on.

For example, if your one-sensor init is like this:

Code: Select all

function initialiseSensorTag() {
   sensortag = evothings.tisensortag.createInstance(
      evothings.tisensortag.CC2650_BLUETOOTH_SMART)

   sensortag
      .statusCallback(statusHandler)
      .errorCallback(errorHandler)
      .temperatureCallback(temperatureHandler, 1000)
}


Then your multi-sensor init could be like this:

Code: Select all

function initialiseSensorTag(tagId) {
   sensortag = evothings.tisensortag.createInstance(
      evothings.tisensortag.CC2650_BLUETOOTH_SMART)

   sensortag
      .statusCallback(statusHandler)
      .errorCallback(errorHandler)
      .temperatureCallback(function(data) { temperatureHandler2(data, tagId); }, 1000)
}

Note the addition of the "tagId".

lapserdaq
Posts: 7
Joined: 17:59, 23 Sep 2015

Re: Parallel read data from multi tisensortag

Postby lapserdaq » 20:52, 28 Sep 2015

Great, i did something similar, works as well.
Thank you !


Return to “Texas Instruments”

Who is online

Users browsing this forum: No registered users and 4 guests