How to send data from an Arduino BT or 101 to a computer in real time

(Last Updated On: March 10, 2018)

In this tutorial I am going to explain with an example how to stream data from my Arduino to a computer. Later to plot the data on real time I am using KST2.

The problem to solve is simple: An Arduino connected to some sensors, which streams data continuously to a BLE device (a computer or a Raspberry Pi in this case).

Let’s start!

On the Arduino side, a normal c-code is running to read the data, process them if needed and send them though BLE. I am using the new Arduino from Intel Curie 101, which I find very powerful and interesting. For the measurements I am going to use the eHealth sensor board to read values from some attached sensors: an electrocardiogram, temperature, air flow and skin conductance sensors.

Arduino with the red eHealth board and some sensors attached

The arduino code is:

You need to add my modified eHealth library:

Unzip this folder and add it to your libraries directory. If you are using windows it should be something similar to ~/documents/Arduino/libraries


On the computer side, a script in python is going to read the data coming from the Arduino via bluetooth low energy (BLE). The laptop is using the internal built-in bluetooth device, but also another external USB devices can be use. For example when I run this in my Odroid XU4 (a kind of raspery Pi) it needs a bluetooth USB dongle to work.

The python script is writing all the data into a csv (comma separated values) file, which is plotted in real time using kst. Here I explain how to use kst to plot easily and effective data from a text or csv file.

The Python Script uses the BluePy library

The python script is calling to run the program kst, which is in charge of plotting the data. I already save the layout and configuration file for this specific application under the file “Health.kst”, you can download this file and use it or create your own configuration file. This can be made opening first the kst2 program with the:

and selecting the file you want to plot, in this case “Health.csv”. More info about how to configure kst was explained by me in my other article.

Here is how the plotting looks like. Note in this example I had only the heart rate sensor and airflow sensor attached to the board.

Leave a Reply

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

Scroll to top