3.2.7. Streaming

The Streaming application enables users to stream data from Red Pitaya to:

  • A file saved on the Red Pitaya SD card

  • A file saved on a remote computer via the ethernet protocol (UDP or TCP).

The user can set:

  • The sampling frequency (rate)

  • Input channel count (Channel 1, Channel 2, or Both (4 Channels for STEMlab 125-14 4-Input))

  • Input channel resolution (8 or 16 bits)

  • Input attenuation (HV/LV mode) (for 125-xx, a switch of the jumper is required)

  • Whether to use the calibration or not (for 125-xx, the filter is also calibrated)

  • RAW / Volts mode

  • The number of samples or unlimited sampling

Streamed data can be stored into:

  • Standard audio WAV file format

  • Technical Data Management Streaming (TDMS) file format

  • Fast and compact binary format (BIN). It can be converted to CSV format.

Max. streaming speeds (per board) are limited to:

  • 10 MB/s for streaming to an SD card (SD card class 10 is recommended for optimal streaming performance)

  • 20 MB/s for streaming over 1 Gbit network (A direct connection is recommended to achieve the best streaming performance)

Note

The maximum continuous streaming speeds (per board) are limited to the total input data rate, not the network transfer rates. If the maximum data rate is exceeded, the data pipeline inside Red Pitaya starts to clog, which leads to unpredictable behaviour. Here are a few examples of maximum data rates:

  • One channel, 8-bits per sample: Max sampling frequency 20 MHz.

  • One channel, 16-bits per sample: Max sampling frequency 10 MHz.

  • Two channels, 8-bits per sample: Max sampling frequency per channel 10 MHz (assuming same frequencies for both channels)

  • Two channels, 16-bits per sample: Max sampling frequency per channel 5 MHz (assuming same frequencies for both channels)

If acquiring a limited amount of samples in a short duration, it is possible to reach higher sampling frequencies (up to the sampling speed of fast analog inputs).

Minumum streamed data size

To increase the efficiency of the application, there is a minimum data size that can be sent through the network. This can have a big impact at high decimation values, as it takes a long time to fill a chunck. If the stream is stopped before a chunck is completed, the data is discarded and the saved file has a size of 0 b.

Here are the minimum chunck limitations sorted by file type and units:

File type \ Units

VOLTS

RAW

WAV

128.043 kb

64.043 kb

TDMS

128.133 kb

64.133 kb

BIN

64.090 kb

64.090 kb

Note

We plan to expand the functionality by adding the generation to the Streaming application in the future. For now, it is possible for a user to implement it by themselves.

3.2.7.1. Getting started with the Red Pitaya streaming feature

Run the Streaming app from the Red Pitaya Web interface

../../../_images/redpitaya_main_page.png

3.2.7.2. Stream locally to a file on Red Pitaya’s SD card

  1. Configure the stream properties & click RUN

    ../../../_images/settings.png

    Example: streaming on ch1, 8-bit resolution, 5.208 MS/s into TDMS file format

  2. Press STOP to stop streaming

  3. Click Browse to open the data file directory. Each data stream is split into three sections; DATA (collected data stream), .log (data log of the specific stream), .log.lost (report on lost packets). Click on the selected file to download it from Red Pitaya to the computer.

    ../../../_images/capture.png
  4. Open the file in a program that supports the selected file format, visualisation, and processing, such as DIAdem for TDMS files, or Audacity for WAV.

    ../../../_images/diadem_tdms_file_viewer.png

3.2.7.3. Streaming to a remote computer via Command Line or Terminal

  1. Download the streaming client for your computer. Clients are located on the board itself and can be downloaded from there.

    ../../../_images/download_client.png
  2. Configure the stream properties & click RUN

    ../../../_images/tcp_settings.png

    Example: streaming on CH1, 16-bit resolution 5 Msps, TCP

  3. Execute the streaming client via Command Line or Terminal on a remote computer (copy the IP address from the web interface and choose the required file format).

    rpsa_client.exe -h 192.168.1.29 -p TCP -f ./ -t wav
    
    ../../../_images/tcp_client.png

    Data streaming can be stopped by pressing Ctrl+C.

    The created wav file can be read or viewed in Audacity or another program that supports WAV file type:

    ../../../_images/audacity.png

