Real-Time Spectrum Analysis

Real-time spectrum analysis allows you to perform continuous, gap free spectrum analysis on bandwidths up to 160MHz. This provides you with the ability to detect short transient signals down to 3us in length.


For a list of all examples, please see the examples/ folder in the SDK.

// Configure the device for real-time spectrum analysis, and retrieve the real-time sweeps and frames.
#include <cstdio>
#include <cstdlib>
#include "sm_api.h"
static void checkStatus(SmStatus status)
if(status > 0) { // Warning
printf("Warning: %s\n", smGetErrorString(status));
} else if(status < 0) { // Error
printf("Error: %s\n", smGetErrorString(status));
void sm_example_real_time()
int handle = -1;
SmStatus status = smNoError;
// Uncomment this to open a USB SM device
status = smOpenDevice(&handle);
// Uncomment this to open a networked SM device with a default network config
//status = smOpenNetworkedDevice(&handle, SM_ADDR_ANY, SM_DEFAULT_ADDR, SM_DEFAULT_PORT);
// Check open status
// Configure the measurement
smSetRefLevel(handle, -20.0); // -20dBm reference level
smSetRealTimeCenterSpan(handle, 2.45e9, 160.0e6); // 160MHz span at 2.45GHz center freq
smSetRealTimeRBW(handle, 30.0e3); // 30kHz min RBW with Nuttall window
smSetRealTimeScale(handle, smScaleLog, -20.0, 100.0); // On the frame, ref of -20, 100dB height
// Initialize the measurement
status = smConfigure(handle, smModeRealTime);
// Get the configured measurement parameters as reported by the receiver
double actualRBW, actualStart, binSize, poi;
int sweepSize, frameWidth, frameHeight;
smGetRealTimeParameters(handle, &actualRBW, &sweepSize, &actualStart,
&binSize, &frameWidth, &frameHeight, &poi);
// Create memory for our sweep and frame
float *sweep = new float[sweepSize];
float *frame = new float[frameWidth * frameHeight];
// Retrieve a series of sweeps/frames
for(int i = 0; i < 100; i++) {
// Retrieve just the color frame and max sweep.
smGetRealTimeFrame(handle, frame, nullptr, nullptr, sweep, nullptr, nullptr);
// Do something with data here
// Done with the device
// Clean up
delete [] sweep;
delete [] frame;
API functions for the SM435/SM200 spectrum analyzers.
SM_API SmStatus smOpenDevice(int *device)
@ smScaleLog
Definition: sm_api.h:309
SM_API SmStatus smSetRealTimeRBW(int device, double rbw)
SM_API SmStatus smGetRealTimeFrame(int device, float *colorFrame, float *alphaFrame, float *sweepMin, float *sweepMax, int *frameCount, int64_t *nsSinceEpoch)
SM_API SmStatus smSetRealTimeCenterSpan(int device, double centerFreqHz, double spanHz)
SM_API SmStatus smSetRealTimeScale(int device, SmScale scale, double frameRef, double frameScale)
SM_API SmStatus smAbort(int device)
@ smWindowNutall
Definition: sm_api.h:337
@ smModeRealTime
Definition: sm_api.h:248
SM_API SmStatus smSetRefLevel(int device, double refLevel)
SM_API SmStatus smCloseDevice(int device)
SM_API SmStatus smGetRealTimeParameters(int device, double *actualRBW, int *sweepSize, double *actualStartFreq, double *binSize, int *frameWidth, int *frameHeight, double *poi)
SM_API SmStatus smSetRealTimeWindow(int device, SmWindowType window)
SM_API SmStatus smConfigure(int device, SmMode mode)
SM_API const char * smGetErrorString(SmStatus status)
Definition: sm_api.h:142
@ smNoError
Definition: sm_api.h:203
SM_API SmStatus smSetRealTimeDetector(int device, SmDetector detector)
@ smDetectorMinMax
Definition: sm_api.h:301


Real-time spectrum analysis is a frequency domain measurement. For time domain measurements see I/Q Streaming.

RBW directly affects the 100% POI of signals in real-time mode.

Real-time spectrum analysis returns a sweep, frame, and alphaFrame from the smGetRealTimeFrame function. These are described in the sections below.

The real-time measurement is performed over short consecutive time periods and returned to the user as a sweep and frame representing spectrum activity over that time period. The duration of these time periods is ~33ms. This means you will receiver ~30 sweep/frame pairings per second.

Once the measurement is initialized via smConfigure, the API is continuously generating sweeps and frames for retrieval. The API can buffer ~1 second worth of past measurements. It is the responsibility of the user to request sweeps/frames at a rate that prevents the accumulation of measurements in the API.

Real-time spectrum analysis is accomplished using 50% overlapping FFTs with zero-padding to accomplish arbitrary RBWs. Spans above 40MHz utilize the FPGA to perform this processing which limits the RBW to 30kHz when using the Nuttall window. Spans 40MHz and below are processed on the PC and lower RBWs can be set.

Real-Time Sweep

The sweeps returned in real-time spectrum analysis are the result of applying the detector over all FFTs that occur during the measurement period. The min/max detector will return the peak-/peak+ sweeps. The average detector will return the averaged sweep over that time period.

When average detector is selected, both sweepMin and sweepMax return identical sweeps and one of them can be ignored.

Real-Time Frame

The frame is a 2-dimensional grid representing frequency on the x-axis and amplitude levels on the y-axis. Each index in the grid is the percentage of time the signal persisted at this frequency and amplitude. If a signal existed at this location for the full duration of the frame, the percentage will be close to 1.0. An index which contains the value 0.0 infers that no spectrum activity occurred at that location during the frame acquisition.

The alphaFrame is the same size as the frame and each index correlates to the same index in the frame. The alphaFrame values represent activity in the frame. When activity occurs in the frame, the index correlating to that activity is set to 1. As time passes and no further activity occurs in that bin, the alphaFrame exponentially decays from 1 to 0. The alpha frame is useful to determine how recent the activity in the frame is and useful for plotting the frames.

The sweep size is always an integer multiple of the frame width, which means the bin size of the frame is easily calculated. The vertical spacing can be calculated using the frame height, reference level, and frame scale (specified by the user in dB).

An example of a frame plotted as a gray scale image, mapping the density values between [0.0,1.0] to gray scale values between [0,255]. The frame shows a persistent CW signal near the center frequency and a short-lived CW signal.
The same frame above as is plotted in Spike, where density values are mapped onto a color spectrum.

RBW Restrictions

The real-time span determines the minimum and maximum RBW.

Span Minimum RBW (Nuttall window) Maximum RBW (Nuttall window)
(> 40MHz) 30 kHz 1 MHz
(< 40MHz) 1.5 kHz 800 kHz