A beginner’s guide to power of IQ data and beauty of negative frequencies – Part 2

A beginner’s guide to power of IQ data and beauty of negative frequencies – Part 2



Introduction and editor’s note

This is a two-part series where DI authors Damian and Phoenix Bonicatto explore the IQ signal representation and negative frequencies. Part 1 explains the commonly used SDR IQ signal representation and negative frequencies without the complexity of math.

This final part (Part 2) presents a device that allows you to play with and display live SDR signal spectrums with negative frequencies.

Wow the engineering world with your unique design: Design Ideas Submission Guide

Defining real and imaginary signals

Let’s start off with something I left out on purpose in Part 1, there are two more terms we will use: A “real” signal is a term used for the signal represented by the I data. “Imaginary” signal is the term used for the signal represented by the Q data. I left them out until now as they add to the obfuscation of the discussion. Just take them at face value as there is nothing imaginary about an “imaginary” signal.

The “I/Q Explorer” design

Okay, so what we are going to make is an Arduino Nano based device that can generate “real” and “imaginary” data (I and Q samples) per your settings of frequency, amplitude, and phase. Then it will display a spectrum showing positive and negative frequencies. We will not use the FFT feature of your scope, we will generate the spectrum in the MCU and send it out to the oscilloscope to form a trace in the shape of the spectrum. In fact, we will generate a spectrum for the real signal, imaginary signal, and the magnitude of the combination (this is the square root of the sum of the squares of the real and imaginary signals).

We will refer to this design as the I/Q Explorer (Figure 1).

Figure 1 The final I/Q Explorer design with an LCD for displaying menu items and values and a toggle switch to switch the scope between the time and frequency domains.

Let’s look at the schematic in Figure 2.

Figure 2 The schematic of the IQ Explorer device with an Arduino Nano, 4×20 LCD, two rotary encoders, a simple toggle switch, three analog outputs, three lines to go to the scope probes, a digital output, and BNC connectors.

You can see the I/Q Explorer has a relatively simple schematic. It’s based on an Arduino Nano and uses a 4×20 LCD for displaying menu items and values. The two rotary encoders are used to navigate through the menu and to change values. A simple toggle switch is used to change the scope view from the time domain to frequency domain. There are three analog outputs, created using PWM outputs and single pole RC low-pass filters. The three lines go to the scope probes (you don’t need to connect all three if you don’t have a 4-channel scope). There is also a digital output used as a trigger to sync the scope to the analog outputs. The only other electrical parts are two BNC connectors which can be used if you want to get signals from a signal generator, instead of the internal generated signals.

The test stand itself can be easily 3D printed (a link to the 3D files and Arduino code are at the end of the article). The test stand provides a place to mount the LCD, rotary encoders and the time/frequency switch. Two BNC connectors can be installed on the left side. On the right side is a place to install four wires that will be used to clip the scope probe on (you also need to clip one of the leads to a ground). The rest on the circuitry can be laid out on a small solderless breadboard. The breadboard then fits on the back of the test stand. A document showing more images, BOM, and additional instructions can be found in the download from the link at the end of the article.

Using the I/Q Explorer

Ok, what can you do with it now? First, the left side of the test stand has four bare wires that are used to connect the scope probes (also connect one scope probe ground to digital ground on the breadboard. The top wire is the real data, the next one down is the imaginary data, then the magnitude, and the bottom one is the trigger. Connect the real, imaginary, and magnitude to the three inputs of your scope (if you only have a two-channel scope, you can connect the real and imaginary only, without missing much). The trigger can be connected to the last scope channel or to the external trigger of your scope.

Now, set the Freq/Time switch to Freq. On your scope, set the vertical to 2v/div, for each of the inputs. Also set the sweep to 20ms/div.

Now you can power the system via the USB connection on the Arduino Nano. Spread out the traces on the scope and set the scope to trigger using the trigger input. You can now hide the trigger trace. The traces should look like what we see in Figure 3.

Figure 3 The starting spectrum from -2500 to +2500 Hz where there is signal energy at both -1500 and +1500 Hz.

Now adjust the horizontal position so the traces are centered. Ignore the time axis on the bottom and the voltage axis on the right side—they are irrelevant (turn them off if your scope has such a feature). The left-to-right axis is frequency with -2500 Hz on the left side and +2500 Hz on the right side. DC or 0 Hz is the center line. (On scopes with 10 major horizontal markings, each major marking measures off 500 Hz increments.) Vertical is only a relative, auto-scaled, value so it is best to keep the volts/div the same for the real, imaginary, and magnitude traces. So, in Figure 3 you can see we have signal energy at both +1500 Hz and -1500 Hz. (Note, on boot up the real signal is 100 while the imaginary amplitude is 0.)

You will see a menu on the I/Q Explorer LCD. Rotating the left rotary encoder will allow you to move up and down in the menu. The right rotary encoder allows you to change the values of the menu item next to the flashing cursor (second line from the top of the LCD). In the menu you can change the frequency, amplitude and the phase of the real (I data) or imaginary (Q data) signals.) Note that changing the frequency of either the real or imaginary will change the other—they need to be at the same frequency.) The menu also has items to print data, plot data, turn on/off windowing, turn on/off a mixer, and change the source for the FFT from the internal generated data to external signal from a signal generator.

