Skip to content

Commit

Permalink
Transmission with Pluto SDR working! closes #110
Browse files Browse the repository at this point in the history
  • Loading branch information
mgm8 committed Aug 29, 2024
1 parent 5c3a429 commit 2f5f44e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion spacelab_transmitter/pluto.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@


import adi
import numpy as np
from scipy import signal
import time

class Pluto:
"""
Expand All @@ -34,10 +37,11 @@ def __init__(self, sample_rate, gain):
:param sample_rate: Sample rate in S/s
:param gain: gain in dB (valid range is -90 to 0 dB)
"""
self._sample_rate = sample_rate
self._pluto = adi.Pluto("ip:192.168.2.1")
self._pluto.tx_hardwaregain_chan0 = int(gain)
self._pluto.sample_rate = int(sample_rate)
self._pluto.tx_rf_bandwidth = int(sample_rate)
self._pluto.tx_hardwaregain_chan0 = int(gain)

def transmit(self, samples, dur, rate, freq):
"""
Expand All @@ -50,7 +54,15 @@ def transmit(self, samples, dur, rate, freq):
:return: None.
"""
samples = samples / np.max(np.abs(samples))
samples = samples.astype(np.complex64)
samples = signal.resample_poly(samples, self._sample_rate, rate)
samples *= 2**14 # The PlutoSDR expects samples to be between -2^14 and +2^14, not -1 and +1 like some SDRs

self._pluto.tx_lo = int(freq)

self._pluto.tx(samples)

time.sleep(dur)

return True
2 changes: 1 addition & 1 deletion spacelab_transmitter/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
__copyright__ = "Copyright The SpaceLab-Transmitter Contributors"
__credits__ = ["Gabriel Mariano Marcelino, Vitória Beatriz Bianchin"]
__license__ = "GPLv3"
__version__ = "0.4.11"
__version__ = "0.4.12"
__maintainer__ = "Gabriel Mariano Marcelino - PU5GMA"
__email__ = "gabriel.mm8@gmail.com"
__status__ = "Development"

0 comments on commit 2f5f44e

Please sign in to comment.