BPSK – Binary Phase Shift Keying

Key focus: BPSK, Binary Phase Shift Keying, bpsk modulation, bpsk demodulation, BPSK matlab, BPSK python implementation, BPSK constellation

BPSK – introduction

BPSK stands for Binary Phase Shift Keying. It is a type of modulation used in digital communication systems to transmit binary data over a communication channel.

In BPSK, the carrier signal is modulated by changing its phase by 180 degrees for each binary symbol. Specifically, a binary 0 is represented by a phase shift of 180 degrees, while a binary 1 is represented by no phase shift.

BPSK is a straightforward and effective modulation method and is frequently utilized in applications where the communication channel is susceptible to noise and interference. It is also utilized in different wireless communication systems like Wi-Fi, Bluetooth, and satellite communication.

Implementation details

Binary Phase Shift Keying (BPSK) is a two phase modulation scheme, where the 0’s and 1’s in a binary message are represented by two different phase states in the carrier signal: \(\theta=0^{\circ}\) for binary 1 and \(\theta=180^{\circ}\) for binary 0.

This article is part of the following books
Digital Modulations using Matlab : Build Simulation Models from Scratch, ISBN: 978-1521493885
Digital Modulations using Python ISBN: 978-1712321638
All books available in ebook (PDF) and Paperback formats

In digital modulation techniques, a set of basis functions are chosen for a particular modulation scheme. Generally, the basis functions are orthogonal to each other. Basis functions can be derived using Gram Schmidt orthogonalization procedure [1]. Once the basis functions are chosen, any vector in the signal space can be represented as a linear combination of them. In BPSK, only one sinusoid is taken as the basis function. Modulation is achieved by varying the phase of the sinusoid depending on the message bits. Therefore, within a bit duration \(T_b\), the two different phase states of the carrier signal are represented as,

\begin{align*} s_1(t) &= A_c\; cos\left(2 \pi f_c t \right), & 0 \leq t \leq T_b \quad \text{for binary 1}\\ s_0(t) &= A_c\; cos\left(2 \pi f_c t + \pi \right), & 0 \leq t \leq T_b \quad \text{for binary 0} \end{align*}

where, \(A_c\) is the amplitude of the sinusoidal signal, \(f_c\) is the carrier frequency \(Hz\), \(t\) being the instantaneous time in seconds, \(T_b\) is the bit period in seconds. The signal \(s_0(t)\) stands for the carrier signal when information bit \(a_k=0\) was transmitted and the signal \(s_1(t)\) denotes the carrier signal when information bit \(a_k=1\) was transmitted.

The constellation diagram for BPSK (Figure 3 below) will show two constellation points, lying entirely on the x axis (inphase). It has no projection on the y axis (quadrature). This means that the BPSK modulated signal will have an in-phase component but no quadrature component. This is because it has only one basis function. It can be noted that the carrier phases are \(180^{\circ}\) apart and it has constant envelope. The carrier’s phase contains all the information that is being transmitted.

BPSK transmitter

A BPSK transmitter, shown in Figure 1, is implemented by coding the message bits using NRZ coding (\(1\) represented by positive voltage and \(0\) represented by negative voltage) and multiplying the output by a reference oscillator running at carrier frequency \(f_c\).

BPSK transmitter (binary phase shift keying modulation)
Figure 1: BPSK transmitter

The following function (bpsk_mod) implements a baseband BPSK transmitter according to Figure 1. The output of the function is in baseband and it can optionally be multiplied with the carrier frequency outside the function. In order to get nice continuous curves, the oversampling factor (\(L\)) in the simulation should be appropriately chosen. If a carrier signal is used, it is convenient to choose the oversampling factor as the ratio of sampling frequency (\(f_s\)) and the carrier frequency (\(f_c\)). The chosen sampling frequency must satisfy the Nyquist sampling theorem with respect to carrier frequency. For baseband waveform simulation, the oversampling factor can simply be chosen as the ratio of bit period (\(T_b\)) to the chosen sampling period (\(T_s\)), where the sampling period is sufficiently smaller than the bit period.

Refer Digital Modulations using Matlab : Build Simulation Models from Scratch for full Matlab code.
Refer Digital Modulations using Python for full Python code

File 1: bpsk_mod.m: Baseband BPSK modulator

function [s_bb,t] = bpsk_mod(ak,L)
%Function to modulate an incoming binary stream using BPSK(baseband)
%ak - input binary data stream (0's and 1's) to modulate
%L - oversampling factor (Tb/Ts)
%s_bb - BPSK modulated signal(baseband)
%t - generated time base for the modulated signal
N = length(ak); %number of symbols
a = 2*ak-1; %BPSK modulation
ai=repmat(a,1,L).'; %bit stream at Tb baud with rect pulse shape
ai = ai(:).';%serialize
t=0:N*L-1; %time base
s_bb = ai;%BPSK modulated baseband signal

BPSK receiver

A correlation type coherent detector, shown in Figure 2, is used for receiver implementation. In coherent detection technique, the knowledge of the carrier frequency and phase must be known to the receiver. This can be achieved by using a Costas loop or a Phase Lock Loop (PLL) at the receiver. For simulation purposes, we simply assume that the carrier phase recovery was done and therefore we directly use the generated reference frequency at the receiver – \(cos( 2 \pi f_c t)\).

