DSP Basics Tutorial: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Created page with "Note that this tutorial purposefully does not have screenshots of the flowgraphs, to encourage you to assemble them without just copying what you see. # Open the attached .gr...")
 
No edit summary
Line 2: Line 2:


# Open the attached .grc file.  This is the starting point that you will work off of, it just includes a special source I made, and a time and frequency sink (GUI).
# Open the attached .grc file.  This is the starting point that you will work off of, it just includes a special source I made, and a time and frequency sink (GUI).
# Run the flowgraph and use the time sink to figure out what this special source is outputting. What it's doing is creating 1's and 0's randomly (the 1's and 0's repeat for 15 samples), for the real part of the IQ signal (I), and then zeros for the imaginary part of the IQ signal (Q). This is called "On Off Keying" because we're just turning the I part of the signal on and off randomly (and we are leaving Q at zero).
# Run the flowgraph and use the time sink to figure out what this special source is outputting. What it's doing is creating 1's and 0's randomly (the 1's and 0's repeat for 15 samples), for the real part of the IQ signal (I), and then zeros for the imaginary part of the IQ signal (Q). This is called "On Off Keying" because we're just turning the I part of the signal on and off randomly (and we are leaving Q at zero).
# When we recieve anything in the real world there will be noise added.  So lets add some noise.  Add a "noise source" block with amplitude 0.1.  The amplitude adjusts how strong the noise is.
# When we recieve anything in the real world there will be noise added.  So lets add some noise.  Add a "noise source" block with amplitude 0.1.  The amplitude adjusts how strong the noise is.
# Lets add this noise to our sinusoid to see what it looks like in the time and frequency domain.  Use the "add" block, the inputs should be the signal source and the noise source.  Reconnect the time and frequency sink to the output of the add block.
# Lets add this noise to our sinusoid to see what it looks like in the time and frequency domain.  Use the "add" block, the inputs should be the signal source and the noise source.  Reconnect the time and frequency sink to the output of the add block.
# Run the flowgraph and note what changed in both time and frequency.
# Run the flowgraph and note what changed in both time and frequency.
# One issue with transmiting 1's and 0's directly is that the frequency domain of our signal is VERY "wide", i.e. the signal takes up a huge amount of spectrum/bandwidth.
# One issue with transmiting 1's and 0's directly is that the frequency domain of our signal is VERY "wide", i.e. the signal takes up a huge amount of spectrum/bandwidth.
# Lets filter the signal to reduce the amount of bandwidth it uses.  Add a "Low Pass Filter" block right after the On Off Keying source.  Use Cutoff Freq of 2500 and transition width of 500.
# Lets filter the signal to reduce the amount of bandwidth it uses.  Add a "Low Pass Filter" block right after the On Off Keying source.  Use Cutoff Freq of 2500 and transition width of 500.
# Run the flowgraph. Notice how the spikes in the frequency domain stop around 2500.  That's what setting a cutoff frequency of 2500 did.  The transition width just tells it how quickly the passband (frequencies we pass) transitions to a stopband (frequencies we block).
# Run the flowgraph. Notice how the spikes in the frequency domain stop around 2500.  That's what setting a cutoff frequency of 2500 did.  The transition width just tells it how quickly the passband (frequencies we pass) transitions to a stopband (frequencies we block).
# Now look at the time sink.  It doesn't go immediately from on-to-off anymore does it?  By limiting the frequencies our signal can be composed of, we prevent ourselves from being able to create a steep edge of a square wave.
# Now look at the time sink.  It doesn't go immediately from on-to-off anymore does it?  By limiting the frequencies our signal can be composed of, we prevent ourselves from being able to create a steep edge of a square wave.
 
# You may have noticed that there is a lot of energy at "DC" (a spike at 0 Hz in the frequency sink).  This is because our signal goes between 0 and # So the average value of our signal (in the time domain) is definitely not zero.  Lets try to make it zero (you will soon see why we want to).
# You may have noticed that there is a lot of energy at "DC" (a spike at 0 Hz in the frequency sink).  This is because our signal goes between 0 and 1. So the avergave value of our signal (in the time domain) is definitely not zero.  Lets try to make it zero.
 
