IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.58k stars 490 forks source link

Reading Accelerometer Data from SensorTag CC2650 #491

Open goru89 opened 2 years ago

goru89 commented 2 years ago

I am working on a project which involves reading accelerometer data from the SensorTag using Python script from Raspberry PI. I am using BluePy library to do the same. But it seems the data I am fetching is wrong after conversion to 'g' terms when I compare with the data I get on smartphone (which seems to be right). So, I just wanted to confirm I am doing everything right. I am referring

https://usermanual.wiki/Document/CC265020SensorTag20Users20Guide2020Texas20Instruments20Wiki.2070227354.pdf

I would need confirmation for three things :

  1. Because I need only Acclerometer Service with 16G, I am writing (00011101 11000000) or 0x1D,0xC0 as byte array to confirguration ( f000aa82-0451-4000-b000-000000000000) based on the table given below. Is this right ?

image

  1. Secondly, I am receiving a packed bytes data as raw value and I am unpacking this as struct.unpack( '<hhhhhhhhh',val ) and I am taking the [3],[4] and [5] elements of this unpacked array ( h is 2 bytes each ) as x-axis , y axis and z- axis.

  2. Third, each of the axis values are converted to g using the equation ( axis*1.0 ) / ( 32768/16 ) .

Can someone help me and let me know if I am heading the right way. I had been stuck on this for a week. Thanks in advance.