Ti Mmwave Labs: Driver Vital Signs - Developer'S Guide

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

TI mmWave Labs

Driver Vital Signs – Developer’s Guide


Lab Overview
• This lab exercise demonstrates the ability of AWR-1642 TI-mmWave sensor to measure body
displacements due to breathing and heart beat
• Typical body surface displacement parameters due to breathing and heart-beat are

From Front From Back


Vital Signs Frequency Amplitude Amplitude
Breathing Rate (Adults) 0.1 – 0.5 Hz ~ 1- 12 mm ~ 0.1 – 0.5 mm
Heart Rate (Adults) 0.8 – 2.0 Hz ~ 0.1 – 0.5 mm ~ 0.01 – 0.2 mm

• To measure these small scale vibrations/displacements, we measure the change in phase of the
FMCW signal with time at the target range bin
4 - b corresponds to the change in phase when the target moves a distance R
b  R
 - Note that a smaller wavelength  will give better displacement sensitivity

• Code Composer Studio (CCS) project along with source code is provided for this lab
• Pre-built binary files are also provided that can be loaded on to the AWR-1642 EVM 2
FMCW Radar Basics
 Periodic linearly-increasing frequency chirps (known as Frequency-Modulated Continuous Wave (FMCW))
are transmitted by radar towards the object
2R
td 
c

Frequency, Hz
fb

B
td
T
Time, sec
Time, sec

 B 
j  2 f c t  t 2 
Transmitted FMCW signal is given by s (t )  e  
T


2 
B
j  2 f c  t  td    t  td
Signal at the receiver is a delayed version of the transmitted signal r ( t )  e
 T 

 The received signal from an object at range R after mixing and filtering is given by

 BR 4 
j  4 t R
 j  f bt b 
s (t ).r (t )  e  cT 
e
3
FMCW Radar – Vital signs Measurements
 Note that for a single object, the beat signal b(t) is a sinusoidal and has both frequency 𝑓𝑏 and phase ∅𝑏
 BR 4 
j  4 t R
 j  f bt b 
b( t )  e  cT 
e
fb b
 To measure small scale vibrations, we measure the change in phase of the FMCW signal with time at the
object range bin. If an object moves a distance ∆R then the change in phase between consecutive
measurements is given by 4 As an example at λ=4 mm when we have displacements as
b  R
 small as ∆R = 1mm, the corresponding phase change is b  

 Phase can be measured by taking the FFT of the beat signal b(t) and computing the phase at the object
range-bin.

 Suppose we take the FFT and the object is at range-bin m, then the vibration signal x(t) can be extracted by
measuring the phase at range-bin m at time indices nTs , where n is the chirp index and Ts is the time
between consecutive measurements
Note that we are assuming that the vibrations x(t) are

x ( m, nTs )  b ( m, nTs ) small so that the object remains in the same range-bin
4
during the duration of the measurements 4
Chirp Configuration for Demo
 100 ADC Samples per chirp. Chirp duration is 50 ms based on the IF sampling rate of 2 MHz
 Each frame is configured to have 2 chirps. However only the 1st Chirp in the frame is used for processing
 A single TX-RX antenna pair is currently used for processing (Although all the RX antennas are enabled)
 Vital signs waveform is sampled along the “slow time axis” hence the vital signs sampling rate is equal to the Frame-rate of system
Frame 1 Frame 2 Frame 3
Frame N

Duty Cycle < 1 % Frame Periodicity = 50 ms

Range- Range- Range- Range-


FFT FFT FFT FFT

Object
Range-Bins

Range Bin
Further Processing for
Extract Phase and unwrap Vital Signs Estimation
for the object range bin

Slow Time Axis Slow Time Axis


5
Implementation on the AWR-1642
 Real-time implementation (20 fps) on the C674x DSP Processing Core
 Processing done over a running window of T ~ 16 seconds. New estimates are updated every 1 second
 Memory Requirements ~ 16 kB, CPU Processing time for a single estimate ~ 4 ms
Range-bin
tracking

Selected Target Spectral Estimation


Bandpass Filter Breathing
Range-Bin - FFT Decision
0.1 – 0.6 Hz Rate
(updated every few secs) - Peak interval
Breathing

Extract Phase from Phase Phase


Range FFT
selected range bin unwrapping Differences
Spectral Estimation
Heart Beat Bandpass Filter Place segment in - FFT
Chirp Parameters Decision
0.8 – 4.0 Hz Buffer of valid values - Auto-Correlation
Parameters Typical - Peak interval
Values