Figure 2: Coherent detection of BPSK (correlation type)

In the coherent receiver, the received signal is multiplied by a reference frequency signal from the carrier recovery blocks like PLL or Costas loop. Here, it is assumed that the PLL/Costas loop is present and the output is completely synchronized. The multiplied output is integrated over one bit period using an integrator. A threshold detector makes a decision on each integrated bit based on a threshold. Since, NRZ signaling format was used in the transmitter, the threshold for the detector would be set to \(0\). The function bpsk_demod, implements a baseband BPSK receiver according to Figure 2. To use this function in waveform simulation, first, the received waveform has to be downconverted to baseband, and then the function may be called.

Refer Digital Modulations using Matlab : Build Simulation Models from Scratch for full Matlab code.
Refer Digital Modulations using Python for full Python code

File 2: bpsk_demod.m: Baseband BPSK detection (correlation receiver)

function [ak_cap] = bpsk_demod(r_bb,L)
%Function to demodulate an BPSK(baseband) signal
%r_bb - received signal at the receiver front end (baseband)
%N - number of symbols transmitted
%L - oversampling factor (Tsym/Ts)
%ak_cap - detected binary stream
x=real(r_bb); %I arm
x = conv(x,ones(1,L));%integrate for L (Tb) duration
x = x(L:L:end);%I arm - sample at every L
ak_cap = (x > 0).'; %threshold detector

End-to-end simulation

The complete waveform simulation for the end-to-end transmission of information using BPSK modulation is given next. The simulation involves: generating random message bits, modulating them using BPSK modulation, addition of AWGN noise according to the chosen signal-to-noise ratio and demodulating the noisy signal using a coherent receiver. The topic of adding AWGN noise according to the chosen signal-to-noise ratio is discussed in section 4.1 in chapter 4. The resulting waveform plots are shown in the Figure 2.3. The performance simulation for the BPSK transmitter/receiver combination is also coded in the program shown next (see chapter 4 for more details on theoretical error rates).

The resulting performance curves will be same as the ones obtained using the complex baseband equivalent simulation technique in Figure 4.4 of chapter 4.

Refer Digital Modulations using Matlab : Build Simulation Models from Scratch for full Matlab code.
Refer Digital Modulations using Python for full Python code

File 3: bpsk_wfm_sim.m: Waveform simulation for BPSK modulation and demodulation

Figure 3: (a) Baseband BPSK signal,(b) transmitted BPSK signal – with carrier, (c) constellation at transmitter and (d) received signal with AWGN noise

References:

[1] Lloyd N. Trefethen, David Bau III , Numerical linear algebra, Philadelphia: Society for Industrial and Applied Mathematics, ISBN 978-0-89871-361-9, pp.56

Books by the author


Wireless Communication Systems in Matlab
Second Edition(PDF)

(180 votes, average: 3.62 out of 5)

Checkout Added to cart

Digital Modulations using Python
(PDF ebook)

(134 votes, average: 3.56 out of 5)

Checkout Added to cart

Digital Modulations using Matlab
(PDF ebook)

(136 votes, average: 3.63 out of 5)

Checkout Added to cart
Hand-picked Best books on Communication Engineering
Best books on Signal Processing

Topics in this chapter

Digital Modulators and Demodulators - Passband Simulation Models
Introduction
Binary Phase Shift Keying (BPSK)
 □ BPSK transmitter
 □ BPSK receiver
 □ End-to-end simulation
Coherent detection of Differentially Encoded BPSK (DEBPSK)
● Differential BPSK (D-BPSK)
 □ Sub-optimum receiver for DBPSK
 □ Optimum noncoherent receiver for DBPSK
Quadrature Phase Shift Keying (QPSK)
 □ QPSK transmitter
 □ QPSK receiver
 □ Performance simulation over AWGN
● Offset QPSK (O-QPSK)
● π/p=4-DQPSK
● Continuous Phase Modulation (CPM)
 □ Motivation behind CPM
 □ Continuous Phase Frequency Shift Keying (CPFSK) modulation
 □ Minimum Shift Keying (MSK)
Investigating phase transition properties
● Power Spectral Density (PSD) plots
Gaussian Minimum Shift Keying (GMSK)
 □ Pre-modulation Gaussian Low Pass Filter
 □ Quadrature implementation of GMSK modulator
 □ GMSK spectra
 □ GMSK demodulator
 □ Performance
● Frequency Shift Keying (FSK)
 □ Binary-FSK (BFSK)
 □ Orthogonality condition for non-coherent BFSK detection
 □ Orthogonality condition for coherent BFSK
 □ Modulator
 □ Coherent Demodulator
 □ Non-coherent Demodulator
 □ Performance simulation
 □ Power spectral density

Published by

Mathuranathan

Mathuranathan Viswanathan, is an author @ gaussianwaves.com that has garnered worldwide readership. He is a masters in communication engineering and has 12 years of technical expertise in channel modeling and has worked in various technologies ranging from read channel, OFDM, MIMO, 3GPP PHY layer, Data Science & Machine learning.

