Easily monitor the indoor environment ~ ③ Get temperature / humidity / illuminance etc. from TI SensorTag CC2650 with Java (Bluetooth LE / bluez-dbus) ~

Introduction

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).

CC2650 sensor data

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.

What I noticed with CC2650

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.

Sample code

** 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).

A series of articles

This series consists of the following articles:

  1. Motivation and Concept
  2. Catch Bluetooth LE advertisement signal with Java (Bluetooth LE / bluez-dbus) The related Github is here.
  3. ** Get temperature / humidity / illuminance etc. from TI SensorTag CC2650 with Java (Bluetooth LE / bluez-dbus) (this time) ** The related Github is here.
  4. Obtain CO2 concentration from MH-Z19B with Java (serial communication / jSerialComm) The related Github is here.
  5. Get PM2.5 concentration from PPD42NS in Java (GPIO / Pi4J) The related Github is here.
  6. Getting operational information of industrial automation equipment in Java (OPC-UA / Eclipse Milo) The related Github is here.
  7. Collect in a simple tool The related Github is here.
  8. Postscript

Postscript

[2019.11.16] For the latest information on simple tools, please refer to here.

Recommended Posts

Easily monitor the indoor environment ~ ③ Get temperature / humidity / illuminance etc. from TI SensorTag CC2650 with Java (Bluetooth LE / bluez-dbus) ~
Easily monitor the indoor environment-② Catch the Bluetooth LE advertisement signal with Java (Bluetooth LE / bluez-dbus)-
Easily monitor the indoor environment-⑪ Obtain the illuminance with Java from BH1750FVI (substitute)-(I2C / Pi4J)-
Easily monitor the indoor environment-⑩ Obtain temperature / humidity / atmospheric pressure from BME280 (substitute) with Java (I2C / Pi4J)-
Easily monitor the indoor environment-⑤ Obtain PM2.5 concentration from PPD42NS with Java (GPIO / Pi4J)-
Easily monitor the indoor environment-④ Obtain CO2 concentration from MH-Z19B with Java (serial communication / jSerialComm)-
Easily monitor the indoor environment ~ ⑨ Get motion detection (HC-SR501 / RCWL-0516) in Java (GPIO / Pi4J) ~
Easily monitor the indoor environment ~ ⑧ Postscript ~
Easily monitor the indoor environment- (1) Motivation and concept-
Read temperature / humidity with Java from Raspberry Pi 3 & DHT11
Easily monitor the indoor environment-⑦ Summarize in a simple tool-