 Welcome to this lecture on digital communication using GNU radio. Continuing with our exploration of evaluating digital communication methods using GNU radio, in this lecture we are going to start with quadrature amplitude modulation. This approach can be viewed as a combination of both amplitude shift keying as well as phase shift keying that you have viewed in the previous few lectures. There are several advantages in terms of the way signals can be generated in this approach are and in particular this provides a more efficient way to transmit information as well as we shall see when we discuss demodulation. The other thing that we will explore as part of this lecture is aspects related to frequency shift keying wherein variations in frequency are used to convey information and that is a special form of orthogonal modulation and this also has several trade-offs as we shall explore when we look at demodulation. So, in the past couple of lectures we have seen modulation formats, amplitude shift keying and phase shift keying. In the case of quam that is quadrature amplitude modulation, this can be viewed as a combination of both amplitude and phase shift keying. As an example, the quam 16 constellation is shown here. In this case there are 16 symbols laid out in the form of a grid. A sample bit allocation for the symbols is also provided. As you can see purely using the phase as criterion will not allow you to decode these symbols because this particular symbol and this particular symbol both of them have the same phase. Therefore, you need a combination of both the phase as well as the amplitude in order to decide which symbol was sent. The reason quadrature amplitude modulation is sometimes preferred over PSK that is phase shift keying is that this arrangement of constellation points as we shall see is more robust to noise than when you compare it to the phase shift keying analog that is phase shift keying 16 in this case. In this case as well we are still performing one-dimensional signaling your psi 1 is related to GTX of t and BK is one of these 16 symbols. Therefore, you can assume that you have one signal as the basis signal and these BKs are essentially values that are taken by this signal and these values essentially with magnitude and phase convey the bit information. Let us now just modify our previous GNU radio simulation which involved PSK to accommodate QAM. Before we move to GNU radio, let us observe how these symbols are laid out. For example, this symbol is 1 plus 1j, this symbol is 3 plus 1j, this symbol is 3 plus 3j while this symbol is 1 plus 3j. So in essence this constellation takes the values minus 3 minus 1 1 3 on the real or I axis and minus 3 minus 1 1 3 on the imaginary or the Q axis. This is useful for us to be able to construct this constellation in GNU radio along with the chunks to symbols block. In GNU radio if we now recall our PSK example, we just need to make two changes. The first is that this variable m has to become 16. So let us double click it and make it 16 to indicate that we are going to have one of 16 possible symbols. We shall say ok over here and the next is that in the chunks to symbols, we must enumerate these 16 possible symbols. For that we can remove this existing symbol table by selecting it and hitting delete then we can start typing minus 3 minus 3j minus 3 minus 1j minus 3 minus 1j minus 3 minus 1j plus 1j minus 3 plus 3j then minus 1 plus 3 or minus 1 minus 3j minus 1 minus 1j and so on and enumerate all the 16 symbols. However we can use a bit of python trickery to do this in a more neat way. I will show you how. Let us expand this a little bit and we will write a python expression that will simplify the generation of the symbol table. So we can say a plus j times 1j times b for a in and we will say minus 3 minus 1 minus 3 for b in minus 3 minus 1 1 3 and we must change the output type to complex. Now this is actually a list comprehension that takes all possible values in a that is minus 3 through minus 1 and all possible values in b is minus 3 to minus 1 1 3 and takes all combinations and constructs a list put your mouse over it you will see that you get minus 3 minus 3j minus 3 minus 1j minus 3 plus 1j you get and you get all of these and the length is 16. This is much less error prone although it uses python but if you want to enumerate it fully you can go ahead and do that as well. Let us say ok and now we are done and we are ready to look at how our quam constellation and quam modulation looks like. Let us execute this flow graph. Now in this case let us start by looking at this particular place. Let us again set the delay to 75 that we match these. Now in this case what do we see? We see that these waveforms take 1 2 3 4 possible values which are minus 3 minus 1 1 3 and the other waveform also take the similar values. If you look down at the constellation if you look at if you do the auto scale you will see one of 16 possible values appearing in this constellation. Finally how does this look in the case of the carrier waveform? When you modulate the carrier then remember that in this case this is a combination of amplitude and phase shift keying therefore you are seeing over here there is a phase change as well as an amplitude change. Over here again let me zoom in and show you there is a phase change as well as a magnitude change. That is what the feature of quam is in which case you are changing both the phase and the amplitude at every time interval. This is 10 millisecond this is 11 millisecond this is 12 milliseconds so we are still sending symbols at the rate of 1000 symbols per second but each symbol when you look at the carrier looks in this form wherein both the amplitude and phase undergo a change and as you can see from this squiggly waveforms you are able to detect the signal rather you are able to receive the signal and recover them of course your choice of the rectangular waveform leads to these slight oscillations nevertheless these are recoverable and reasonably match the transmit waveform. So one small lesson is to consider the quam 16 modulation constellation as a combination of two amplitude shift keying constellations that is if you look only at the real part it is minus 3 minus 1 1 3 only on the imaginary part it is minus 3 minus 1 1 3 so it is almost as though you are stuffing a an amplitude shift keying signal on the real axis or in phase part and an amplitude shift keying signal on the imaginary axis or the quadrature part and this is a simple way to understand how quam works more complicated quam constellations exist typically even powers of two although odd ones exist some examples include quam 64 and say quam 256 and so on to visualize it let us just do one thing really quickly we will first just make the constellation sync auto scale for convenience and let us make a let us say quam say minus 3 minus 1 1 3 let us make a quam 64 constellation in the case of quam 64 we are going to have not 4 but 8 possible values so let us generate these somewhat automatically to say NP dot a range for simplicity I am just going to go from 0 to 8 and I am going to subtract 3.5 because 0 through 7 the midpoint is 3.5 and let us do this in the second part as well let us put this around parenthesis this should be numpy yeah so numpy dot a range 8 gives us numbers from 0 through 7 and you subtract 3.5 that gives you numbers minus 3.5 minus 1 2.5 minus 1.5 minus half 1.5 2.5 minus 1.5 minus 3.5 and this gives you another 8 and thus you have an 8 cross 8 64 constellation and one more change is that we need to make m as 64 and now if you execute this flow graph you get all 64 possible constellation points and as you can see the number of amplitudes if you look carefully for the red and blue curves will be 8 possible amplitudes namely minus 3.5 minus 2.5 minus 1.5 and so on up to 3.5 and thus this is a combination of an m ask that is 8 ask on the real 8 ask on the imaginary so 2 amplitude shift keyed wave forms one on the real one on the imaginary so this is a summary of the quadrature amplitude modulation and its key differences between plane phase shift keying and amplitude shift keying. The last basic digital modulation format that we will be looking at is frequency shift keying wherein change in the frequency of the signal is used to convey information. For a simple description of an m ask system you can define s1 of t as e power j2 pi f1 t times i0 t indicating that this i0 t limits this function to between 0 and t. In other words s1 of t is this e power j2 pi f1 t between 0 and t and 0 elsewhere. s2 of t is e power j2 pi f2 t within the duration of one symbol so this i0 t is essentially a rectangular pulse between 0 and t similarly sm of t is e power j2 pi fm t i0 t. For a simple visualization we can look at a 2 fsk system wherein to send 0 you can send this particular cosine while to send 1 you send this particular cosine. These 2 cosines have a distinct property in that in the duration of one symbol which is from here to here you have 2 cycles while for sending 1 you have 4 cycles. So whenever you get 2 cycles you can conclude that the bit or symbol 0 was sent whenever you have 4 cycles within the same interval you can conclude that the bit or symbol 1 was sent. Therefore by varying the frequency within the duration of a symbol interval you are able to send different symbols. Now in this case unlike ASK, PSK and QAM the dimension of signaling is actually more. The reason is because this particular cosine assuming that it completes 2 cycles and this particular cosine assuming that it completes 4 full cycles within the duration of one symbol are essentially orthogonal. Therefore to model this particular fsk system in our signal basis picture we need to have 2 particular basis signals. Psi 1 of t being root of 2 upon t i0 t cos 2 pi f1 t, Psi 2 of t being root of 2 upon t i0 t cos 2 pi f2 t assuming that f1 and f2 times capital T are integers. This means that the signals which are actually being sent are proportional to 1 0 or 0 1 because we are either sending Psi 1 or Psi 2 with of course some appropriate scaling but this corresponds to orthogonal signaling because we are either sending 1 0 or 0 1 which corresponds to sending Psi 1 for that duration or Psi 2. So this is an example of 2 dimensional orthogonal signaling and there are various tradeoffs that are associated with this that we will look at when we look closely in the demodulation of the frequency shift keyed symbols. For now let us inspect how we can put together a frequency shift keyed signal in GNU radio. One minor aspect is that you can also write this as cos 2 pi f1 t cos 2 pi f2 t and so on without much of a loss because these are essentially conveying the same information for example s1 of t which is e power j 2 pi f1 t its real value also similarly conveys the same information. In general if you use e power j 2 pi f1 t it is not very common to use e power j minus 2 pi minus f1 t unless you use bi orthogonal signaling which is something we will look at later. Let us now put together a FSK modulated system in GNU radio. Let us now start working on an FSK system on GNU radio. To build this we will be using a new GNU radio block called VCO short for the voltage controlled oscillator. Let us first look at how it works and then build our FSK system. So I am going to first do control f for command f and grab VCO and take the VCO object and place it in our flow graph. I will get a throttle so control f for command f throttle make the throttle float we will do a real FSK experiment as opposed to a complex one. Let us also grab a time sync so control f for command f time sync double click this make it float add a grid make it auto scale we will connect these three items and for the VCO we need three parameters double click it first we need the sample rate let us first set the sample rate to 64000 for easier visualization and come here and set the sample rate to sample underscore rate. The next thing is sensitivity so the voltage controlled oscillator essentially gives you a signal of the form cos of 2 pi t times whatever is this sensitivity in other words you are able to control the frequency as a signal so whatever input you give you will get as a frequency so let us actually call this let us say 2 times let us say 3.1415 because we are approximating pi times 1000 in other words we are going to get whatever f we give gets multiplied by 1000 so we are going to actually choose our f as 1 and 2 which will correspond to 1000 hertz and 2000 hertz great. Now let me add a constant source so control f for command f constant source double click this make it float and make it value 1 and connect this over here we will save it. Now you have to set the amplitude to 1 if you execute this flow graph you will get a sinusoid of course there is some bit of movement that is because we did not do the pi correctly we can actually handle it let us actually do control f for command f say import we will grab here double click it and say import num pi and we will change the sensitivity to 2 times num pi dot pi times 1000 let us execute this now now it is reasonably stable and if you zoom in you can see that this is a cosine 9 milliseconds 10 milliseconds a cosine of exactly 1000 hertz if I change this constant source to 2 you can see twice the number of cycles this starts at 9.5 this starts at 10 this is at 10.5 so this is a cosine for of 2 kilo hertz in other words your understanding is that whatever the sensitivity is gets multiplied by the input and that becomes the frequency of your cosine this is used very commonly in the context of phase lock loops and frequency trackers as well but we are using the voltage controlled oscillator to produce a frequency shift keyed signal let us now replace our constant source with an actual useful source that we want so we will use first a random source so control f for command f random source minimum 0 maximum is 2 it will give us values of the form 0 and 1 we will next grab our chunks to symbols so control f for command f grab the chunks to symbols place it on our flow graph and the chunks to symbol we will double click make it float and the symbol table we will make is a 1 and 2 because we want a 1000 hertz and a 2000 hertz sinusoid or cosines we will make this 1 and 2 dimension is 1 we will connect this over here connect this over here but before we go ahead we do not want to vary the sinusoid very very quickly and in fact we have a mandate to make this particular symbol rate a 1000 symbols per second therefore we are going to hold this particular value for a 1000 symbols so I am going to get an interpolating f i r filter control f for command f interpolating f i r filter much like we have been doing so far let us make this float let us make the interpolation sample rate w divided 1000 this will give us sampling rate divided by 1000 which is 64 in this case and we need ones of the exact same number this essentially holds this value and therefore will hold the frequency of the voltage control oscillator for one millisecond so connect these and now if we visualize we will now get our frequency shift key waveform let us stop this and analyze over here is 6 milliseconds over here is let us say here is 6 milliseconds here is 7 milliseconds you have about one cycle which means that this is exactly a 1 kilohertz cosine but over here let us say between 8 milliseconds and let us say this 8 milliseconds and 8.5 milliseconds again you guess I guess you have one cycle this corresponds to a 2 kilohertz sinusoid so between 8 and 9 milliseconds you have 2 cycles again here from 9 milliseconds to 10 milliseconds you have one cycle from 10 milliseconds to 11 milliseconds you have 2 cycles so this way you are able to encode the 0 as one particular frequency and the 1 as another frequency so this essentially is your frequency shift keyed waveform let us also inspect the baseband spectrum control f for command f and f r e q get the q t g y frequency sync float and connect it you will see if you execute this that there are these 2 peaks one is at minus 1 another is around minus 2 so therefore there is a strong presence of 1 kilohertz and minus sorry 1 kilohertz and 2 kilohertz which is explained by the fact that these are the 2 signals that we are essentially sending I will now remove this q t g y frequency sync now in order to go to passband and come back to baseband we will use the same procedure we will first multiply this voltage controlled oscillator by an f c valued signal carrier meaning a carrier whose frequency is f c then again multiplied by a similar carrier and we do not have we will not use a sign you sign analog because we are only doing real signaling so there is only i and no q and we will try to recover the information let us go about this in the exact same way that we have been doing it so control f for command f signal source we will double click the signal source make it float and make the frequency f c of course we need to declare a variable called f c so control f for command f and say variable grab the variable over here call it f c and make it 8000 hertz as we have been doing so far next we say multiply so control f for command f multiply get the multiplication block double click it convert it to float and we will multiply the output of our voltage control oscillator with this signal source let us also change the amplitude of the signal source to root 2 so 1.414 and this will become our modulated capacitor passband signal let us just copy this time sink by doing clicking on it say control c or command c and courtesy command v visualize this visualizing this clearly shows that the carrier is modulated and if we stop this and view it we will see that sometimes there are close peaks sometimes there are far off peaks indicating that the frequency is slightly changed so therefore what you will end up having is f c and affected by 1 kilohertz and f c affected by 2 kilohertz therefore 8 kilohertz is effectively going to become 7 or to 9 or 6 to 10 kilohertz this is something which you can confirm by looking at the frequency domain waveform for this let us now demodulate this or rather bring this down convert this waveform to the power to the base band let us remove this qt gi time sink we will duplicate this signal source by doing control c and control v we will again duplicate this multiplier control c control v and grab this multiplier over here we will multiply this signal with the output of the signal source and we will also add a filter to remove the components near 2 fc so control f or command f low pass filter grab the low pass filter double click it as always we will be setting the cutoff frequency to f c and transition will make it 1000 hertz we will also make it float to float we will connect it over here now we need a delay so let us again do the same thing I am going to delete this I am going to do control f or command f grab delay and in this case I am not adding a range I am just going to hard code the delay as 75 connect the throttle to the input connect this to the output finally increase the number of inputs over here and connect this output over here this was a mistake apologies this output should go here now if you visualize the output you can clearly see that the base band waveform has been recovered that is the red one and is reasonably close to the original waveform indicating that we have been able to recover the signal carefully you will not see significant aberrations in this particular situation although they are there but the frequency spectral occupation does correspond to a rectangular pulse in this case as well so in this way you can put together a frequency shift key waveform if you want you can expand the random source and the stable to have more frequencies as well for example if we make this 4 4 and if we make this 1 2 3 and 4 you will now get 4 frequencies you can see that there are now a multitude of frequencies and you can analyze and find out that these are 1 kHz 2 kHz 3 kHz and 4 kHz if you look at the frequency spectrum you will see something very similar in this lecture we have carefully gone through both quadrature amplitude modulation and frequency shift key as you would have observed both in the base band as well as the pass band waveforms in case of quadrature amplitude modulation you are able to see both the amplitude changes as well as the phase changes in the case of FSK or frequency shift key you have seen that within a particular symbol block just estimating the frequency is able to convey information and in this case you are essentially using frequency variations in order to convey information of course you can extend this to say amplitude plus frequency shift keying as well and many such variations all of which are used and which have their own advantages and disadvantages. One major limitation that we encountered in our past few lectures is that the use of the rectangular signal results in those ringing effects primarily because it is not band limited in practice having a band unlimited pulse GTX of t is not practically feasible because of the fact that you have spectrum restrictions. So, in the next few lectures we will explore ways by which you can get inter-symbol interference free communication that is how we can recover these symbols while not using a rectangular waveform and being within the spectral constraints that are imposed upon us. Thank you.