SCK LAB MANUAL SAMPLE - Renzym

23
SCK LAB MANUAL SAMPLE VERSION 1.2 THIS SAMPLE INCLUDES: TABLE OF CONTENTS TWO SELECTED LABS FULL VERSION IS PROVIDED FREE WITH KITS Phone: +92 51 8356095, Fax: +92 51 8311056 Email: [email protected] , URL:www.renzym.com REVISION HISTORY Revision Description Date 1.0 First draft March 20, 2013 1.1 Preface added and few labs updated May 15, 2013 1.2 Digital Communication labs added Feb 25, 2014

Transcript of SCK LAB MANUAL SAMPLE - Renzym

Page 1: SCK LAB MANUAL SAMPLE - Renzym

SCK LAB MANUAL SAMPLE VERSION 1.2

THIS SAMPLE INCLUDES:

TABLE OF CONTENTS

TWO SELECTED LABS

FULL VERSION IS PROVIDED FREE WITH KITS

Phone: +92 51 8356095, Fax: +92 51 8311056

Email: [email protected], URL:www.renzym.com

REVISION HISTORY

Revision Description Date

1.0 First draft March 20, 2013

1.1 Preface added and few labs updated May 15, 2013

1.2 Digital Communication labs added Feb 25, 2014

Page 2: SCK LAB MANUAL SAMPLE - Renzym

PREFACE

There has been always existed a gap between how communication systems are ‘taught in theory’

and ‘designed in practice’. Over the last decade or so the practice of communication system design

has gone through a drastic change. The classical approach was focused on the use of hardware

electronic components to build communication circuits. With the rapid increase in the digital

computational power and introduction of Software Defined Radio (SDR) concept, now the focus is on

building communication system in which main tasks are performed by the software. The key

advantage of this approach is that now it is possible for an undergrad student or a professional

engineer who is learning communication theory to directly apply his theoretical concepts and rapidly

build real-time communication system.

While the communication industry has adopted the new SDR technology for quite some time now,

education sector is still lacking behind. Most of books, lab manuals and training equipment are still

not up to date with the current trends of the market. Although the trend has started to change over

the last few years but still a lot of work still needs to be done. This lab manual is an effort to bridge

this gap between theory and practice of communication system design.

If we look at the existing lab equipment, it primarily falls into following two main categories.

1) Conventional Electronic Communication Trainers: These trainers are easy to use but they

don’t provide hands on system design experience. Such trainers come with fixed circuit-

boards and students are required to just change jumper settings to observe the outputs on

oscilloscope or voltmeter.

2) High-end SDR-based Platforms: These are relatively high end trainers which do provide

system design experience but students require specialized expertise and programming skills

to use them. These skills are not usually available with the undergraduate and even graduate

students. This is the reason why these platforms are not a good option for students’ labs

especially at undergraduate level.

Renzym lab equipment is an attempt to fill this void because not only it provides hands on design

experience but also it doesn’t require any specialized programming expertise. This lab manual

demonstrates the design of different analog communication systems using SDR Communication Kits

(SCK). SCK is USB powered, plug and play device that enables true SDR development directly from

class room Simulink/LabView simulations. It can be used to readily build real-time communication

systems by directly applying the concepts learnt from theory with a minimum of implementation

effort in the hardware. This blending of theory and practice is generally missing from most of the

communication courses. Theoretical performance of various techniques can now be quickly

compared with their performance in a real-world environment. Furthermore it provides a unique

opportunity to the researchers working on receiver design to verify their algorithms in various

practical scenarios with a minimum of implementation effort.

Page 3: SCK LAB MANUAL SAMPLE - Renzym

SDR Communication Kit

Complex baseband representation of passband communication system has been adopted in this

manual. This representation simplifies the system design by separating processing of information

bearing baseband signals from the carrier signals. An excellent description of this approach can be

found in a book by Michael P. Fitz titled “Fundamentals of Communications Systems”. The theory of

analog communication systems described in Professor Fitz’s book has been used for designing

related labs in this lab manual. Although we did provide brief theoretical explanation at the start of

every lab, it is still recommended that this book should be consulted by both, instructors and

students, during the labs.

With the help of powerful design tools like Simulink/Labview now it is possible to exactly implement

