File Exchange

image thumbnail

Modulation & Demodulation in Zigbee

version 1.0 (12.3 KB) by

This Model has covered most of the physical layer blocks which is used in Zigbee Protocol.



View License

In the transmitter, spreading is done using a PN Sequence at chip rate of 2 Mcps and then the spreaded bits are modulated using OQPSK modulator. In the receiver side, OQPSK demodulation is done first,then the spreaded bits are despreaded using the delayed version of PN chip sequence. The delay in transmitted and received bits is 4us.

Comments and Ratings (22)

Fan Bu

Fan Bu (view profile)

why generator polynomial is [32 31 30 10 0] in pulse generator?

Mani kandan

where is the .m file for this zigbee simulation

Asmaa Romia

in this example the data didn't transmit over 2.4 GHz , what is the meaning of that ?

@Russul Haitham Sr, i have the same problem in the assembly 4 bits buffer
can you help me plz if you already find a solution

Hi everyone, I have some problems in designing zigbee transmitter. I am using OQPSK modulation in this design. when I use the assemble 4 bits buffer an error occurs:
" Input port 1 of the subsystem 'untitled2/Subsystem/Transmitter/D Flip-Flop1 Quadarature (Q-channel)/D Flip-Flop' cannot accept a frame-based signal, because the corresponding Inport block 'untitled2/Subsystem/Transmitter/D Flip-Flop1 Quadarature (Q-channel)/D Flip-Flop/D' has the parameter 'Latch by delaying outside signal' selected."
can any one help me please? and is it necessary to use this buffer after the spreaded data stream?
I would be thankful if any one can answer my questions.

can we give image as input in this zigbee model... if so how it can be done and also whether data rate can be changed below
250 Kbps?


Thank u Sir for previous suggesion...
many paper i have seen that they will use MSK modulation insteed of OQPSK ..when i am putting MSk in place of OQPSK block ...the simulation will work but the input is not equal to their is problem in tranport delay........
My 2nd que to u sir....why u are taking 4e-6 in delay block or is it because zigbee input is 250kbps .....or their is any calulation or this delay or can be calulated using any simulink block.....???


Jitesh (view profile)

The delay in samples is done to match bits from receiver and transmitter. The delay should have been 4us. The simulation delay due to the blocks was smaller than 4 us. Hence the output buffer is delayed.

As you have seen the model, i have not stored the received bits in any variable. So i don't a command from m-file will work. I suggest you to use block in simulink which uses the same equation as bertool command does.


Jitesh sir.....firstly thank u for this model my
how we draw the graph between EbN0 vs BER.....this graph is very important for performance analysis of any wireless comm. system.....this graph can be drown by writting BERTOOL command on command window.....but when i am simulating this file on bertool not show this graph.....please help me ....


Lorik (view profile)

Dear Jitesh,

In the receiver, can you please explain to me why you are delaying by 2 samples after the output buffer?

Thank you.


Jitesh (view profile)

@suryatapa Analag data cannot be given directly to this model. You have to sample it and give it in digital format as this model is working on baseband layer.

@Abiodun First the input data stream is scrambled using the PN sequence at 2Mcps. To scramble, I have converted the bits into bipolar format and then converted it back to unipolar as OQPSK modulator doesnt take bipolar bits as input.

The reverse will followed at receiver. To compare the sequence perfectly, I have added a transport delay block for PN sequence. This is only the physical layer mapping of Zigbee. Is there anything you didnt understand, tell me.


@ Jitesh, nice work you'v done here. please can you offer a brief explanation of the work flow of the model. i will appreciate you.

@ suryatapa, i think one can make use of the -from file- tool box under 'sources' in simulink library.


how to input some analog data instead of the random generator to the model?


Good work...


Jitesh (view profile)

@Zeeshan & @Mujahid
The 'Assemble 4 bits' block is the same buffer block. I have renamed it in my model for understanding the flow of model. The model runs in R2011a version and higher versions. You can use a normal buffer block of MATLAB version you have instead of 'Assemble 4 bits' block if it isn't working. Just make the buffer output size 4 in the parameter block and rest as it is. I am sure it will work.


I am reeving this error while running the ZigBee module, please help.

Error in 'Zigbee/Transmitter/Assemble 4 bits': This proxy block was inserted in the model because a block of type 'Buffer' could not be located during model load. Updating or simulating a model containing such a proxy block is not permitted


what is main purpose of Proxy block in receiver and how can we change it with other things?
same for Disassemble Packet in receiver?
Can you explain it Jitesh....
Thanks for support..


Jitesh (view profile)

You can double click the Zigbee Transmitter Block and receiver block to view the internal structure..


Anisur (view profile)

How the transmitter and receiver are designed ?
I can't find such block for this simulation.
Where it's located?


Jitesh (view profile)

The 'assemble 4 bits' block is same as buffer block in simulink library with output buffer size as 4 . There might be a change in your simulation settings.
This model works on MATLAB 7.12 .

I don't know why but the "assemble 4 bits" block in the transmitter and the dissamble packet in the reception isn't recognized.

Anyone knows how to solve this?

MATLAB Release
MATLAB 7.12 (R2011a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video