mvartani76 / RPi-Ble-Sensor-Tag-Python

Raspberry Pi Implementation of BT Smart using CC2541 SensorTag and python scripts. Taken from https://github.com/msaunby/ble-sensor-pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RPi-Ble-Sensor-Tag-Python

Implementation of BT Smart using CC2541 SensorTag and python scripts. Taken from https://github.com/msaunby/ble-sensor-pi

Make sure you have a kernel version >3.5

Check with

uname -r

Install Necessary Bluetooth/BlueZ drivers

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

Get the latest version of BlueZ

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

Configure and Build SW

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/

Get the Code from GitHub

sudo git clone https://github.com/mvartani76/RPi-Ble-Sensor-Tag-Python/

Run the Code

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

About

Raspberry Pi Implementation of BT Smart using CC2541 SensorTag and python scripts. Taken from https://github.com/msaunby/ble-sensor-pi


Languages

Language:Python 93.6%Language:JavaScript 6.4%