Heart
Bandwidth 4 GHz Motion
Rate
Corrupted
Fc (Starting Frequency) 77 GHz No
segment
Fs (Slow Time Axis sampling)
20 Hz
Fs_fast (Fast Time Axis Yes
sampling) 2 MHz
Discard the
N (Samples per Chirp) 100 segment
Tc (Chirp Duration) 50 us
6
Block Diagram Description
 Range FFT : A Fast Fourier Transform (FFT) is performed on the ADC data to obtain the range profile. The
magnitude of the range-profile is displayed on the PC-GUI.
 Target Range-bin : The range-bin corresponding to the target is found by finding the max-value in the range profile
within the user-specified range limits.
 Phase Extraction : The phase value of the selected range-bin is computed from the complex range profile data and
these phase values are measured over time. The assumption is that the subject is in the same range-bin throughout
these measurements. If the subject moves to a different range-bin then it will take a few seconds before the algorithm
locks into the new target range-bin.
 Phase Unwrapping : Phase values are between [-π, π ] and need to be unwrapped to obtain the actual
displacement profiles. Phase unwrapping is performed by adding/subtracting 2π from the phase whenever the phase
difference between consecutive values is greater/less than ± π. The unwrapped phase is displayed as the chest
displacement on the PC-GUI.
 Phase Difference : The phase difference operation is performed on the unwrapped phase by subtracting successive
phase values. This helps in enhancing the heart-beat signal and removing any phase drifts.
 Impulsive Noise Removal : The un-wrapped differential phase might be corrupted by several noise-induced phase
wrapping errors. This impulse-like noise is removed by computing a forward a(m)–a(m+1) and backward a(m)-a(m-1)
phase difference for each a(m) and if these exceed a certain threshold then a(m) is replaced by an interpolated value.

7
Block Diagram Description
 Bandpass Filtering : The phase values (after unwrapping and phase differences) are passed through two band-
pass filters (serially-cascaded Bi-Quad IIR filter). These band-pass filters operate in real-time input data to generate
a continuous stream of output data. The data after band-pass filtering is displayed as the breathing waveform and
heart waveform in the PC-GUI.
 Motion corrupted segment removal/Gain Control : The purpose of this block is to reduce the impact of any large
amplitude movements on the heart-rate estimates. The waveform is divided into segment of L=20 samples
(corresponding to 1 sec). If the energy within this data segment exceeds a user-defined threshold (E > ETh), then all
the samples in that data segment/block are either scaled by ETh or are alternatively discarded from the time-domain
E
cardiac waveform.
 Vital Signs Waveforms : Band-pass filter outputs are stored in the breathing-waveform and cardiac-waveform
buffer. Pre-processing steps such as windowing, gain control can be done on these prior to spectral estimation.
 Spectral Estimation : These buffers are passed on to the spectral estimation block. Several different types of
spectral estimation techniques can be implemented. The current implementation provides a FFT, auto-correlation
and an estimate based on the inter-peak distances in the time-domain waveforms to estimate the vital signs.
 Vital Signs Decision : The final heart-rate and breathing-rate decisions are made based on the confidence metric
from different spectral estimation methods.

8
Steps for Building from the Source Code and Run

1. 2. 3. 4. 5.
Pre- Import Lab Build Lab Preparing Running the
requisites project project the EVM Lab

9
1. Pre-requisites 1. Install Pre-requisites 2 3 4 5

• It is assumed that you have the TI mmWave SDK 2.0.0.4 and all the related
tools installed as mentioned in the mmWave SDK release notes.

– The mmWave SDK release notes include the links for downloading the required
versions of the above tools.

• If you have already installed the mmWave SDK and all the required tools, you
can move on to the next step i.e. downloading the lab on to your machine.

10
1. Pre-requisites 1. Install Pre-requisites 2 3 4 5

11
Steps

1. 2. 3. 4. 5.
Pre- Import Lab Build Lab Preparing Running the
requisites project project the EVM Lab

12
2. Import Lab Project 1
2
Import Lab project
3 4 5

• The Driver Vital Signs Lab consists of two CCS


projects, one for the R4F core and one for the
C674x DSP core
• The CCS projects are included in the Automotive
Toolbox zip file installed as described in the
Getting Started Guide.
• Open CCS. Select the “CCS Edit” perspective

• Select Project  Import CCS Projects. Browse


to select the lab folder
• The labs projects should be discovered by CCS.
Select All and Finish
• This copies the projects in the user’s workspace
and imports it into the CCS project explorer.

– It is important to note that the copy created in the


workspace is the one that gets imported in CCS. The
original project downloaded in mmwave automotive
toolbox is not touched.
13
2. Import - continued 1
2
Import Lab project
3 4 5

• The projects should be visible in


