Read and Process Raw ADC Data in Real-Time from TI mmWave Radar Board Using DCA1000EVM Capture Card
This example shows how to use Radar Toolbox Support Package for Texas Instruments® mmWave Radar Sensors to acquire raw ADC radar data (IQ data) from Texas Instruments (TI) radars for real-time processing.
Additionally, this example includes instructions on how to evaluate and visualize the range response and range-doppler response using the ADC data collected from the TI radar.
Required Products
MATLAB®
Radar Toolbox Support Package for Texas Instruments mmWave Radar Sensors
For information on installing the support package, see Install Support and Perform Hardware Setup for TI mmWave Hardware.
Required Hardware
One of the TI mmWave Radar Evaluation Modules (EVMs) that supports reading raw ADC data (IQ data) by connecting to DCA1000EVM (see Supported Boards)
USB Cable Type A to Micro B
5V, 3 A power adapter
DCA1000EVM capture card
Samtec cable
Ethernet cable
For more details regarding these hardware components, see Hardware Requirements for Acquiring ADC data Using TI mmWave Radar and DCA1000EVM.
Hardware Setup
You must set up the TI mmWave radar sensor and DCA1000EVM before you can use it to read ADC data to MATLAB. Set up the sensor by completing the hardware setup procedure (as explained in the Hardware Setup screens). To launch hardware setup, execute the below command and follow the steps shown in the screens.
mmWaveRadarSetup
For information on launching the Hardware Setup screens, see Install Support and Perform Hardware Setup for TI mmWave Hardware.
Connect to mmWave Radar and DCA1000 Capture card
After the hardware setup process is completed successfully, you can connect to the TI Radar board and DCA1000EVM by specifying the board name. This example uses the IWR6843ISK EVM. If you are using a different EVM, change the board name accordingly.
dca = dca1000("IWR6843ISK");
If you have connected only one TI Radar board to the host computer, MATLAB detects the serial port details automatically. If you have connected more than one board or if MATLAB does not automatically populate the serial port details, specify the ConfigPort argument. For example:
dca = dca1000("IWR6843ISK",ConfigPort = "COM3")
Refer to Identifying Serial Ports for TI mmWave Radar Connection to identify the Config port corresponding to your board.
Configuring the TI Radar
To configure the TI mmWave radar board, you must send a sequence of commands to the board using the serial port. The sequence includes commands specifying the chirp profile, sampling rate, and so on. Use the ConfigFile property of the dca1000 object to send the sequence of commands to the board. For more information, see Configure Radar Using a Configuration (.cfg) File for Reading Raw ADC (IQ) Data.
In this example, we will be using a default configuration that ships with support package.
Compute and Visualize Range Response and Range-Doppler Response Using the Live Radar ADC Data (IQ data) Obtained from TI Radar Board
Calling the dca1000
object retrieves a single radar data cube from the TI radar board. This function call returns a radar data cube with dimensions: (Number of ADC samples)-by-(Number of Rx channels)-by-(Number of Chirps).
Number of ADC Samples, Number of Rx channels, and Number of Chirps are the values of the properties SamplesPerChirp
, NumReceivers
and NumChirps
, respectively, of the dca1000
object. These values are set based on the Configuration (.cfg) file you are using to configure the TI mmWave radar.
Note: The first call to dca1000 object does the configuration, which might take some time. The subsequent calls to dca1000 object should be faster and returns ADC data as soon as the data is available.
The below script reads radar data cubes and use phased.RangeResponse
to assess and visualize the range response of the ADC data in real-time. The phased.RangeResponse
System object™ is configured to perform range filtering on fast-time (range) data, using an FFT-based algorithm. plotResponse
function of the phased.RangeResponse
is used to plot the range response of the input data.
clear dca % Create connection to TI Radar board and DCA1000EVM Capture card dca = dca1000("IWR6843ISK"); % Define a variable to set the sampling rate in Hz for the % phased.RangeResponse object. The dca1000 object provides the % sampling rate in kHz; convert this rate to Hz. fs = dca.ADCSampleRate*1e3; % Define a variable to set the FMCW sweep slope in Hz/s for the % phased.RangeResponse object. The dca1000 object provides the % sweep slope in GHz/us; convert this sweep slope to Hz/s. sweepSlope = dca.SweepSlope * 1e15; % Define a variable to set the number of range samples nr = dca.SamplesPerChirp; % Create phased.RangeResponse System object that performs range filtering % on fast-time (range) data, using an FFT-based algorithm rangeresp = phased.RangeResponse(RangeMethod = 'FFT',... RangeFFTLengthSource = 'Property',... RangeFFTLength = nr, ... SampleRate = fs, ... SweepSlope = sweepSlope, ... ReferenceRangeCentered = false); % The first call of the dca1000 object may take longer due to the % configuration of the radar and the DCA1000EVM. To exclude the configuration % time from the loop's duration, make the first call to the dca1000 object % before entering the loop. iqData = dca(); % Specify the duration in seconds for which the loop should run stopTime = 100; % Start the stopwatch timer ts = tic; % Execute the loop until the stopTime specified is reached while (toc(ts)<stopTime) % Capture the ADC data (IQ data) from TI Radar board and DCA1000EVM iqData = dca(); % Get the data from first receiver antenna iqData = squeeze(iqData(:,1,:)); % Plot the range response corresponding to the input signal, iqData. plotResponse(rangeresp,iqData); % Update figures drawnow limitrate; end
% Stop streaming the data and release the non tunable properties
dca.release;
The below script reads radar data cubes in real-time and use phased.RangeDopplerScope
to compute and display the range-doppler response map.
Note: When the while
loop in the below script is running, a MATLAB figure window opens up. You can move an object in front of the mmWave radar and see if the figure updates accordingly.
clear dca % Create connection to TI Radar board and DCA1000EVM Capture card dca = dca1000("IWR6843ISK"); % Initialize variables % Define a variable to set the sampling rate in Hz for the % phased.RangeDopplerScope object. The dca1000 object provides the % sampling rate in kHz; convert this rate to Hz. fs = dca.ADCSampleRate*1e3; % Define a variable to set the center frequency in Hz for the % phased.RangeDopplerScope object. The dca1000 object provides the % center frequency in GHz, convert this rate to Hz. fc = dca.CenterFrequency*1e9; % Define a variable to set the pulse repetition period in seconds for the % phased.RangeDopplerScope object. Because the dca1000 object provides the % chirp cycle time in us, convert this rate to seconds. The value is % multiplied by 2 in this example because we are plotting the data only for first % transmit channel out of 2 channels tpulse = 2*dca.ChirpCycleTime*1e-6; % Pulse repetition interval prf = 1/tpulse; % Define a variable to set the FMCW sweep slope in Hz/s for the % phased.RangeResponse object. The dca1000 object provides the % sweep slope in GHz/us; convert this sweep slope to Hz/s. sweepslope = dca.SweepSlope*1e9/1e-6; % Samples per chirp or RangeFFTLength nr = dca.SamplesPerChirp; % Number of active receivers nrx = dca.NumReceivers; % Number of chirps nchirp = dca.NumChirps; % Create range doppler scope to compute and display the response map. rdscope = phased.RangeDopplerScope(IQDataInput=true,... SweepSlope = sweepslope,SampleRate = fs,... DopplerOutput="Speed",OperatingFrequency=fc,... PRFSource="Property",PRF=prf,... RangeMethod="FFT",RangeFFTLength=nr, ... ReferenceRangeCentered = false); % The first call of the dca1000 class object may take longer due to the % configuration of the radar and the DCA1000EVM. To exclude the configuration % time from the loop's duration, make the first call to the dca1000 object % before entering the loop. iqData = dca(); % Specify the duration in seconds for which the loop should run stopTime = 150; ts = tic(); % Execute the loop until the stopTime specified is reached while (toc(ts)<stopTime) % Capture the ADC data (IQ data) from TI Radar board and DCA1000EVM iqData = dca(); % Get the data from first receiver antenna and first transmitter antenna % (Every alternate pulse is from one transmitter antenna for this % configuration) iqData = squeeze(iqData(:,1,1:2:end)); % Plot the range doppler response corresponding to the input signal, % iqData. rdscope(iqData); end
% Stop streaming the data and release the non tunable properties
dca.release;