Coder Social home page Coder Social logo

mecabot / ble-sensor-pi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from msaunby/ble-sensor-pi

0.0 2.0 0.0 215 KB

Simple example for SensorTag with RaspberryPi a Bluetooth Low Engery (BLE GATT) device

JavaScript 3.62% HTML 2.04% Python 93.40% Shell 0.94%

ble-sensor-pi's Introduction

ble-sensor-pi

Simple example for SensorTag with RaspberryPi a Bluetooth Low Engery (BLE GATT) device.

See sensortag/sensortag_test.py for a simple example of reading temperature values from the tag. The same approach could be used to read any of the sensors. It's also possible to have the tag send a stream of measurements at regular intervals. See the information here - http://processors.wiki.ti.com/index.php/SensorTag_User_Guide Or wait for me to add more examples.

This code was thrown together quickly to see how easy it might be to use these devices with the RaspberryPi. It proved to be very easy - though I struggled to find much information on BLE on Linux. Other relevant search terms are GATT.

I'll post more information on my blog at http://mike.saunby.net

You will almost certainly need to install a newer version of gatttool for this code to work. Bluez-5.2 and later are known to work. It's probably best to download and install the latest version of Bluez.

Once unpacked do the following -

./configure --disable-systemd
make
sudo make install
sudo /usr/bin/install -c attrib/gatttool /usr/local/bin/gatttool

You're also going to need to install the python pexpect library -

sudo pip install pexpect

To enable the bluetooth adaptor and find your SensorTag device address do the following -

sudo hciconfig hci0 up
sudo hcitool lescan 

Press the side button and you should get a couple of lines showing the device is working. Hit Ctrl-C to exit. Now you're ready to go -

python sensortag.py [ADDRESS]

I've put this code under the Apache 2.0 licence, if folks want to use it and that doesn't suit let me know. I have no desire to profit from this code, nor prevent others using or profiting if they wish. Equally you shouldn't expect me to maintain or support it. It's just stuff, use it as you wish.

ble-sensor-pi's People

Contributors

danielneis avatar msaunby avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.