# Add an "Add Const" block right after the On Off Keying source.  This block lets us add a constant value to our signal.  Use a "constant" of -0.5  So this is more of a subtract constant block.
# Add an "Add Const" block right after the On Off Keying source.  This block lets us add a constant value to our signal.  Use a "constant" of -0.5  So this is more of a subtract constant block.
# Run the flowgraph and look at the signal in the time domain.  It should be centered around zero now.  In the frequency domain we should see no more spike at DC.  Good job, we are finally transmitting a "decent" signal!  
# Run the flowgraph and look at the signal in the time domain.  It should be centered around zero now.  In the frequency domain we should see no more spike at DC.  Good job, we are finally transmitting a "decent" signal!  
# If you haven't realized it by now, we are essentially simulating a wireless transmitter. The chain of blocks going into the top port of the Add block is like our transmitter.  The Add block combined with the Noise Source is like a simulated wireless channel that adds noise.  The Time and Frequency sink show us what we might see at a reciever.
# If you haven't realized it by now, we are essentially simulating a wireless transmitter. The chain of blocks going into the top port of the Add block is like our transmitter.  The Add block combined with the Noise Source is like a simulated wireless channel that adds noise.  The Time and Frequency sink show us what we might see at a reciever.

Revision as of 19:05, 18 September 2018

Note that this tutorial purposefully does not have screenshots of the flowgraphs, to encourage you to assemble them without just copying what you see.

  1. Open the attached .grc file. This is the starting point that you will work off of, it just includes a special source I made, and a time and frequency sink (GUI).
  2. Run the flowgraph and use the time sink to figure out what this special source is outputting. What it's doing is creating 1's and 0's randomly (the 1's and 0's repeat for 15 samples), for the real part of the IQ signal (I), and then zeros for the imaginary part of the IQ signal (Q). This is called "On Off Keying" because we're just turning the I part of the signal on and off randomly (and we are leaving Q at zero).
  3. When we recieve anything in the real world there will be noise added. So lets add some noise. Add a "noise source" block with amplitude 0.1. The amplitude adjusts how strong the noise is.
  4. Lets add this noise to our sinusoid to see what it looks like in the time and frequency domain. Use the "add" block, the inputs should be the signal source and the noise source. Reconnect the time and frequency sink to the output of the add block.
  5. Run the flowgraph and note what changed in both time and frequency.
  6. One issue with transmiting 1's and 0's directly is that the frequency domain of our signal is VERY "wide", i.e. the signal takes up a huge amount of spectrum/bandwidth.
  7. Lets filter the signal to reduce the amount of bandwidth it uses. Add a "Low Pass Filter" block right after the On Off Keying source. Use Cutoff Freq of 2500 and transition width of 500.
  8. Run the flowgraph. Notice how the spikes in the frequency domain stop around 2500. That's what setting a cutoff frequency of 2500 did. The transition width just tells it how quickly the passband (frequencies we pass) transitions to a stopband (frequencies we block).
  9. Now look at the time sink. It doesn't go immediately from on-to-off anymore does it? By limiting the frequencies our signal can be composed of, we prevent ourselves from being able to create a steep edge of a square wave.
  10. You may have noticed that there is a lot of energy at "DC" (a spike at 0 Hz in the frequency sink). This is because our signal goes between 0 and # So the average value of our signal (in the time domain) is definitely not zero. Lets try to make it zero (you will soon see why we want to).
  11. Add an "Add Const" block right after the On Off Keying source. This block lets us add a constant value to our signal. Use a "constant" of -0.5 So this is more of a subtract constant block.
  12. Run the flowgraph and look at the signal in the time domain. It should be centered around zero now. In the frequency domain we should see no more spike at DC. Good job, we are finally transmitting a "decent" signal!
  13. If you haven't realized it by now, we are essentially simulating a wireless transmitter. The chain of blocks going into the top port of the Add block is like our transmitter. The Add block combined with the Noise Source is like a simulated wireless channel that adds noise. The Time and Frequency sink show us what we might see at a reciever.