the theoretical concepts in practice. This is the reason why in this manual theoretical explanation of

the concepts precedes the Simulink implementation in every lab. Complete implementable block

diagrams have been explained with the help of mathematical equations. Students must understand

the theory before they attempt to design a system in Simulink. Lab tasks are provided wherever

necessary for student to take their learning experience to the next level by designing at their own

using what they learned in the previous labs.

It is also important to take a step-by-step approach while designing relatively complex system. A

common mistake that students often make is that they try to build a complete system first before

start testing it. It would make almost impossible to debug for mistakes and identify the source(s) of

error in a big system with tens of functional blocks. Therefore it is of utmost importance for students

to divide a big system into smaller subsystems and verify each system separately before connecting

them together to make complete system. In order to be able to subdivide a system and to be able to

verify the output of each individual system, one must have a clear theoretical understating of the

system functionality. Without such understanding it would be extremely difficult to successfully

design the complete system.

This manual covers a range of analog modulation schemes often used in practice. First two labs

provide introduction to Simulink and how to build and analyze a basic system in Simulink. In the

third lab complex baseband representation of passband system is introduced and key basic building

blocks like ‘Baseband to Passband Converter’ and ‘Passband to Baseband Converter’ are designed.

Fourth lab deals with the basic Double Sideband Amplitude Modulation (DSB-AM) scheme. SDR

Communication Kit (SCK) is introduced in the fifth lab and students will learn to interface SCK with

computer and send/receive basic physical signals using SCK. Furthermore DSB-AM system will also

be built using a pair of SCKs. Lab 6 and 7 will cover two popular schemes of amplitude modulation

namely Large Carrier-AM (commonly known as AM) and Single Sideband Carrier AM. Angle

modulation is treated in the Labs starting from 8 to 11 where Phase Modulation (PM) and Frequency

Modulation (FM) systems are covered. Students will build angle modulators and verify the Carson’s

bandwidth rule. Moreover they will design different modulators for both FM and PM signals

including direct phase detector, discriminator detector and PLL based modulator.

Page 4: SCK LAB MANUAL SAMPLE - Renzym

CONTENTS

Preface

Contents

Lab 1: Simulink Fundamentals

Lab 2: Basic Signal Processing

Lab 3: Complex Baseband Representation of Passband Communication Signals

Lab 4: Double-Sideband Suppressed-carrier Amplitude Modulation (DSBSC-AM)

Lab 5: Getting Started with SDR Communication Kit

Lab 6: Large Carrier Amplitude Modulation System (LC-AM)

Lab 7: Single Sideband AM (SSB-AM) using Transmitted Reference Based Demodulation

Lab 8: Angle Modulation

Lab 9: Angle Demodulation using Direct Phase Demodulator

Lab 10: Angle Demodulation Using Discriminator Detector

Lab 11: Digital Communication

Lab 12: Pulse Amplitude Modulation (PAM)

Lab 13: Phase Shift Keying (PSK)

Lab 14: Frequency Shift Keying (FSK)

Lab 15: C/C++ MEX S-Function

Lab 16: Symbol Timing Error and Recovery

Lab 17: Carrier Error and Recovery

Lab 18: Unique Word Phase and Frame Recovery

Lab 19: Bit Error Rate (BER)

Page 5: SCK LAB MANUAL SAMPLE - Renzym

Lab 6: Large Carrier Amplitude Modulation System (LC-

AM)

6.1 Lab Objective:

In this lab we will design Large Carrier Amplitude Modulation (LC-AM) systems. Key lab objectives

will be as follows

1) Simulate the analog amplitude modulation through envelop detection i.e. LC-AM.

2) Test the same model using SDR Communication Kits

3) Single Sideband AM using Transmitted Reference Based Demodulation

Following Simulink blocks will be used in this lab

1) ‘Sine Wave’ Block from Signal Processing Sources.

2) ‘Digital Filter Design’ block from Signal Processing Block set.

3) ‘Bandpass to Baseband’ and ‘Baseband to Passband’ converters (designed in previous labs)

6.2 LC-AM Modulator and Non-coherent Demodulator

The main advantage of LC-AM over DSBSC-AM is that it can detected by simple envelope detector