CCS Project Explorer as shown
here.

• We are ready to move on to the


next step i.e. Building the project.

14
Steps

1. 2. 3. 4. 5.
Pre- Import Lab Build Lab Preparing Running the
requisites project project the EVM Lab

15
3. Build the Lab 1 2
3
Build Lab project
4 5

• At this point we assume the two projects have been • The dss project must be built BEFORE the mss
imported in CCS. If they have not please go to Step project.
2.
• With the mss project selected in Project
Explorer, right click on the project and select
• With the dss project selected in Project Explorer, Rebuild Project
right click on the project and select Rebuild
Project. • On successful completion of the build, you
– Selecting Rebuild instead of Build ensures that the should see the output in CCS console as shown
project is always re-compiled. This is especially here and the following three files should be
important in case the previous build failed with errors. produced in the project debug directory

• On successful completion of the build, you should – xwr16xx_vitalSignsDemo_lab.bin


see the output in CCS console as shown here and – xwr16xx_vitalSignsDemo_mss.bin
the following two files should be produced in the – xwr16xx_vitalSignsDemo_mss.xer4f
project debug directory

– xwr16xx_vitalSignsDemo_dss.xe674 • If the build fails with errors, please ensure that


– xwr16xx_vitalSignsDemo_dss.bin all the pre-requisites are installed as mentioned
in the mmWave SDK release notes.
• If the build fails with errors, please ensure that all
the pre-requisites are installed as mentioned in the
mmWave SDK release notes. 16
Steps

1. 2. 3. 4. 5.
Pre- Import Lab Build Lab Preparing Running the
requisites project project the EVM Lab

17
4. Preparing the EVM 1 2 3
4. Preparing
the EVM 5

• There are two ways to execute the compiled code on the EVM:
– Deployment mode : Flashing the binary (.bin image) on to the EVM serial flash
• In this mode, the EVM boots autonomously from flash and starts running the bin image.
– Debug mode: Downloading and running the executable (.xer4f image) from CCS.
• You will need to flash a small CCS debug firmware on the EVM (one time) to allow
connecting with CCS. This debug firmware image is provided with the mmWave SDK.
• The Getting Started Guide has demonstrated the deployment mode
• The following presentation explains the second method i.e. Debug mode (CCS).
– To prepare the EVM for debug mode, we start with flashing the CCS debug firmware
image.
– Please use the flashing process described in the Getting Started Guide to flash the
following binary to the EVM.
• C:\ti\mmwave_sdk_xx_xx_xx_xx\packages\ti\utils\ccsdebug\xwr16xx_ccsdebug.bin

18
Steps

1. 2. 3. 4. 5.
Pre- Download Build Lab Preparing Running the
requisites Lab project project the EVM Lab

19
5. Connecting EVM to CCS 1 2 3 4 5. Running the
Lab

• It is assumed that you were able to download


and build the Lab in CCS (completed steps 1, 2
and 3)
• To connect the Radar EVM to CCS, we need to
create a target configuration
– Go to File ► New ► New Target Configuration
File
– Name the target configuration accordingly and
check the “Use shared location” checkbox.
Press Finish
– In the configuration editor window:
• Select “Texas Instruments XDS110 USB Debug
Probe” for Connection
• Select AWR1642 device in the Board or Device
text box.
• Press the Save button to save the target
configuration.
• You can press the Test Connection button to
check the connection with the board.
20
5. Connecting - continued 1 2 3 4 5. Running the
Lab

• Go to View ► Target Configurations to open the


target configuration window.

• You should see your target configuration under User


Defined configurations.

• Right click on the target configuration and select


Launch Select Configuration.

• This will launch the target configuration in the debug


window.

• Select the Texas Instruments XDS110 USB Debug


probe/C674X_0 and press the Connect Target button

• •Select the Texas Instruments XDS110 USB Debug


probe/Cortex_R4_0and press the Connect Target Click here to Connect
to the target CPU
button
21
5. Loading the binary 1 2 3 4 5. Running the
Lab

• Once both targets are connected, select


the C674X_0 target, and click on the
Load button in the toolbar
• In the Load Program dialog, press the
Browse Project button .
• Select the lab executable (.xe674) found
in the project as shown, and press OK.
• Press OK again in the Load Program
dialog.

22
5. Loading the binary 1 2 3 4 5. Running the
Lab

• Now select the Cortex_R4_0 target, and


click on the Load button in the toolbar
• In the Load Program dialog, press the
Browse Project button .
• Select the lab executable (.xer4f) found
in the project and press OK.
• Press OK again in the Load Program
dialog.

