Implementation of BT Smart using CC2541 SensorTag and python scripts. Taken from https://github.com/msaunby/ble-sensor-pi
Check with
uname -r
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cmake
sudo apt-get install automake
sudo apt-get install libusb-dev
sudo apt-get install libdbus-1-dev
sudo apt-get install libudev-dev libical-dev libreadline-dev
sudo apt-get install libglib2.0
sudo apt-get install libglib2.0-dev
sudo apt-get install bluetooth
sudo apt-get install bluez-utils
sudo apt-get install bluez-hcidump
Download the latest version of BlueZ from www.bluez.org. I downloaded release5.11 (bluez-5.11.tar.xz) to my PC and copied it over to the /home/pi direcotry on my Pi.
Or you can use wget
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.11.tar.gz
Extract the BlueZ tar file with the following command
tar xvfJ bluez-5.11.tar.xz
cd bluez-5.11
./configure --disable-systemd
make
make install
Need to copy gatttool manually into the /usr/local/bin/ dir
cp attrib/gatttool /usr/local/bin/
sudo git clone https://github.com/mvartani76/RPi-Ble-Sensor-Tag-Python/
Find the BD_ADDR of the low energy device with the following command
sudo hcitool lescan
This tool does not stop so you will need to manually stop it (CTRL-C) after you find your BD_ADDR.
sensortag.py - this code prints out all data from the TI sensortag
sudo python sensortag.py BD_ADDR
sensortag_test.py - this code just prints out the temperature data from the TI sensortag
sudo python sensortag_test.py BD_ADDR