Changes between Version 5 and Version 6 of Tutorials/k0SDR/Tutorial20


Ignore:
Timestamp:
Feb 14, 2017, 4:28:32 PM (8 years ago)
Author:
nilanjan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/k0SDR/Tutorial20

    v5 v6  
    1 == Example: A Simple Wireless Data Transfer via SDR ==
     1== Multi Channel Sample Processing & Visualization ==
    22
    3 Here is an example of a Quick and Dirty Radio (QDR) to transfer low data rate packets over the air using USRPs. For simplicity this QDR does not utilize any form of correction techniques or feedback for packet retransmission.
     3In this example we'll boxplot the received signal strength from several USRP channels on the MIMO rack.
    44
    5 We'll use two nodes on the grid: node14-7 as the transmitter and node1-20 as the receiver. Load the nodes with 'baseline-sdr-uhd-003.009.003.ndz'.
     5=== Hardware / software resources utilized ===
     61) upto 16 USRPs on the grid's MIMO rack \\
     72) controller node (ie. node21-1) imaged with ''ubuntu-14-04-64bit-uhd-003.010.001-gnu-3.7.10.ndz'' \\
     83) OML - Orbit Measurement Library to record measurements into database \\
     94) rf_hw_intf - application to configure a set of USRPs for receiving samples at a specified frequency, samples rate, gain, etc... \\
     105) sigproc_avg_bw_pwr - application for processing received samples and writing in OML database \\
    611
    7 Two applications are being utilized:
    8 1) rf_hw_intf - configures radio, sets frequency channel, samples rate, gain, reads / writes samples to / from radio front end to circular buffer.
    9 2) qdr - the sample processing application accesses circular buffer for processing sample data to / from packets.
    10 
    11 
    12 === Part 1: Run the applications for file transfer ===
    13 On node1-20, run the following commands to start the receiving process.
    14 
    15 node1-20> taskset 0x1 (rf_hw_intf  --freq 950e6 --gain 0 --rx-only &)
    16 
    17 node1-20> taskset 0x2 qdr --func rx --ftp-data file
    18 
     12=== Receive multi channel signal for processing and plotting ===
     131) From the grid console, image the controller node then turn on all the USRPs (on the MIMO rack) and the controller node.
    1914{{{
    20 linux; GNU C++ version 4.8.4; Boost_105400; UHD_003.009.004-0-unknown
    21 
    22 Creating the usrp device with: addr=192.168.10.2...
    23 -- Opening a USRP2/N-Series device...
    24 -- Current recv frame size: 1472 bytes
    25 -- Current send frame size: 1472 bytes
    26 Using Device: Single USRP:
    27   Device: USRP2 / N-Series Device
    28   Mboard 0: N210r4
    29   RX Channel: 0
    30     RX DSP: 0
    31     RX Dboard: A
    32     RX Subdev: SBXv3 RX
    33   TX Channel: 0
    34     TX DSP: 0
    35     TX Dboard: A
    36     TX Subdev: SBXv3 TX
    37 
    38 Setting RX Rate: 5.000000 Msps...
    39 Actual RX Rate: 5.000000 Msps...
    40 
    41 Setting RX Freq: 950.000000 MHz...
    42 Actual RX Freq: 950.000000 MHz...
    43 
    44 Setting RX Gain: 0.000000 dB...
    45 Actual RX Gain: 0.000000 dB...
    46 
    47 waiting for ready signal...
    48 Checking RX: LO: locked ...
    49 Setting TX Rate: 5.000000 Msps...
    50 Actual TX Rate: 5.000000 Msps...
    51 
    52 Setting TX Freq: 950.000000 MHz...
    53 Actual TX Freq: 950.000000 MHz...
    54 
    55 Setting TX Gain: 0.000000 dB...
    56 Actual TX Gain: 0.000000 dB...
    57 
    58 Checking TX: LO: locked ...
    59 Recv proc started...
    60 
    61 Preamble: 1
    62 Feedback: 0
    63 Return Acks: 0
    64 FEC: 0
    65 BC: 0 CC: 0 TC: 0
    66 Fast Walsh: 0
    67 Interleave: 0
    68 waiting for ready signal...
    69 SPB(SHM) = 256
    70 [3175.03] 0 0
    71 nf - - - - - - - - - - - - - - -
     15nilanjan@.grid:~$ omf load -i nilanjan@.grid:~$  -t node21-1
     16nilanjan@.grid:~$ omf tell -a on -t [[21,1],[23,1..8]]
    7217}}}
    7318
    74 Similarly on node14-7, start the transmitting process to send an audio file.
    75 
    76 node14-7> taskset 0x1 (rf_hw_intf --freq 950e6 --gain 20  --tx-only &)
    77 
    78 node14-7> taskset 0x2 qdr --func tx --ftp-data SimpleMinds.wav --intv 1000
    79 
     192) Set up tunneling via ssh from your local port 5100 to the grid.orbit-lab.org:5100
    8020{{{
    81 Creating the usrp device with: addr=192.168.10.2...
    82 -- Opening a USRP2/N-Series device...
    83 -- Current recv frame size: 1472 bytes
    84 -- Current send frame size: 1472 bytes
    85 Using Device: Single USRP:
    86   Device: USRP2 / N-Series Device
    87   Mboard 0: N210r4
    88   RX Channel: 0
    89     RX DSP: 0
    90     RX Dboard: A
    91     RX Subdev: SBXv3 RX
    92   TX Channel: 0
    93     TX DSP: 0
    94     TX Dboard: A
    95     TX Subdev: SBXv3 TX
    96 
    97 Setting RX Rate: 5.000000 Msps...
    98 Actual RX Rate: 5.000000 Msps...
    99 
    100 Setting RX Freq: 950.000000 MHz...
    101 Actual RX Freq: 950.000000 MHz...
    102 
    103 Setting RX Gain: 20.000000 dB...
    104 Actual RX Gain: 20.000000 dB...
    105 
    106 Checking RX: LO: locked ...
    107 Setting TX Rate: 5.000000 Msps...
    108 Actual TX Rate: 5.000000 Msps...
    109 
    110 Setting TX Freq: 950.000000 MHz...
    111 Actual TX Freq: 950.000000 MHz...
    112 
    113 Setting TX Gain: 20.000000 dB...
    114 Actual TX Gain: 20.000000 dB...
    115 
    116 Checking TX: LO: locked ...
    117 Xmit proc started...
    118 UDP receive proc started
    119 Receiver ready on port: 1339
    120 L
    121 
    122 Preamble: 1
    123 Feedback: 0
    124 Return Acks: 0
    125 FEC: 0
    126 BC: 0 CC: 0 TC: 0
    127 Fast Walsh: 0
    128 Interleave: 0
    129 SPB(SHM) = 256
    130 root@node14-7:~/RTX_LOOPBACK#
     21my_laptop> ssh -L 5100:grid.orbit-lab.org:5100 username@grid.orbit-lab.org
    13122}}}
    13223
    133 While the file is being received, verify that the file size is incrementing. The receiving file name should be the original file name (from the transmitter side) prefixed with "rx_". So look for the file name 'rx_SimpleMinds.wav'
    134 
    135 Since the file is a .wav audio format we should able to listen to the file as it is downloaded. Start a simple http file server on the receiving node (tunneling is required)
    136 
    137 node1-20> python -m SimpleHTTPServer 7000
    138 
    139 Use Chrome to access the server and click on the .wav file being received for playback.
    140 
    141 Once the transfer is complete, compare the file checksum.
    142 
    143 node14-7> sum SimpleMinds.wav
    144 03167 10205
    145 
    146 node1-20> sum rx_SimpleMinds.wav
    147 03167 10205
    148 
    149 If the check sums are different then at least some packets were demodulated incorrectly. The incorrect packets will result in distortion in the audio playback.
    150 
    151 === Part 2: View signal before demodulation ===
    152 Let's slow down the transfer process and look at the signals as they are being received. In order for packet demodulation, the receiver must know where the signal starts. The signal detection starts with the detection of a known sequence of patterns; in this case it is a dual tone signal. On possible detection a simple FFT based correlation is performed to find a start offset.
    153 The sample processing application can send a few buffers to octave for viewing pleasure, debugging or verification.
    154 
    155 Demodulation is carried on from this offset to convert the signal into formatted packets.
    156 
    157 Rerun the qdr application for raw data processing:
    158 
    159 node1-20> qdr --func rx --pdu-data --port 1337 --addr 10.10.0.10
    160 
    161 node14-7> qdr --func tx --pdu-data --intv 2000000
    162 
    163 From the grid console, run the script below to view signaling:
     243) Verify that Webproxy is running (this is required for remote web based streaming)
    16425{{{
    165 if (exist("rcv_sck","var") == 0)
    166   rcv_port = 1337;
    167   rcv_sck = fUDP_open_rx(rcv_port);
    168   printf("Recv UDP pkts on port %i\n", rcv_port)
    169 endif
    170 
    171 
    172   while(1),
    173     [recv_data, recv_count]=recv(rcv_sck,4000,MSG_WAITALL); y1 = typecast(uint8(recv_data), 'single complex');
    174     sleep(0.1)
    175     [recv_data, recv_count]=recv(rcv_sck,4000,MSG_DONTWAIT); y2 = typecast(uint8(recv_data), 'single complex');
    176     sleep(0.1)
    177     [recv_data, recv_count]=recv(rcv_sck,4000,MSG_DONTWAIT); y3 = typecast(uint8(recv_data), 'single complex');
    178     sleep(0.1)
    179     [recv_data, recv_count]=recv(rcv_sck,4000,MSG_DONTWAIT); y4 = typecast(uint8(recv_data), 'single complex');
    180     sleep(0.1)
    181 
    182     S1 = fft(y1);
    183     S2 = fft(y2);
    184     S3 = fft(y3);
    185     S4 = fft(y4);
    186     plot( [abs(S1) abs(S2) abs(S3) abs(S4)] )
    187   endwhile
     26nilanjan@.grid:~$ run-websock 5100 localhost:5101 --daemon
     27WebSocket server settings:
     28  - Listen on :5100
     29  - Flash security policy server
     30  - No SSL/TLS support (no cert file)
     31  - Backgrounding (daemon)
    18832}}}
    18933
    190  || [[Image(​view_sync_sig.2.png, width=700px)]] ||
     344) Open a ssh session into the controller node and run the hardware interface application to start streaming the receiver.
     35{{{
     36root@node21-1:> ./rf_hw_intf --conf "mimo1.xml,/devices/mimo_rx" --rx-only --cmd-port 5111
     37}}}
    19138
    192 === Part 3: Select receiver by preamble ===
     395) Open another ssh session into the controller node and run the sample processing application. This application measures the average bandwidth power of the received samples and writes the measurements into the OML database.
     40{{{
     41root@node21-1> ./sigproc_avg_bw_pwr
     42}}}
     43
     446) Run the box plotting server on the console. This server will query measurements from the OML database and forward to webpage display.
     45{{{
     46nilanjan@.grid:~$ box-plot-server --port 5101 --file /var/lib/oml2/measured_avg_bw_pwr.sq3
     47}}}
     48
     497) Finally if everything is working correctly, the measured power across different channels can be view from a Chrome browser - [http://www.orbit-lab.org/htdocs/visual/js_boxplot.html click me :)]
     50