How to connect the eHealth via Bluetooth with Python to a Computer

(Last Updated On: March 10, 2018)

The eHealth sensor board is a nice development platform to explore the biomedical sensors, but it have many drawbacks in terms of low reliability of the sensors. Depending on the application this sensor board can be adequate or not.

General, I think, the price does not worth with the product you get. Better you get separately (by other vendor maybe) the sensors you may need.

In my application I wanted to stream real time data from the human body and plot them in real time wirelessly (via Bluetooth Low energy). The data should be as accurate and reliable as possible. The idea is to track human activities, so the sensors should be integrated somehow and send data continuously without the interaction of the person under test. Here I explain the sensors I used, which not and why. sensors

This was the conclusions after using eHealth sensors:

Patient position: this is in reality the NXP-accelerometer MMA8452Q. If we would like to use an accelerometer we would use better directly one like this from sparkfun with the same MMA8452Q component and 10$ instead of the 48$ of cooking hacks. Even you can buy the chip for less than 2$ in mouser or farnell. SparkFun Triple Axis Accelerometer Breakout - MMA8452Q (with Headers)

Blood Pressure Sensor (Sphygmomanometer): This sensor does not allow to stream real time data. It is only one-time-measurements. This does not fit to add to my bio data collection project.

Pulse and Oxygen in Blood Sensor (SPO2): This sensor is not reliable. Actually it was funny when studying in deep the sensor I notice something wrong. Looking into the library, the transmitted data where read from the LCD, yes directly from the LCS. The LCD input pins were bridged to the connector, later by a rather complex function in the software, the conversion of LCD-digits to a integer was made.

The business from “cooking-hacks” is: buy in ebay the oximeter sensor for 10€, hack it connecting 10 cables and a connector, for later sell it for only 66€. Fabulous.

The thing is that the solution is very smart and it works fine for small applications. The LCD has 3 digits, which are multiplexed. So there are 8 lines + one control line. The control or selector line is read with an interrupt, then you can read the digits and order them creating an integer value of the lecture.

The problem comes when your program is getting bigger, maybe you have many other “real time” measurements or you want to use more interrupts. Then stopping the program flow every time the selector line trigger to calculate a new digit, lows the overall performance a lot. For my case was almost impossible to synchronize the BLE and reading other sensors.

That is why this sensor was also discarded.

Inside the oximeter sensor
Inside the hacked sensor

A smarter solution for this would be to include an extra microcontroller inside which perform the calculation of the LCDs and sent it back vie SPI or I2C. Of course it is more costly.

Galvanic Skin Response Sensor (GSR – Sweating): This sensor only measured the voltage differences between 2 pins. The values jump from time to time. The values have to be filtered or threated.

Electrocardiogram Sensor (ECG): The heart rate have to be calculated out of this measurements. There is another better and more comfortable solutions to integrate on the system, like the ant+ heart rate sensors.

Electromyography Sensor (EMG): We discarded this sensor because I have already 22 of this integrated on the Athos T-shirt and shorts. Also the ECG sensor cannot be used at the same time than the EMG.

Temperature: This sensor work quite fine and accurate. It can be also calibrated by measuring the real resistors value of your board and correct this error by software.

Glucometer: This sensor make isolate measurements and it does not stream values. The process of measurement cannot be automated: You need to put a drop of blood in the probe, then connect the cable to the Arduino for send the data to Arduino. This does not match with my project design.

Airflow: This sensor works very fine. It send a value between 0 and 1023 when you blow air from your nose. The problem I find to track the breathing is that when you breathe through your mouth you cannot measure nothing.

Finally I implemented the breathing sensor, the electrocardiogram, temperature sensor and the skin-resistance sensor were implemented in the Arduino Curie 101, because it has already built-in with BLE capabilities (and because I wanted to try the combination of Intel-arduino)

How does it work?

A program should run in the Arduino and another software in the computer side, a Linux-based machine.

Arduino side

To implement the Arduino Code I wrote a specific library combining the BLE Curie lib ad the eHealth library. This library you can find here and I called “SensorSuitBLE”. This can be found at the end of the post.

The Arduino software *.ino is:

To debug the Arduino software, it is very useful to use the nRF connect app from NordicSemiconductors. There you can with you smart phone scan and read the characteristics and notifications from the Arduino.

This is a first version of the project, which is logically very improvable and optimizable. The device name is “eHealth-board”, but this can be changed if you like something different.

Note: many of the connecting problems can be solved by the infallible and advanced method we learn in the university: RESET. Press the reset button hidden under the red board. Specially, if the connection get lost or disconnect in an improper way, you would need to reset. I should fix this bug in the coming versions, but for now it is ok.

Reset button of Arduino Curie under the eHealth board

Once the Arduino software is finished, tested and ready, you can forget about it. You just need to connect the Arduino to a power supply (USB or Battery) and it will send the lectures of the sensors.

The Voltage supply needs to be between 7 and 12V, therefore I built a battery-holder with the Arduino connector. This is quite bulky and not practical. Instead of this 2 small lithium batteries (3.8V+3.8V) in series can be used instead.


Computer side

I am using a XU4. This is a Linux-machine like rasperyPi or an Ubuntu computer. But it would be also exportable to windows (I think). I am using the bluePy library for Bluetooth. You may install this before you can run the script.

To change which sensor you want to activate, there is a configuration byte inside the activation command. Modifying it you can set which sensors are going to be measured.

The python script is the following:

To run this script just open a terminal where the file is located and run the commad:

>> sudo python3


If you want something smarter like plotting it in real time in a graph, consider see my other tutorial:

“How to plot data in real time using KST”.

For further information and documentation about sensors and how to connect, then see the official web from cooking hacks.

Library for Arduino

Header file:

Source file:

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top