In my last article, I touched on Texas Instruments SensorTag CC2650. In this article, I used bluez-dbus to create a Java library cc2650-driver to acquire various sensor data from CC2650. Here is an overview of (: //github.com/s5uishida/cc2650-driver). However, the contents of Github are the same. For implementation details and sample usage, see [Github Code](https://github.com/s5uishida/cc2650-driver/blob/master/src/io/github/s5uishida/iot/device/tisensortag/cc2650/driver Please refer to /CC2650Driver.java).
The CC2650 is a BLE sensor device powered by a coin cell battery CR2032. In cc2650-driver, I made it to get the following data.
The reason for getting the firmware version is that the battery level is supported since 1.30 and it is decided whether or not to get the battery level. For this, I had bluez-dbus PR merge the function to get the battery level. In addition, the following methods are supported for acquiring sensor data.
--Read directly --Notification
For CC2650, the maximum time interval that can be specified with the notification method is quite short, 2550 msec. Whether this is useful or not depends on the application. I'm thinking of getting these environment information in a crontab style schedule, for example at 1 minute intervals, so I'm using the direct read method instead of the notification method.
In addition, CC2650 has Wake On Motion as one of the notification method functions. When it detects a shake, it can send motion sensor data for 10 seconds at specified notification time intervals. By using this, for example, you can paste CC2650 in a place where movement is not expected and detect any movement. The cc2650-driver also supports Wake On Motion.
The CC2650 is powered by a coin cell battery, but I'm not sure how long it can run continuously. From experience, it became unusable when the battery level reached 60th. So I'm guessing that this battery level indicator is more of a voltage-related indicator than the battery level.
** cc2650-driver ** The heart of processing is bluetooth-scanner Similarly, prepare a class that is ʻextends of ʻAbstractPropertiesChangedHandler.java
provided by dbus-java, andpublic void handle (PropertiesChanged properties). )
Is to implement. See the code on Github for more information. Class file with the following sample code using cc2650-driver I have included it in /src/io/github/s5uishida/iot/device/tisensortag/cc2650/driver/CC2650Driver.java).
This series consists of the following articles:
[2019.11.16] For the latest information on simple tools, please refer to here.
Recommended Posts