23
5. Running the binary 1 2 3 4 5. Running the
Lab

• With both executables loaded, select • Select dss_main.c, as shown, and press
the Run/Resume button
mss_main.c and press the Run/Resume
button • Further console output should be
generated as shown.
• The program should start executing and • You should see the “CLI is operational”
generate console output. message which indicates that the program
• If everything goes fine, you should see is ready and waiting for the sensor
configuration
the “MMWDemoMSS mmWave Control
Initialization was successful” message
which indicates that the program is • The sensor configuration is sent using the
waiting for the DSS to be started GUI. Follow Getting Started Guide for
more details on placing the sensor and
starting the GUI.
24
Running the Lab PC-GUI 1 2 3 4 5. Running the
Lab

1. Navigate to the folder vitalSigns_host ► gui ► gui_exe and click on VitalSignsRadar_Demo.exe


2. Two windows should open i.e. a Display prompt window and a GUI window. If the EVM is connected to the PC, then the display
prompt window should successfully open the COM ports (to double check, make sure they match with the port numbers on the
Device Manager).
3. In the GUI window, the User UART COM Port and Data COM Port fields should automatically be filled with the correct port
numbers (Make sure that no other EVM is connected to the USB ports of the PC)

COM ports
(The GUI should
automatically fill
these fields)
If the GUI does not open you might need the vc runtime
which can be downloaded from the link below
https://support.microsoft.com/en-us/help/2977003/the-latest-
supported-visual-c-downloads
25
Running the Lab PC-GUI 1 2 3 4 5. Running the
Lab

1. Press the Start Push button in the GUI. In the Display Prompt window you should see the configuration
settings being read from the configuration text file and sent through the UART to the EVM
2. As soon as the sensorStart command is sent, the GUI should start displaying the data
3. Please follow the Getting Started Guide for more details on placing the sensor and starting the GUI.

26
Running GUI – (Configuration)
• The mmWave sensor device and algorithm configurations are set through the configuration text file. These files are located
in vitalSigns_host\gui\profiles\
• Configuration commands relevant to the vital signs algorithm are vitalSignsCfg and motionDetection

Configuration Parameters Values Comments


vitalSignsCfg Start Range (meters) 0.1 The subject/person is expected to be within the Start Range and End Ranges.
The program searches for the maximum peak within these ranges and assumes
End Range (meters) 0.7 that peak corresponds to the subject.

Breathing Waveform Size 256 Specifies the number of points within the waveforms. As an example, given a
frame-rate of 20 Hz and 256 number of samples in the waveform then the time
Heart-rate Waveform Size 320 duration of the waveform would be = 256/20 ~ 12.8 seconds. In general, larger
the time duration, better the frequency resolution after the FFT and higher the FFT
processing gain. However, due to the inherent time-frequency resolution tradeoff,
we lose the ability to measure instantaneous changes in the heart-rate and
breathing-rate

Rx-Antenna to Process 1 Rx receiver number to process. Data from a single RX antenna is processed in the
current implementation

Alpha filter value for Breathing waveform 0.1 Alpha filter values for recursive averaging of the waveform energies based on the
energy computation equation below where x(n) is the current waveform value while E(n) is the energy.

Alpha filter value for heart-beat waveform 0.05 E ( n )  x 2 ( n )  (1   ) E ( n  1)


energy computation

Scale Factor for breathing waveform 300000 Scaling factors to convert waveform values in floating points to 32 bit integers
required for the FFT.

Scale Factor for heart-beat waveform 300000


Running GUI – (Configuration)
• motionDetection
The purpose of this block is to discard the data segments that might be corrupted by large amplitude movements. The heart
waveform is divided into segment of L samples. If the energy within this data segment exceeds a user-defined threshold ETh
then all the samples are discarded from the time-domain heart waveform.

Configuration Parameters Values Comments


motionDetection Enable 1 0: Disable the Block
1: Enable the Block

Data segments Length 20 Data segment over which the energy is computed
(L)

Threshold (ETH) 0.04 Energy threshold value. If the energy in the data segment length exceeds this value then the
data segment is discarded

Gain Control 0 0: Disable Gain Control


1: Enable Gain Control

Note : The display panel below the


TEXAS INSTRUMENTS icon will
turn RED if the current data
segment is discarded due to motion
corruption.

Data segment valid Data segment discarded


Limitations of the Current Demo
 The user has to be relatively still for at least 10-15 seconds for the demo to effectively work
 The breathing signal from the back might be very weak for some people.
 The heart-rate value might jump during measurements. This can be due to several reasons (e.g. noise,
alignment issues, interference from other objects, breathing harmonics overlapping with the heart rate
frequency etc. ). If the subject stays stationary, the heart-rate values ultimately should converge to the
correct value
 One reason the heart rate might display a wrong value is the presence of breathing harmonic overlapping