3.2.7.3.1. Instructions for the rpsa_client

  1. Detect Mode

    This mode allows you to determine the IP addresses that are in the network in streaming mode. By default, the search takes 5 seconds.

    rpsa_client.exe -d [-p PORT] [-t SEC]
    rpsa_client.exe --detect [--port=PORT] [--timeout=SEC]
    
    --detect               -d           Enable broadcast search.
    --port=PORT            -p PORT      Port for broadcast (Default: 8902).
    --timeout=SEC          -t SEC       Timeout(Default: 5 sec).
    
  2. Configuration Mode

    This mode allows you to get or set the configuration on the boards.

    rpsa_client.exe -c -h IPs [-p PORT] -g V|VV|F [-v]
    rpsa_client.exe -c -h IPs [-p PORT] -s M|F [-f FILE] [-v]
    rpsa_client.exe --config --hosts=IPs [--port=PORT] --get=V|VV|F [--verbose]
    rpsa_client.exe --config --hosts=IPs [--port=PORT] --set=M|F [--config_file=FILE] [--verbose]
    
    --config               -c           Enable config mode.
    --hosts=IP,...         -h IP,...    You can specify one or more board IP addresses through a separator - ','
                                        Example: --hosts=127.0.0.1 or --hosts=127.0.0.1,127.0.0.2
                                                  -h 127.0.0.1     or  -h 127.0.0.1,127.0.0.2,127.0.0.3
    --port=PORT            -p PORT      Port for configuration server (Default: 8901).
    --get=V|V1|VV|F        -g V|V1|VV|F Requests configurations from all boards.
                                        Keys: V  = Displays on the screen in json format.
                                              V1 = Displays on the screen in json format (only data).
                                              VV = Displays on the screen in a format with decoding values.
                                              F  = Saves to a config files.
    --set=M|F              -s M|F       Sets configurations for all boards.
                                        Keys: M  = Sets values only to memory without saving to file.
                                              F  = Sets configuration and saves to file on remote boards.
    --config_file=FILE     -f FILE      Configuration file for setting values on boards (Default: config.json).
    --verbose              -v           Displays service information.
    
  3. Remote control Mode

    This mode allows you to control streaming as a client.

    rpsa_client.exe -r -h IPs [-p PORT] -m start|stop|start_stop|start_dac|stop_dac|start_stop_dac [-t MSEC] [-v]
    rpsa_client.exe --remote --hosts=IPs [--port=PORT] --mode=start|stop|start_stop|start_dac|stop_dac|start_stop_dac [--timeout=MSEC] [--verbose]
    
    --remote               -r           Enable remote control mode.
    --hosts=IP,...         -h IP,...    You can specify one or more board IP addresses through a separator - ','
                                        Example: --hosts=127.0.0.1 or --hosts=127.0.0.1,127.0.0.2
                                                  -h 127.0.0.1     or  -h 127.0.0.1,127.0.0.2,127.0.0.3
    --port=PORT            -p PORT      Port for configuration server (Default: 8901).
    --mode=MODE            -m MODE      Commands for managing servers.
                                         Keys: start = Starts the server.
                                               stop = Stop the server.
                                               start_stop = Sends a start command at the end of the timeout sends a stop command.
                                               start_dac = Starts the DAC server.
                                               stop_dac = Stop the DAC server.
                                               start_stop_dac = Sends a start command at the end of the timeout sends a stop command for DAC mode.
    --timeout=MSEC         -t MSEC      Timeout (Default: 1000 ms). Used only in conjunction with the start_stop command.
    --verbose              -v           Displays service information.
    
  4. Streaming Mode

    This mode allows you to control streaming as a client, and also captures data in network streaming mode.

    rpsa_client.exe -s -h IPs [-p PORT] [-c PORT] -f tdms|wav|csv|bin [-d NAME] [-m raw|volt] [-l SAMPLES] [-t MSEC] [-v] [-b TD|F]
    rpsa_client.exe --streaming --hosts=IPs [--port=PORT] [--config_port=PORT] --format=tdms|wav|csv|bin [--dir=NAME] [--limit=SAMPLES] [--mode=raw|volt] [--timeout=MSEC] [--verbose] [--benchmark=TD|F]
    
    --streaming            -s           Enable streaming mode.
    --hosts=IP,...         -h IP,...    You can specify one or more board IP addresses through a separator - ','
                                        Example: --hosts=127.0.0.1 or --hosts=127.0.0.1,127.0.0.2
                                                  -h 127.0.0.1     or  -h 127.0.0.1,127.0.0.2,127.0.0.3
    --port=PORT            -p PORT      Port for streaming server (Default: 8900).
    --config_port=PORT     -c PORT      Port for configuration server (Default: 8901).
    --format=FORMAT        -f FORMAT    The format in which the data will be saved.
                                        Keys: tdsm = NI TDMS File Format.
                                              wav = Waveform Audio File Format.
                                              csv = Text file that uses a comma to separate values.
                                              bin = Binary format.
    --dir=NAME             -d NAME      Path to the directory where to save files.
    --limit=SAMPLES        -l SAMPLES   Sample limit [1-2147483647] (no limit by default).
    --mode=MODE            -m MODE      Convert values in volts (store as ADC raw data by default).
                                        Keys: raw = 8/16 Bit binary raw format.
                                              volt = Converts binary integer format to floating point format.
                                                     Measured in volts. In wav format, it is limited from -1 to 1.
    --timeout=MSEC         -t MSEC      Stops recording after a specified amount of time.
    --verbose              -v           Displays service information.
    --benchmark=MODE       -b MODE      Starts the throughput test mode at the current settings.
                                        Keys: TD = Adds validation of data. Works only in network test mode.
                                              F  = Full system performance testing.
    
  5. DAC streaming Mode

    This mode allows you to generate output data using a signal from a file.

    rpsa_client.exe -o -h IPs [-p PORT] [-c PORT] -f tdms|wav -d FILE_NAME [-r inf|COUNT] [-m SIZE] [-v] [-b]
    rpsa_client.exe --out_streaming --hosts=IPs [--port=PORT] [--config_port=PORT] --format=tdms|wav --data=FILE_NAME [--repeat=inf|COUNT] [--memory SIZE] [--verbose] [--benchmark]
    rpsa_client.exe -oc CONFIG_FILE
    rpsa_client.exe --out_streaming_conf CONFIG_FILE
    
    --out_streaming        -o           Enable dac streaming mode.
    --out_streaming_conf   -oc          Enable dac streaming mode.
    --hosts=IP,...         -h IP,...    You can specify one or more board IP addresses through a separator - ','
                                        Example: --hosts=127.0.0.1 or --hosts=127.0.0.1,127.0.0.2
                                                  -h 127.0.0.1     or  -h 127.0.0.1,127.0.0.2,127.0.0.3
    --port=PORT            -p PORT      Port for dac streaming server (Default: 8903).
    --config_port=PORT     -c PORT      Port for configuration server (Default: 8901).
    --format=FORMAT        -f FORMAT    The format in which the data will be used.
                                        Keys: tdsm = NI TDMS File Format.
                                              wav = Waveform Audio File Format.
    --data=FILE_NAME       -d FILE_NAME Path to the file for streaming.
    --memory=SIZE          -m SIZE      Use RAM cache.
                                            Example: --mmemory 1048576 or --memory 1M or --memory 1024k
                                                     -m 1048576 or -m 1M or -m 1024k
                                            Default: 1M bytes
    --repeat=inf|COUNT     -r inf|COUNT The number of times the file has been resent.
                                        Keys: inf is an infinite number of times.
                                           COUNT - value from [1 ... 1000000]
    --verbose              -v           Displays service information.
    --benchmark            -b           Starts the throughput test mode at the current settings.
    

3.2.7.4. Streaming to a remote computer via Desktop Application (Linux, Windows)

Note

The streaming client application currently does not work on Windows 11. This issue will be fixed in the future.

The other option for streaming is utilyzing the Desktop Application.

  1. Download the client application

    Files with clients are available here.

  2. Unzip and run the client

    • For Linux clients, after unpacking, the files (rpsa_client_qt.sh, bin/rpsa_client_qt) must be made executable.

      ../../../_images/qt1.png
    • For Windows clients, you need to grant access to the network.

      Note

      It is possible that an Antivirus program might block the desktop client. If you experience this issue, we recommend whitelisting the Streaming Client folder.

  3. Once the Desktop application is running it automatically detects boards on the network, if the Streaming Application is running on them. The boards and the client must be on the same network.

    ../../../_images/qt2.png

3.2.7.5. Source code

The Streaming application source code is available on our GitHub.