Author Topic: BPSK Transceiver with ADALM-Pluto and Matlab  (Read 3747 times)

0 Members and 1 Guest are viewing this topic.

Offline yacinbmTopic starter

  • Newbie
  • Posts: 5
  • Country: ca
BPSK Transceiver with ADALM-Pluto and Matlab
« on: December 24, 2021, 04:22:42 am »
Hi everyone!

I'm currently working on implementing a BPSK transceiver with Matlab Simulink and my ADALM-Pluto.

Here is a quick summary of the specs I want for my system:
  • Bit rate: 25kbps
  • Carrier Frequency: 2.4GHz
  • Oversampling factor: 8
  • Sample Rate: Bit rate*Oversampling factor=25kbps*8=200ksps
  • Frame Length: 152bits (alternating 0s and 1s)

Here is my VERY simple transmission/reception line:
1357952-0

My Tx/Rx channels are connected together using an SMA cable in loopack. I know that my receiver is missing symbol/frame synchronization, but I'm getting a very unexpected constellation from the receiver of my Pluto (see below). I'm sending a very simple sequence of 1s and 0s modulated by BPSK, so I'm expecting to get a constellation without any points at (0,0i) and that resembles two dots centered around the origin on the Q axis.
1357946-1

 Just to be safe, I checked the constellation right before my Tx, and it has the desired shape:
1357958-2

Here's the configuration of my Simulink blocks (bit of a crowded image, sorry!):
1357964-3

Any help would be greatly appreciated! I've been stuck with this issue for a few days now and I can't seem to figure it out :(
Cheers from Canada!
 

Offline yacinbmTopic starter

  • Newbie
  • Posts: 5
  • Country: ca
Re: BPSK Transceiver with ADALM-Pluto and Matlab
« Reply #1 on: December 24, 2021, 01:05:20 pm »
If you guys need any other details, let me know!

Cheers
 

Offline yacinbmTopic starter

  • Newbie
  • Posts: 5
  • Country: ca
Re: BPSK Transceiver with ADALM-Pluto and Matlab
« Reply #2 on: December 24, 2021, 06:01:46 pm »
Hey all!

I went back to it this morning and got an idea. I split my transceiver module into two separate ones; one for the Tx and another for the Rx. I had the idea to try and run the models on two different computers since it could alleviate some of the computation from my desktop PC.

After doing this, I FINALLY GOT SOMETHING COHERENT! I modified my previous model to use a cosine shaping filter at the Tx/Rx and after doing some phase and frequency correction, I got the constellation below! I've gotta say, I'm suprised Simulink is so sh*t at handling this sort of operations compared to GNURadio, but I have to use Matlab for this project...

Next step is to try and figure out if my data was correctly sent over the air and if I can reconstruct it and the output :) I have actually started doing this and I'm getting a strange result. My frame uses a 13 bits Barker code for start of frame detection. At the receiver, I capture two complete frame and run a correlation between the received signal and a 13 bits Barker code. I get some peaks in the correlation result, indicating that I have detected the sequence. That being said, I get 4 peaks, instead of the expected 2 (at most!). I'll try using a longer Barker sequence to see if that helps.

Again, if you have any recommendations, please hit me up down below!
Cheers
« Last Edit: December 24, 2021, 06:03:32 pm by yacinbm »
 
The following users thanked this post: ahbushnell

Offline yacinbmTopic starter

  • Newbie
  • Posts: 5
  • Country: ca
Re: BPSK Transceiver with ADALM-Pluto and Matlab
« Reply #3 on: December 26, 2021, 07:31:21 pm »
Well, everything works now!

If you ever need some info for something similar, don't hesitate to get in touch :) I was able to send a string over the air and decode it on my receiver.
 

Offline 1design

  • Regular Contributor
  • *
  • Posts: 162
Re: BPSK Transceiver with ADALM-Pluto and Matlab
« Reply #4 on: December 27, 2021, 04:40:53 pm »
Great project, what fixed the synchronization issue on the receiver?
 

Offline yacinbmTopic starter

  • Newbie
  • Posts: 5
  • Country: ca
Re: BPSK Transceiver with ADALM-Pluto and Matlab
« Reply #5 on: December 28, 2021, 03:59:58 pm »
It was mostly the fact that Simulink couldn't handle the computation for the transmitter/receiver on a single PC (I think!) that was causing my synchronization woes.

When I moved it to a second computer for the receiver, the constellation got a lot better (no more (0,0i) points). The synchronization issues at the receiver were handled using 3 different blocks:
  • A coarse frequency estimator and frequency offset to try and correct for the inaccuracies of the ADALM-Pluto internal oscillator. This made the constellation rotate a little less around the origin.
  • A carrier synchronizer configured for BPSK and for the correct oversampling factor. This concentrated the constellation to the real axis, but didn't have the "two dot" shape at -1 and +1.
  • A symbol synchronizer block to sample the symbol at the correct phase. This finally gave me my final constellation with two circular points at +/-1, as expected for BPSK.

The rest of the synchronization was for the binary frame itself, in order to detect when it started. For this reason, I started my data frame with a 13bit barker code, which has the characteristic of having an auto-correlation value of 13 when and only when it has a zero sample offset. So, at the receiver, I made sure to capture a number of samples equal to the length of two whole frames. This ensured that I had at least a complete frame in every capture. Then, I simply ran a correlation on the captured data and a 13bit barker code, and measured where it was equal to 13 (or close to, because my symbols weren't perfect +/-1). You can do this with a Preamble Detector block in Simulink, which returns the index of the end of the detected preamble. Then, it was only a question of extracting the data from the frame and VoilĂ ! My simple BPSK ASCII transceiver was complete!

I still have a bit of an issue at the moment though. There is a phase ambiguity because of the PLLs used for synchronization (the synchronization is valid for both pi and 0 degrees in BPSK). The effect is that sometimes, all the bits in my frame are flipped, so instead of receiving 001101, I would receive 110010. I'll get back in touch if I find an elegant solution :)

P.S.: This will be used as an introductory project for students at Uni, so I don't think I'm allowed to share my files. That being said, if you're working on something similar and are having some issues, please don't hesitate to get in touch! I couldn't find a lot of info on how to do this with BPSK rather than QPSK.

Cheers :)
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1428
  • Country: de
Re: BPSK Transceiver with ADALM-Pluto and Matlab
« Reply #6 on: December 28, 2021, 04:26:18 pm »
Maybe it helps to take a look at the GNU Radio BPSK example.
 

Offline stranger452

  • Newbie
  • Posts: 1
  • Country: pk
Re: BPSK Transceiver with ADALM-Pluto and Matlab
« Reply #7 on: June 07, 2023, 07:38:36 am »
Hi!
Yacinbm
can you send me the simulink file of that bpsk Transmitter???????????
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf