VS-ECG Programming Guide (V1.0)

6.0 VS-APP sample code download

In this chapter, we will introduce the VS-APP example of VS-ECG. This example is created by GTK3 in C / C++. All the source code can be download from GitHub


VS-APP example shows howt to connect, open  device and plot the ECG chart. You can develop an application like this. VS-APP example not like the previous examples. Users can based on the example to create your own application.

Plese download the sample code from the GitHub path shows above. Please make sure you have the root priority.

$ sudo apt-get install libgtk-3-dev
$ git clone https://github.com/juangjl/vs-ecg.git
$ cd vs-ecg/VsApp
$ make clean
$ make all
$ sudo ./script/start.sh

6.1 Prepare devices

Please  prepare a VSM004 and VSH101. Before executing, the VsAPP sample. Power on the VSH101 and put it upon on your left chest.

Plug the VSM004 into your ubuntu machine’s USB port.  You shall be able to find it to be realized as /dev/ttyUSBx.

6.2 Serial port connect

After the preparation, you can issue ./script/start to start the AP. There are two pages. The first one is Main and the second one is Control.

Please click the Vs-APP on the top-left and select the Control page. 

Set the correct name of your device like /dev/ttyUSB0 and click open of the Serial Port part. If the VSD101 is correctly installed in your machine, the “serial port is open message” can be read. Please note that, in this example all the function is compatible with the previous examples. We just turn it from conventional terminal application to a windows application of Ubuntu.

6.3 BLE Scan

Similar to the previous examples,   users  can use scan to find the devices you want.  Just have to click the scan start button. The application will start to scan the nearby devices and update the list every second. You shall find several bluetooth devices. Please click on the list to select a device with the name format of VSH101_XXXXXXXXX.

6.4 Connect to VSH101

After the previous step, please click the open in the VSH101 group. The application will try to open the VSH101 in 10 seconds. Please make sure the VSH101 not far away from your ubuntu machine. you can check the RSSI.  it is sugggested to connect to a VSH101 with RSSI not smaller than -70 db. If the VSH101 cannot connected, just have to open it again.

6.5 Start VSC Mode

VSC Mode is created by VitalSigns Technology for usrs to fetching real-time ECG and related data. You can refer to the previous example for more information about VSC Mode. In this case,  make sure tthat once he information shows “BLE is open” and click the Start in the VSC Mode part. The information below shall changed from “BLE is open” to “VSC Mode is unning….”.  It means the VSC Mode is successfully started. If you want to stop the VSC Mode,  just click the Stop button in the VSC Mode part.
Just switch back to the Main page of the application to check the result.

6.6 Result of the VS-APP

Now, you will have your first ECG application and all the data will be saved to your local folder. 
Besides the ECG chart,  VS-APP shows 21 information:

Date: date in local time in format of ‘YYYY:MM:DD’

Time: Time in local time in format of HH:MM:SS

HR: current heart rate in BPM

TEMP: Current body surface temperature in oC

G-SEN-X: The X axis  of G-Sensor in mG

G-SEN-Y: The Y axis  of G-Sensor in mG

G-SEN-Z: The Z axis  of G-Sensor in mG

BAT-SOC: Battery state of charge in %

BATT-SEC: Battery work time in seconds

HRV-SDNN: SDNN value of HRV time domain

HRV-NN50: NN50 value of HRV time domain

HRV-RMSSD: RMSSD of HRV time domain

HRV-RR: RR interval of HRV time domain in ms

HRV-VLF: VLF value of HRV frequency domain

HRV-LF: LF value of HRV frequency domain

HRV-HF: HF value of HRV frequency domain

HRV-LFHF: LF / HF value of HRV frequency domain

HRV-TP: TP, total power value of HRV frequency domain

HRV-LFTP: LF / TP of HRV frequency domain

HRV-HFTP: HF / TP of HRV frequency domain

In the next section, VS-ECG will introduce a tool named VsFlash for VSH101 firmware update