Sunday 22 May 2016

Raspberry pi 3 + Angel Sensor : Hello Temperature, Heart Rate, Steps Count !

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 for 2 secs.

5. Press the Angel Sensor button to start the HR measurements for 10 secs.

6.  Run the code
  $ ./main.py -a '<angel sensor mac address >' -T (for temperature) -H (for heart rate) -S (for steps count)
  e.g. :  ./main.py -a '00:07:80:02:F3:8C' -H -S
After the last step, you should start to see at your terminal the following measurements :

Expected outcome of the script



19 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi,

    Brilliant tutorial yet again, I found it very informing and helpful.

    Keep up the good work :)

    Kind Regards,
    Ilish

    ReplyDelete
    Replies
    1. Hi Ilish Mc Polin,

      You had some errors earlier related to bluepy.. would you please help me to get some solution to my error . Bluepy and Bluez both are working good but it is not communicating with the angel sensor. However, after running a ble scan pi is displaying the Mac address of the angel sensor.

      Thank you for your time!

      Delete
  3. Hi Vaggos,
    This is a great tutorial and far exceeds the manufacturer's support. Thank you for providing it!
    Best

    ReplyDelete
    Replies
    1. your welcome. let me know if you will need anything

      Delete
  4. Hi Vaggos,

    Thank you for sharing useful work. I tried the same for my raspberry pi 3 model B and angle sensor M1, but failed to get the data from the sensor.

    After running the last command that is ./main.py -a I am getting error. Please find below

    traceback:
    from bluepy.bluepy.btle import peripheral, ADDR_TYPE_PUBLIC, AssignedNumbers DefaultDelegate, BTLEException ImportError: No module named bluepy.bluepy.btle


    I have followed all steps all are working fine don't know why it is not working. However, when I am running a scan I am able to see the MAC address of the angle sensor.

    Please help.

    Thank you,

    ReplyDelete
  5. Hi Vaggos,

    Just want to share an update that I have resolved the issue of bluepy. But Now I am facing another problem related to data . I am running the command .
    ./main.py -a '' and passing any argument say -T -H -S . It is showing the device is connected, but throwing an error as below

    py-angel-sensor $ ./main.py -a 00:07:80:02:F3:98 -T
    Press the Angel Sensor's button to continue...
    Device is connected.
    'NoneType' object has no attribute 'handle'


    The script of temperature is working fine, but the main python file is throwing error. I have checked with the other command -A, for this activity argument the main python file is showing the results.


    Please help me to understand this unknown behavior. Any help in this regard is appreciated.

    Thank you once again for useful work!

    ReplyDelete
    Replies
    1. Hi Alok,

      Thanks for your message. I will look at it this evening and I will let you know.

      Anyway, thanks for sharing your comments and your testing results.

      Best,
      Evangelos

      Delete
    2. Hi Evangelos,

      Thank you for such a prompt response! I would be glad to hear from you any clue in this regard.

      Note: temp.py is working fine and it is showing results but for main.py is throwing error except the -A option. The main.py is not showing any results for arguments like -H -T -S.


      Thank you,
      Alok

      Delete
    3. Hi Alok,

      I tried to your command :
      /main.py -a 00:07:80:02:F3:98 -T -H -S

      and it seems to work in my raspberry pi. Can you please check if you have the latest code ? you can do it by : git pull

      please let me know if that changed anything .

      Best,
      Evangelos

      Delete
    4. This comment has been removed by the author.

      Delete
    5. Hi Evangelos,

      Happy to inform you that after your update in code, the script is now running smoothly and displaying output on my pi.

      I would like to inform you, i tried with all commands for the script, however at present it is working for -H, -T, -S, -o, -B. It seems that this firmware at present doesn't has any support for the Oxygen parameter. Also, the waveform for gyro and accelerometer seems not to be plotting .

      However, the present code is running perfectly at least. I would like to know about your future applications.... DO you have any plans for multi angel sensor connection or using acce and gyro data for real time plot?? like one shared on the angel sensor blog
      http://angelsensor.com/blog/2016-04-06/getting-started-experiment-2-gyroscope-and-accelerometer/


      Thank you for your time and share.

      Regards,

      Delete
    6. Hi Alok,

      We tried with Ilish to figure it out how to get the acceleration waveform x-y-z . But the documents are not clear on how to do it. They do no define the 'Waveform Signal Control Point' feature. At the link that you provided, what they do is to combine the gyro information with the magnitude accelerator to provide the x-y-z values .

      I will look it again, today

      Best,
      Evangelos

      Delete
    7. Hi Evangelos,

      Thank you for your reply. Yes! the support is very poor and the concern is they are not active neither they participate in any discussions. Anyways Want to thank you for your pain and useful share :)
      Let me know if you have any success with multi angel connections or Gyro and accelerator values for real time analysis. Meanwhile I found a link which has been implemented in Node Js and They are plotting the gyro and accelerator data, have a look may be this might be useful
      http://www.craftworkz.co/blog/2016/05/02/Angel-Sensor-with-NodeJS/


      Regards,
      Alok

      Delete
  6. Hi Evangelos, first of all, thanks for your tutorial, is very useful!

    I have a problem when I execute ./main.py -a '00:07:80:02:F3:8C' -H -S: appear the sentence Press the Angel Sensor's button to continue... but, before I press the button, appear: [Errno 2] No such file or directory and program finishes.

    What is the problem?

    Thanks in advance

    ReplyDelete
    Replies
    1. Hi,
      I checked the code and I updated it. I think it was the open('templog.csv', 'r') and I replaced it with open('templog.csv', 'w+') .

      Could you pull the latest code and try again ?

      Best,
      Evangelos

      Delete
    2. Hi again!

      I updated the code and works! I can see Heart Rate, Temperature, Steps... Thanks I appreciate it!

      But one question: The notifications of Temperature are moreless periodical, every second program print in console the value of this variable but Heart Rate hasn´t got the same behavior. This notifications appear
      sporadically, for example, the console prints these values three consecutive times and after, in 30 seconds not show more values about heart rate, It is not periodical as temperature. What is the reason to explain this behavior?

      Thanks in advance!

      Delete
    3. Hi Voglaish,

      Thank you for your review comments.

      The way the Heart Rate notification works a little bit different compared to the Temperature. Heart Rate notifications are created and shared by the Angel Sensor when ever they are available. Temperature measurements are made more often.

      I could not dictate the AngelSensor to return me more frequently the measurements.

      Anyway, let me know if there is anything else,

      Best,
      Evangelos

      Delete