without any phase estimation. DSBSC-AM message signal modulates the

1) Envelope of the bandpass carrier signal in a continuous manner

2) Phase of the binary bandpass carrier in a binary fashion i.e. the carrier of the phase changes

from 0 to when message signal amplitude goes from +ve to –ve.

In fact, if the message signal never goes negative the envelope of the bandpass signal and the

message are identical up to a multiplicative constant. This desired characteristic is obtained if a DC

signal is added to the message signal to guarantee that the resulting signal always is positive. This

implies the complex envelope is an affine function of the message signal, i.e.

Where “ ” is a positive number. This modulation has

and

so the imaginary portion of the complex envelope is not used again in LC-AM. The resulting bandpass

signal and spectrum are given as

Block diagram of LC-AM modulator is shown in Figure ‎6.1.

Page 6: SCK LAB MANUAL SAMPLE - Renzym

Figure ‎6.1: LC-AM Modulator

The demodulator of LC consists of simple envelope detector. The output of bandpass to be baseband

converter at the receiver, in the absence of noise, can be written as

We can see that envelope of signal can be used to recover message signal, , by ignoring the

phase,

, because it doesn’t change its value. The envelope of the is given below

Message signal can be recovered from this envelope by applying a highpass filter, DC remover, as

shown in Figure ‎6.2.

Figure ‎6.2: LC-AM Demodulator

LC-AM differs from DSBSC-AM in that a DC term is added to the complex envelope. This DC term is

chosen such that or equivalently the envelope of the bandpass signal never passes

through zero. This implies that or equivalently

This constant “ ”, here denoted the modulation coefficient, is important in obtaining good

performance in a LC-AM system. Typically the time average of is zero the average power

There are two parts to the transmitted/received power:

(1) The power associated with the added carrier transmission

(2) The power associated with the message signal transmission

It is desirable to maximize the power in the message signal transmission and a factor that

characterizes this split in power in LC-AM is denoted the message to carrier power (MCPR).

Page 7: SCK LAB MANUAL SAMPLE - Renzym

It shows in order to maximize the modulation coefficient, , should be maximized. But it is

not possible to increase it beyond a certain level and for audio transmission practically

remains between 10-15%. This is the penalty which we have to pay for simplified envelope detection

based detection.

6.3 Design in Simulink

A Simulink design of LC-AM modulator and demodulator for sinusoidal message signal is shown in

Figure ‎6.3. Students are required to simulate an LC-AM system with the following parameters.

Input message amplitude,

Sampling frequency, Hz

Carrier Amplitude,

Carrier frequency, Hz

Student should calculate appropriate value of modulation co-efficient, , and and should

make it part of lab report. A careful design of highpass filter, DC remover, is also required at the

demodulator.

Figure ‎6.3: LC-AM System in Simulink

Students should verify their results by comparing the demodulator output signal with the input

message signal as shown in Figure ‎6.4.

Page 8: SCK LAB MANUAL SAMPLE - Renzym

Figure ‎6.4: Message signal and LC-AM demodulator output

Furthermore energy spectrums of the baseband signal, , and passband signal, , should be

verified by using spectrum scope as shown in Figure ‎6.5.

Figure ‎6.5: Spectrum plots for baseband and passband signals

6.4 Speech Transmission Using SDR Communication Kits

In this section we try to setup an LC-AM link for audio signal using SDR Communication kits. As

described earlier, we need two SCKs connected with two different computers; one acting as

modulator and other as receiver or demodulator. Simulink models for modulator and demodulator

will also split into two separate Simulink models. The setup would look like as shown in figure below

Page 9: SCK LAB MANUAL SAMPLE - Renzym

SDR KitUSB

Tx-side

USB

Rx-side

SDR Kit

Simulink

ModelSimulink Model

Figure ‎6.6: Transmission Setup using SCK

When connected, SCK should appear as a default sound card to the computer. It should be checked

from the audio device properties and SCK should be selected as default sound card. At the

transmitter end, modulator output should be sent to the SCK by using “To audio device” block which

can be found in ‘commonly used blocks’. SCK can also be selected as default output audio device

from “To audio device” block properties. LC-AM modulator providing output to SCK is shown in

Figure ‎6.7.