As a sanity check, Figure 4 is a plot of the real output from a simulation package using the same signals, sample rate, and number of samples. These are as follows: The real signal used has an amplitude of 100 and the imaginary signal has an amplitude of 0. The frequency of both is 1500 Hz. The sample rate is 5000 samples/second and the number of samples used in the FFT is 64.

Figure 4 Real FFT simulation using the same settings where the real signal has an amplitude of 100, the imaginary signal has an amplitude of 0, the frequency of both is 1500 Hz, the sample rate is 5000 samples/second, and the number of samples used in the FFT is 64.

You can see that the real signal matches nicely.

Adjusting real and imaginary signal settings

Let’s change the imaginary signal so it has the same amplitude as the real signal. Set the imaginary amplitude to 100. Now we get the following in Figure 5.

Figure 5 The FFT when imaginary and real amplitudes are the same (set to 100).

You can see we only have a signal at +1500 Hz…there is no negative frequency component.

If we flip the Freq/Time to “Time” you will be able to see the time domain samples used to generate the FFT, without adjusting anything on the scope.

Mixer mode

Now let’s try quadrature (complex-to-complex) mixing. Move down in the menu and turn on “Mixer” (more on moving and adjusting settings in the download). This will do the mix using the real and imaginary signals you have sets, and a fixed signal having its real and imaginary setting of 1000 Hz, and amplitudes of 100 and phases set to 0. What you will at first is shown in Figure 6.

Figure 6 Quadrature mixing of 1500 Hz with 1000 Hz showing the signal at 500 Hz and an image created at 2000 Hz.

You can see two things. First, the signal is now at 500 Hz, the difference of 1500 Hz from our signal and the 1000Hz from the mix signal. Second, there is an image created at 2000 Hz (1500 Hz + 500 Hz) but it has been removed by the mathematics of the mixer.

Next change the frequency of the real or imaginary signal (remember one will change the other) to 500 Hz. Also note, as you turn the dial, the FFT frequency will slide down as you approach 500 Hz. And as you go past 1000 Hz you will see the FFT in the negative frequency area. When you get to 500 Hz you will see this in Figure 7.

Figure 7 Quadrature (complex-to-complex) mixing of 500 Hz with 1000 Hz.

You now have generated a negative frequency—as simple as that.

Note that you can also see the plot, of any of the displayed FFTs, on the PC by using the “Serial Plot” selection. You can also get a view of the numerical data by using the “Serial Print Data” selection.

More fun IQ manipulation

So now that you’ve seen a few examples, you can explore I/Q data and quadrature mixing by changing things like the amplitude of the real and/or imaginary signals. Also, try changing the phase of signals. After you get a grasp of that try changing the phase of either. To get a real handle on this, see if you can manipulate the trig equations to better understand how you get to that FFT. The system also has a windowing function, you can play with, that adjusts amplitudes of the data points before the FFT is calculated (for those who know these things, it is a Hann window). 

Remember, you can also use actual external signals, such as those from a two-channel signal generator, to perform the same tests. You’ll note though, the FFTs are not quite as stable. There is more information on that in the downloadable notes.

One last thought; you’ll find lots of discussion on whether negative frequencies are real (in the traditional sense) or not. My two cents is they are not physically real as they cannot be transmitted as a single waveform, but they are a very nice mathematical construct that allows us to manipulate the signals that we can receive. Let the arguing begin.

To download 3D printable files and document containing more operating info, a BOM, and extra photo, visit:

The Arduino Nano code can be found at: Arduino Nano code can be found at:

Damian Bonicatto is a consulting engineer with decades of experience in embedded hardware, firmware, and system design. He holds over 30 patents.

Phoenix Bonicatto is a freelance writer.

 Related Content

  • A beginner’s guide to power of IQ data and beauty of negative frequencies – Part 1
  • Exploring software-defined radio (without the annoying RF) – Part 1
  • Exploring software-defined radio (without the annoying RF)—Part 2
  • SDR Basics Part 3: Transmitters
  • The virtual reality of 5G – Part 2 (measurements)
  • Ultra-wideband I/Q demodulator improves receiver performance
<!–
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-native’); });
–>

The post A beginner’s guide to power of IQ data and beauty of negative frequencies – Part 2 appeared first on EDN.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *