59 lines
1.5 KiB
ReStructuredText
59 lines
1.5 KiB
ReStructuredText
.. _rx:
|
|
|
|
Example 1: SDR Reception
|
|
========================
|
|
|
|
.. contents::
|
|
:local:
|
|
|
|
Introduction
|
|
------------
|
|
|
|
The following examples demonstrate how to initialize an SDR, record a signal, and transmit a custom waveform.
|
|
These examples assume familiarity with Python and SDR concepts.
|
|
|
|
In this example, we use the [bladeRF](https://www.nuand.com/bladerf-1/). However, because
|
|
this package presents a common interface for all SDR devices, the same code can be used
|
|
to interface with additional supported radios.
|
|
|
|
Code
|
|
----
|
|
|
|
In this example, we initialize the `Blade` SDR, configure it to record a signal for a specified duration.
|
|
|
|
.. code-block:: python
|
|
|
|
import time
|
|
|
|
from ria_toolkit_oss.datatypes.recording import Recording
|
|
from ria_toolkit_oss.sdr.blade import Blade
|
|
|
|
my_radio = Blade()
|
|
print(my_radio)
|
|
print(type(my_radio))
|
|
|
|
my_radio.init_rx(
|
|
sample_rate=1e6,
|
|
center_frequency=2.44e9,
|
|
gain=50,
|
|
channel=0,
|
|
)
|
|
|
|
rx_time = 0.01
|
|
start = time.time()
|
|
my_rec = my_radio.record(rx_time=rx_time)
|
|
end = time.time()
|
|
|
|
print(f"Total time: {end - start} seconds")
|
|
print(f"Length of the recording: {len(my_rec)} samples")
|
|
|
|
.. todo::
|
|
|
|
Add one extra step to the end of this example to visualize the received signal
|
|
|
|
Conclusion
|
|
----------
|
|
|
|
This example demonstrates how to use the ``Blade`` class to receive samples into a ``Recording`` object. By customizing the parameters,
|
|
we can adapt this example to various signal processing and SDR tasks.
|