Monday 2 May 2016

Raspberry pi 3 + Angel Sensor : Hello temperature !

In brief

The trend of open data i.e. data to be freely available to everyone to use and republish as they wish until recently was not obvious in the IoT wearable industry. Consumable wearable industry quite often enables restrictions and limits even when it comes to the use of your own health related data (e.g. see Withigs Terms of Use - 7. Duration - Termination - Free of charge).

Another alternative could be the usage of wearable devices that allow you to get your personal health data directly from the device i.e via Bluetooth.

Infrastructure and the Angel Sensor 

The Angel Sensor is a wearable designed to allow direct access via Bluetooth. In short, the AGL-M1 model has sensors to measure the temperature, the heart rate, the acceleration, and the blood oxygen saturation (under development) .

In this tutorial, we will try get the temperature measurements by using a raspberry pi 3 running Raspbian Jessie Lite.
The raspberry pi 3 and the Angel Sensor M1

Steps 

The code is stored at a public repo at GitHub.

1. Get a clone of the repository
  $ git clone https://github.com/vaggos2002/py-angel-sensor

2. Change your current directory
    $ cd py-angel-sensor

3. Install the required libraries  on your raspberry pi 3 :
  $ sudo apt-get install pip
  $ sudo pip install requirements

4. Press the Angel Sensor button to start the Sensor.

5.  Run the code
  $ ./temp.py -a '<angel sensor mac address >'
  e.g. :  ./temp.py -a '00:07:80:02:F3:8C'

After the last step, you should start to see at your terminal the temperature in Celsius :

Expected outcome of the script

8 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hello,

    I am currently doing a similar project as this one, I followed your tutorial. However, instead of getting the values I am getting the following error "ImportError: No module named btle". I have installed bluepy and bluez, the error still remains.

    If you can shine some light on this it will be much appreciated.

    Kind Regards,
    Ilish

    ReplyDelete
  3. Hi Ilish,

    Thanks for your message and your feedback.

    Indeed, there is an issue with importing the btle class. I updated the git repository. So if you pull it hopefully it will be fixed.

    Otherwise, you may replace the line at the temp.py

    '''
    from bluepy.btle import Peripheral, ADDR_TYPE_PUBLIC, AssignedNumbers, DefaultDelegate
    '''

    with those ones:
    '''
    try:
    from bluepy.btle import Peripheral, ADDR_TYPE_PUBLIC, AssignedNumbers, DefaultDelegate
    except ImportError:
    from bluepy.bluepy.btle import Peripheral, ADDR_TYPE_PUBLIC, AssignedNumbers, DefaultDelegate
    '''

    Please let me know if this fixed the issue.

    Many thanks again,

    Evangelos

    ReplyDelete
  4. Hello Evangelos,

    Thanks for getting back to me so quickly. I tried pulling your updated git repository, but the error still remains. I then tried the piece of code you suggested and the error still remains.

    Just out of curiosity, do you have to use django? I do not have it installed at the moment. My raspberry pi has python 2.7 loaded on it.

    Could this be the issue?

    Kind Regards,
    Ilish McPolin

    ReplyDelete
  5. Hi Evangelos,

    Just thought I should inform you that I have now got the code working. It seems that the error was being caused by bluepy being downloaded incorrectly and it was not an issue with your code. It is now working exceptionally well.

    I just want to say thank you for all your help, I would not have known were to begin if I had not found your tutorial.

    Do you plan on doing any more tutorials with the angel sensor?

    Kind Regards,
    Ilish

    ReplyDelete
  6. Hi Ilish,

    Great news ! Well done. python-django is for the development of web applications. I just named the blog like that since it was the first thing that I learned in python :)

    I was planning to investigate the activity measurement and at some point the SpO2 measurement. DO you need to find anything particular though ?

    Regards,
    Evangelos

    ReplyDelete
  7. Hi Evangelos,

    Another part of the project that I am doing involves obtaining the heart rate measurements from the angel sensor.

    Am I right in thinking that the code to obtain the heart rate is similar to the code to obtain the body temperature, except for a few variable changes?

    Kind Regards,
    Ilish

    

    ReplyDelete
  8. Hi Ilish,

    I just added a new module main.py with allows to get heart-rate, temperature, and steps counts. http://wild-django.blogspot.co.uk/2016/05/raspberry-pi-3-angel-sensor-hello_22.html

    The SpO2 seems not be active.

    Regards,
    Evangelos

    ReplyDelete