W!o+ 的《小伶鼬工坊演義》︰樹莓派 3 三兩事之藍牙篇【下】

想起最早玩『藍牙 BLE 』時,還是用 TI CC2541 SensorTag 。而今已經是

SensorTag2015

Family of tags with pencil and battery

Welcome to the SensorTag Wiki. This page includes information to complement the www.ti.com/sensortag page.

If you are looking for information about the previous generation SensorTag(CC2541 based) please go to http://processors.wiki.ti.com/index.php/CC2541_SensorTag

SensorTag Users Guides

CC2650 SensorTag Software User’s Guide

This User’s Guide provides gives details of CC2650 SensorTag BLE firmware including basic operation, sensor overview, GATT tables, conversion algorithms and overview of Bluetooth low energy commands used to communicate with the phone. SensorTag firmware is delivered as part of BLE Stack, available for download here.

───

 

的了。既然是要驗證樹莓派 3 的內建『藍牙』,索性就玩新的吧!還好新的

CC2650 SensorTag User’s Guide

Back to CC2650 SensorTag main wiki page.

When replacing the battery please check the replacement battery temperature ratings and do not use the SensorTag outside of the battery manufacturer specified temperature range.

This wiki page refers to software available through BLE Stack 2.1, available for download here. Please visit the SensorTag portal where, under the “Teardown” tab, you can find smartphone application source code, design files (schematics, layout, BOM, etc.) and links to the sensor data sheets.

The CC2650 SensorTag is a BLE peripheral slave device based on CC26xx hardware platform including five peripheral sensors with a complete software solution for sensor drivers interfaced to a GATT server running on TI BLEv2.1 stack. The GATT server contains a primary service for each sensor for configuration and data collection.

───

 

使用手冊大體一樣。有鑑於這是首次介紹『此物』,何不串講一些消息資訊給有興趣的讀者參考呢?

【藍牙 BLE 入門】

TI Sensor Tag and Raspberry Pi

In this tutorial, you will learn how to use Bluetooth to connect and get sensor readings from a TI CC2650 SensorTag to a Raspberry Pi

 

【內建藍牙裝置摘要】

pi@raspberrypi ~ hciconfig -a hci0:	Type: BR/EDR  Bus: UART 	BD Address: B8:27:EB:23:2B:C8  ACL MTU: 1021:8  SCO MTU: 64:1 	UP RUNNING  	RX bytes:2090985 acl:104487 sco:0 events:104528 errors:0 	TX bytes:1255589 acl:104488 sco:0 commands:49 errors:0 	Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87 	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3  	Link policy: RSWITCH SNIFF  	Link mode: SLAVE ACCEPT  	Name: 'raspberrypi' 	Class: 0x000000 	Service Classes: Unspecified 	Device Class: Miscellaneous,  	HCI Version: 4.1 (0x7)  Revision: 0xb6 	LMP Version: 4.1 (0x7)  Subversion: 0x2209 	Manufacturer: Broadcom Corporation (15)  pi@raspberrypi ~ 

 

【尋找藍牙 BLE 設備】

pi@raspberrypi ~ sudo hcitool lescan LE Scan ... 68:C9:0B:17:7E:80 (unknown) 68:C9:0B:17:7E:80 CC2650 SensorTag </pre>    <span style="color: #808080;">【操作藍牙 BLE 東東】</span> <pre class="lang:sh decode:true">pi@raspberrypi ~ gatttool -b 68:C9:0B:17:7E:80 --interactive
[68:C9:0B:17:7E:80][LE]> connect
Attempting to connect to 68:C9:0B:17:7E:80
Connection successful
[68:C9:0B:17:7E:80][LE]> char-write-cmd 0x24 01
[68:C9:0B:17:7E:80][LE]> char-read-hnd 0x21
Characteristic value/descriptor: 54 07 c8 09 
[68:C9:0B:17:7E:80][LE]> quit

 

【飛向雲端】

Controlling TI-CC2650 from anywhere in the world

CC2650

by using BLE in combination with full-duplex real-time communication

About the author

Uffe Björklund is one of the founders and CEO of XSockets.NET and have been working with development around real-time communication since 2009.

Introduction

CC2650 from Texas Instruments is an amazing piece of hardware that enables communication over Bluetooth Low Energy (BLE) as a peripheral device to a central unit. The sensortag has a lot of services, and it would be great to be able to access them from anywhere in the world.

───

 

【派生程式庫】

IanHarvey/bluepy

bluepy

Python interface to Bluetooth LE on Linux

This is a project to provide an API to allow access to Bluetooth Low Energy devices from Python. At present it runs on Linux only; I’ve mostly developed it using a Raspberry Pi, but it will also run on x86 Debian Linux.

There is also code which uses this to talk to a TI SensorTag (www.ti.com/sensortag).

Installation

The code needs an executable bluepy-helper to be compiled from C source. This is done automatically if you use the recommended pip installation method (see below). Otherwise, you can rebuild it using the Makefile in the bluepy directory.

To install the current released version, on most Debian-based systems:

sudo apt-get install python-pip libglib2.0-dev
sudo pip install bluepy

───

 

【簡易說明】

pi@raspberrypi ~ sensortag -h usage: sensortag [-h] [-n COUNT] [-t T] [-T] [-A] [-H] [-M] [-B] [-G] [-K]                  [-L] [--all]                  host  positional arguments:   host                 MAC of BT device  optional arguments:   -h, --help           show this help message and exit   -n COUNT             Number of times to loop data   -t T                 time between polling   -T, --temperature   -A, --accelerometer   -H, --humidity   -M, --magnetometer   -B, --barometer   -G, --gyroscope   -K, --keypress   -L, --light   --all pi@raspberrypi ~ 

 

【指令使用方法】

pi@raspberrypi ~ sensortag 68:C9:0B:17:7E:80 -n 10 -t 0.5 -L Connecting to 68:C9:0B:17:7E:80 ('Light: ', 4.6000000000000005) ('Light: ', 4.6000000000000005) ('Light: ', 4.6000000000000005) ('Light: ', 4.67) ('Light: ', 4.67) ('Light: ', 4.5200000000000005) ('Light: ', 4.5200000000000005) ('Light: ', 4.6000000000000005) ('Light: ', 4.51) ('Light: ', 4.5200000000000005) pi@raspberrypi ~ 

 

期待明天會更好的耶!!!