Figure ‎6.7: LC-AM Modulator with SCK

Please also note that block ‘From Multimedia File’ used in Figure ‎6.7 to provide input message signal

to the LC-AM modulator. Using this block any audio file can be provided as input signal. File will keep

on repeating after during the simulation. It is important to calculate audio signal bandwidth before

transmission and also adjust the variables like carrier frequency, modulation coefficient, sampling

frequency (it should be matched with the audio file sampling rate).

Simulink. Output of the demodulator can be sent to audio device by connecting it to “To audio

device” block as shown in Figure ‎6.8.

Page 10: SCK LAB MANUAL SAMPLE - Renzym

Figure ‎6.8: LC-AM Demodulator with SCK

Matlab is computationally intensive software so in order to have a smooth non-interrupted

transmission please remover all the plotting blocks like time ‘Scope’ or ‘Spectrum Scope’ etc.

Page 11: SCK LAB MANUAL SAMPLE - Renzym

Lab 14: Frequency Shift Keying (FSK)

14.1 : FSK Modulator

FSK modulators can be categorized into two types; discontinuous phase FSK (DPFSK), continuous

phase FSK (CPFSK). DPFSK is also known as noncoherent FSK and CPFSK is also known as coherent

phase FSK. The categorization is shown in Figure ‎14.1.

Discontinuous Phase FSK

FSK

Continuous Phase FSK

Figure ‎14.1: FSK Categorization

Discontinuous phase FSK and continuous phase FSK modulated signals are shown in Figure ‎14.2. As

shown in figure, DPFSK modulated signal has discontinuities at symbol boundaries. These

discontinuities increase signal bandwidth. Similarly CPFSK is also shown in the figure; where the

phase is coherent at symbol boundaries.

Continuous Phase FSK(CPFSK)/Coherent FSK

Discontinuous Phase FSK/Noncoherent FSK

Figure ‎14.2: FSK Modulated Signals

Page 12: SCK LAB MANUAL SAMPLE - Renzym

14.1.1 : DPFSK Modulator

Binary DPFSK modulator is given in Figure ‎14.3. The multiplexer switches between the sinusoids

at and . In general and are not the same, therefore the modulated signal is not

continuous at symbol boundaries. BFSK spectrum is given in Figure ‎14.4, that visualizes the relation

between and .

𝑠0( )

Binary DataSource

MUX

( )

𝑠1( )

Figure ‎14.3: Continuous Time Binary DPFSK Modulator

Consider,

𝑠

𝑠

Therefore,

This produces the sinusoids,

𝑠

𝑠

For better detection the frequencies are chosen to be at maximum separation i.e. achieved by

making then orthogonal. The two frequencies are orthogonal if the following equation is equal to

zero

When,

is equal to zero. This means that frequencies are orthogonal for multiples of,

Page 13: SCK LAB MANUAL SAMPLE - Renzym

The required frequency shifts for coherent CPFSK basis signals to be orthogonal can be expressed as.

This means all the frequencies shifts are multiples of half the symbol rate and frequency separation

is .

𝑐 0 1 𝑐 0 1

Figure ‎14.4: BFSK Spectrum

14.1.2 : CPFSK Modulator

For a binary FSK two waveforms are used to transmit a bit as given below

𝑠

𝑠 (‎14.1)

For a CPFSK the phase at the symbol transition boundaries should be continuous. To do so the

modulator must remember the phase during symbol transition. This is achieved by representing the

modulated signal in terms of current and previous symbol. A continuous phase BPSK modulator is

given in Figure ‎14.5.

LUT DAC VCO1,0,1

data

+1,-1+1

a(k) x(t)

y(t)

Figure ‎14.5: VCO Based FSK

The look up table outputs is

DAC produces a bipolar square wave with amplitude . DAC output can be expressed as

Where,

𝑠

The VCO output is expressed as

Page 14: SCK LAB MANUAL SAMPLE - Renzym

(‎14.2)

Where to produce a unit energy pulse shape. Consider look up table output during

to be , then the phase term in (‎14.2) becomes

Where,

Is constant , resulting in

(‎14.3)

Substituting (‎14.3) in (‎14.2) produces

Suppose then

For

(‎14.4)

For

(‎14.5)