the heart-rate spectrum region i.e. [0.8 – 2.0] Hz. In the current demo the 2nd breathing harmonic is
cancelled. For example if the person has a breathing rate of 26 bpm and the heart rate happens to be ~ 52
bpm it will be discarded as the algorithm will interpret this as a breathing harmonic rather than a correct
heart-rate

29
Output packet on UART
Vital Signs Output Stats
Parameter Type
Header rangeBinIndexMax uint16
rangeBinIndexPhase uint16
MagicWord
Packet Structure ( 0x0102, 0x0304, 0x0506, 0x0708) 8 Bytes maxVal float
processingCyclesOut uint32
rangeBinStartIndex uint16
40 Bytes
Total packet size is multiple of 32 bytes

Header version 4 Bytes rangeBinEndIndex uint16


unwrapPhasePeak_mm float
totalPacketLen 4 Bytes
outputFilterBreathOut float
Message TLV Header 8 Bytes
platform 4 Bytes outputFilterHeartOut float
heartRateEst_FFT float
frameNumber 4 Bytes
128 Bytes heartRateEst_FFT_4Hz float
Vital Signs Output Stats
timeCpuCycles 4 Bytes heartRateEst_xCorr float
heartRateEst_peakCount float
numDetectedObj 4 Bytes breathingRateEst_FFT float
Message TLV Header 8 Bytes
breathingRateEst_xCorr float
numTLVs 4 Bytes
breathingRateEst_peakCount float
Number of reserved 4 Bytes confidenceMetricBreathOut float
Range Profile
Processed range confidenceMetricBreathOut_xCorr float
(Complex) bins *4 Bytes confidenceMetricHeartOut float
Message TLV Header
confidenceMetricHeartOut_4Hz float

Extra padding Type 4 Bytes confidenceMetricHeartOut_xCorr float


Extra Padding packet size multiple sumEnergyBreathWfm float
of 32 bytes
Length 4 Bytes sumEnergyHeartWfm float
motionDetectedFlag float
Reserved[0:9] float
30
Learn more about TI mmWave Sensors
• Learn more about xWR1x devices, please visit the product pages
– IWR1443: http://www.ti.com/product/IWR1443
– IWR1642: http://www.ti.com/product/IWR1642
– AWR1443: http://www.ti.com/product/AWR1443
– AWR1642: http://www.ti.com/product/AWR1642
• Get started evaluating the platform with xWR1x EVMs, purchase EVM at
– IWR1443 EVM: http://www.ti.com/tool/IWR1443BOOST
– IWR1642 EVM: http://www.ti.com/tool/IWR1642BOOST
– AWR1443 EVM: http://www.ti.com/tool/AWR1443BOOST
– AWR1642 EVM: http://www.ti.com/tool/AWR1642BOOST
• Download mmWave SDK @ http://www.ti.com/tool/MMWAVE-SDK
• Ask question on TI’s E2E forum @ http://e2e.ti.com
31
Appendix

Driver Vital Signs – Developer’s Guide

32
Saving data using the PC-GUI
• The PC-GUI also gives the option of saving the data that is displayed on the GUI.
Data can be saved by checking the “Save Data” check box. This can be checked
anytime the GUI is running

• The data is saved to a filed called “dataOutputFromEVM.bin”. This file is located in


the same folder as the gui executable: “lab-0001-driver-vital-
signs\vitalSigns_host\gui_exe”

• The saved data follows the same format mentioned in the slide “Output packet on
UART”

33
Saving data using the PC-GUI (cont.)
• Note that the complex range-FFT output (i.e. both real and imaginary values) from
the user-specified range-bins are also saved. The complex range-FFT output would
allow the user to extract the phase from a range-bin of interest and write their own
post-processing scripts to extract the vital signs signature.

• An example Matlab script to read the saved file is provided in the folder
“…\vitalSigns_host\gui\gui_source\matlabScripts”

34
Compiling the GUI using Qt
• The PC-GUI was developed in C++ using MSVC 2017 compiler within the Qt framework.
• If the user desires to modify the GUI source code then please follow the following steps
• Download and install Qt (Qt Creator 4.3 was used in the current version)
• Once Qt is installed. Select File  Open File or Project ….
• Go to the GUI source files (…\vitalSigns_host\gui\gui_source) and open the project file with the
extension “.pro”
• You may be asked to configure the project. In the current version MSVC 2017 was used to
compile the project. You may also use other compilers.

35
36

You might also like