29 thoughts on “BPSK – Binary Phase Shift Keying”

  1. Hi, i just ordered your three books. Do you happen to show how to run any of your examples on low cost SDRs, like RTL-SDRs, bladeRFs, HackRFs, or LimeSDRs? Thx! Don

  2. Hello Mr. Mathuranathan,

    Why the Fc carrier frequency is 2*Rb(2/Tb). Can it be set to 1/Tb or 10/Tb…Aren’t we wasting the symbols if we set Fc other than 1/Tb

    1. Hi,
      There is no specific relationship between carrier frequency Fc and the bit rate Rb. Usually Fc >> Rb. If Fc is integral multiple of Rb, we will have full cycles of carrier waveform contained in a given bit period (Tb). For example, Fc = 2*Rb, you will have two whole cycles of carrier signal contained inside the bit period Tb.

      You can choose Fc = 10*Rb, then the simulation code has to process 10 cycles of signal for one bit of information transmitted, this consumes more memory and takes more time for executing the simulation (Typically in BER simulation, we will be processing minimum 10^5 to 10^6 bits for obtaining smooth BER curves).

  3. thanks mathuranathan for this interresting post,

    I want to know why the BPSK is sometimes a NRZ signal multiplied by a carrier(sin’2piftime)) and sometimes its represented by a sequence of 1 and -1.

    then is it Fc=2*Rc a condition we does respect usually ???? and why ?

  4. I don’t get the demodulation.

    Say you got r(t) is Acos(wt), so you multiply it with another cos(wt) and it becomes A[cos(wt)]^2, and then you integrate A[cos(wt)]^2? Where does this all lead?

  5. hi, I need help about laplacian distributed noise in additive white channel. What I need to do ?

  6. Hi mathuranathan

    please can you give me Theory BER equation in Rayleigh channel for QPSK Modulation?

    because i need to compare my simulated program with it

  7. Hi Zein,
    In the matlab code the carrier frequency (Fc) is set as twice the bit rate (Rb).

    You can modify the line (search for this line in the code)
    Fc=2*Rb

    or you can modify the bit rate Rb

    If you want to set your carrier frequency to 125KHz, the bit rate must be atleast half of this value.

    Fc=125*1000; %Fc =125KHz
    Then Rb has to be atmost
    Rb=62.5*1000; bit rate

  8. [time,nrzdata,Fs]=NRZ_Encoder(data,Rb,amplitude,’ploar’);
    i am getting error her
    NRZ encoder showing not defined
    what can i change for this function

  9. Please add the directory (in which you have downloaded the files given here) to the Matlab path.

    Open matlab, go to File-> Set Path and add the directory there.

    Now you should not get the “Function Not defined” error.

  10. PLL is used to track any frequency changes in the incoming signal to lock it with the carrier frequency.

    Here,the integrator functions as a Low pass filter that removes the harmonics created by the multiplier that precedes the integrator.

    Once the harmonics are removed, the threshold detector is used to detect ones and zeros.

    If we insert a sampler after the integrator, it becomes a correlator demodulator. The sampler samples the output of the integrator where the maximum occurs (it occurs at time instant T).

    To maximize the SNR performance of the receiver, a matched filter is usually used.

  11. i still have question about demodulator

    about function of component respectively :
    it uses PLL, to keep the carrier frequency to be same with carrier frequency at modulator, isn’t it ?

    detector, to convert signal to be digital form

    and for integrator, i still don’t know the purpose of it. why the signal must be integrated first before detector?

    thank you

    best regards

  12. The bpsk modulator is basically implemented by having a binary data stream (which is just a string of 1’s and 0’s) going into a NRZ coder. NRZ coder is used to assign some meaningful voltage to the incoming binary data stream. The NRZ coder converts 1’s to (say for example) 1V and 0’s to -1V. Then the output of NRZ is multiplied by a sinusoid to get modulated signal.

    Binary data stream is the input to NRZ coder.

  13. Hi Tan
    You can simulate BPSK with manchester code by simple changing the argument ‘Polar’ to ‘Manchester’ in line 20. The file is written for three line codes namely ‘Manchester’,’Polar’ and ‘Unipolar’.
    [time,nrzData,Fs]=NRZ_Encoder(data,Rb,amplitude,’Manchester’);

    You will see the difference between Manchester coded BPSK and polar coded BPSK by looking at their PSDs

  14. was just wondering, would it be possible to implement BPSK using manchester coding instead of the NRZ shown in the example mentioned? if it is, how could it be implemented and what would the tradeoffs be?

    any input would be greatly appreciated..

    thanks 🙂

  15. Thanks Bassel for pointing it out.

    psd will work till Matlab version 9 (although with a warning). Users can employ following syntax for plotting PSD.

    Hs=spectrum.welch;
    psd(Hs,bpskModulated,’Fs’,Fs)

  16. PSD is obsolete, please note in BPSK program, change:
    % Hpsd =psd(h,bpskModulated,’Fs’,Fs);

    to:

    Hpsd = pwelch(bpskModulated,[],[],[],Fs);

Post your valuable comments !!!Cancel reply