As seen (‎14.4) and (‎14.5) are of the form given in (‎14.1). Now consider be the look up table

output during the DAC output is,

Then the phase term of VCO output becomes

Page 15: SCK LAB MANUAL SAMPLE - Renzym

Where

This produces the VCO output to be

The frequency shift is normalized by symbol rate, producing,

This makes the VCO output to be,

Where,

or is chosen so that the two basis signals of coherent CPSK are orthogonal. Correlation function

is used to check orthogonality as shown below.

When,

is equal to zero. This means that frequencies are orthogonal for multiples of,

The required frequency shifts for coherent CPFSK basis signals to be orthogonal can be expressed as.

Page 16: SCK LAB MANUAL SAMPLE - Renzym

This means all the frequencies shifts are multiples of quarter the symbol rate and frequency

separation is . The minimum frequency shift that produces orthogonal signals is.

FSK with is called Minimum Shift Keying (MSK). In terms of modulation index ( ), when

is equal to zero, This means that frequencies are orthogonal for multiple . For

MSK . Using proper frequencies or modulation index the following signals can be orthogonal

basis signals for BSK.

𝑠

𝑠

Or,

𝑠

𝑠

Modulator for orthogonal BSK is given in Figure ‎14.6.

LUT0 DAC

LUT1 DAC

0( )

1( )

𝜙0( )

𝜙1( )

( ) data

Figure ‎14.6: Continuous Time Binary Orthogonal FSK Modulator

Discrete time CPFSK modulated signal is represented as

Where,

Therefore,

Page 17: SCK LAB MANUAL SAMPLE - Renzym

For , modulation index is,

Therefore,

Where is sampled version of

This produces a discrete time CPSK modulator given in Figure ‎14.7.

LUT DAC

( )

c

z 1 ( ) data

NFIR

Filtercos()

d

VCO

Figure ‎14.7: Discrete Time CPFSK Modulator

14.2 : FSK Demodulator

FSK demodulator has two types, coherent demodulators and noncoherent demodulators. In

coherent demodulation theoretically it is assumed that the demodulator know the phase of received

signal, practically the phase of the received signal is estimated using phase recovery algorithm. In

noncoherent demodulation the demodulator does not require the phase of the received signal,

therefore noncoherent demodulation is preferred over coherent demodulation. DPKSF signals have

discontinuous phase at symbol boundaries i.e. phase changes at symbol boundaries therefore,

DPKSF received signal can only be demodulated noncoherently. CPFSK has continuous phase at

symbol boundaries therefore, CPFSK received signal can be demodulated coherently or

noncoherently.

14.2.1 : FSK Coherent Demodulator

Discrete time BFSK coherent demodulator is given in Figure ‎14.8. The received signal is sampled

using an ADC. The sampled signal is project onto 𝑠 and 𝑠 producing an estimate of

and . The projections are downsampled by , producing of and .

Page 18: SCK LAB MANUAL SAMPLE - Renzym

0( )

1( )

𝜙0( )

𝜙1( )

( )

Decision

(. )

(. )

DAC ( )

Figure ‎14.8: Discrete Time BFSK Coherent Demodulator

1

> 0?

0

1

Select Index of Largest

0

+

Figure ‎14.9: Decision Block

1 > 0 𝜙0

𝜙1

0 > 1

Figure ‎14.10: BFSK Decision Region

Decisions are taken on and , decision regions are defined in Figure ‎14.10. The decision

block can be implemented using different methods; some of them are shown in Figure ‎14.9.

Problem with this demodulator is that it is difficult to produce phase and frequency coherent

replicas of the basis function, therefore alternate methods are used for demodulation, where phase

coherent replicas are not required.

14.2.2 : FSK Noncoherent Demodulator

There are many noncoherent demodulators for FSK, such as; Differential detection FSK demodulator,

Foster Sealy FSK demodulator and Square Law FSK demodulator. Foster Sealy FSK demodulator and

Square Law FSK demodulator are discussed in the following sections.

14.2.2.1: Foster Sealy FSK Demodulator

Foster Sealy BFSK demodulator is shown in Figure ‎14.11, it is a noncoherent demodulator, i.e. the

demodulator does not require knowing the phase of the received signal.

