VS-ECG Programming Guide (V1.0)

4.0 BLE Connection

This section shows how user can communicate with VSH101 with VSM004.  It includes the following four functions:

  • BLE device scan
  • BLE Device open
  • BLE version read
  • BLE Device connection close

 As we know VSH101 is a wearable BLE ECG holter all of its function shall be done with BLE commands. Before we start the software implement, the first step is to turn on the VSH101.
Press the power the button for 5 seconds and wait the green led of VSH101 starts to blink.

4.1 Prepare your VSH101

Before any software coding, make sure that the VSH101 has been powered on. Just need to press the power button  for 5 seconds and release the button. The device will be ready for use.

4.2 BleConnect sample code and prepare​

Vs-ECG is a open source ECG development platform. You can download the all the source code neede from git hub.

https://github.com/juangjl/vs-ecg.git

The sample code can be executed on Ubuntu 20.04, macOS, and windows platform. You just have to git clone the repository like below:

$ git clone https://github.com/juangjl/vs-ecg.git

Try to find the folder named BleConnect.

Ubuntu:

Please set  the correct name of your VS Dongle  in the data/config.txtNext, just have to compile the source code with make all and  issue ./script/start.sh to run the example .Please set  the correct name of your VS Dongle  in the data/config.txt

Next, just use make all to compile the source code.

$ make clean
$ make all

config.txt shall be looked like this . Try to fill in the correct serial port name of your VS Dongle.  in this case, it is /dev/ttyUSB0.

4.3 BLE Scan, Connect and Command Issue

After issue ./script/start.sh.  The example will first 
Connect to the VS Dongle named /dev/ttyUSB0 and next, it read the VS Dongle Version from serial port. the third step is to set the local time to VS Dongle.

After that, the major part of here is BLE scan. It scans BLE devices nearby and user are asked to select a device willing to connect.

Make sure the device selected is with the name of “VSH101_XXXXXX.

In the case below, we select #0. VS Dongle will start to connect to VSH101_43_2201200040-JL and it took 2 seconds to connect to it. Sometimes, the connect time will between 1 second to 10 seconds. Make sure you have the VS Dongle and VSH101 nearby.  When the two devices are connected to each other, the LED will turn from green to blue.

After connected, the example will send 5 version get command to the device.
If it shows the correct model name and version you have.  The BLE connection and command protocol is OK.

The next section shows how to fetch the ECG and related heart rate data from VS Dongle and VSH101.