Page 19: SCK LAB MANUAL SAMPLE - Renzym

BandpassFilter

( )

DAC ( )

Decision

EnvelopeDetection

BandpassFilter

EnvelopeDetection

Figure ‎14.11: Foster Sealy BFSK Demodulator

Signals at different stages are shown in Figure ‎14.11. As seen two bandpass filters are used, one

centered at and the other centered at . When frequency contents at are

present during a symbol time the frequency contents at are absent as shown by signals at

outputs of bandpass filters, similarly when frequency contents at are present during a

symbol time the frequency contents at are absent. This produces the envelope detector

outputs as shown by signals in figure. A difference of the envelope detector outputs produces the

desired symbol value.

14.2.2.2: Square Law FSK Demodulator

Continuous Time Square Law demodulator is shown in Figure ‎14.12. Continuous Time Square Law

demodulator uses a noncoherent projection of the received signal on to the two basis functions by

using quadrature mixers at each of the two possible frequencies. The outputs are integrated over a

symbol time and squared. The quadrature results are summed and passed to the decision block

which chooses the symbol associated with the largest output.

Page 20: SCK LAB MANUAL SAMPLE - Renzym

𝜙0( )

𝜙1( )

(. )

( )

. 2

. 2

𝜙0( )

𝜙1( )

. 2

. 2

Decision

(. )

(. )

(. )

Figure ‎14.12: Continuous Time Square Law BFSK Demodulator

To see how this works, let

𝑠

𝑠

Be the two possible transmitted signals. Now, suppose the received signal is

Now let’s compute the sampled outputs of the four integrators for :

Page 21: SCK LAB MANUAL SAMPLE - Renzym

Thus

And the correct decision is made. The key to proper performance is the orthogonality of the two

possible transmitted signals i.e.

Discrete Time implementation Square Law demodulator is shown in Figure ‎14.13

𝜙0( )

𝜙1( ) ( )

(. )

(. )

DAC ( )

. 2

. 2

𝜙0( )

𝜙1( )

(. )

(. )

. 2

. 2

Decision

Figure ‎14.13: Discrete Time Square Law Demodulator

14.3 : Design in Simulink

Using concepts described in section 14.1 and 14.2 CPFSK modulator and Square Law detector are

given in Figure ‎14.14.

The modulator is a direct implementation of the discrete time CPFSK modulator shown in Figure

‎14.7. For BFSK the look up table values are set to , where -1 is for bit 0 and 1 is for bit 1. -1

produces a frequency shift and 1 produces a frequency shift . Value of is

selected using the following equation.

Where for BFSK is loot up table values. The demodulator is a direct implementation of

Square Law FSK demodulator shown in Figure ‎14.12. The quadrature sinusoids for both paths are

Page 22: SCK LAB MANUAL SAMPLE - Renzym

generated using the sin wave block. The sin wave block is configured to produce a complex sinusoid,

where real part is the inphase cosine wave and the complex part is the quadrature phase sin wave.

The frequency is set to . The decision block used here is same as that used in PAM and PSK.

Figure ‎14.14: CPSK Modulator and Square Law Demodulator in Simulink

The output signals at different stags at the demodulator are shown below, where Figure ‎14.15

shows the receiver constellation and Figure ‎14.16 shows the transmitter filter output and the

upconverted transmitted signal.

Figure ‎14.15: Receiver Constellation

Page 23: SCK LAB MANUAL SAMPLE - Renzym

Figure ‎14.16: Transmitter Filter Output and Upconverted Transmitted Signal

14.4 : Lab Task

1. Design a non coherent BFSK modulator and Square Law BFSK Demodulator.

2. Design a coherent BFSK modulator and Foster Sealy BFSK Demodulator.

3. Design a coherent 4-FSK modulator and Foster Sealy 4-FSK Demodulator.

4. Design a coherent 4-FSK modulator and Square Law 4-FSK Demodulator.

7.81 7.815 7.82 7.825 7.83 7.835 7.84

-1.5

-1

-0.5

0

0.5

1

1.5

Time (secs)

Am

plit

ude

7.81 7.815 7.82 7.825 7.83 7.835 7.84

-1

-0.5

0

0.5

1

Time (secs)

Am

plit

ude

Offset=0