Closed satfan52 closed 4 years ago
Hello,
Here is an updated version of your script that adds the functionality that I requested in this ticket. It only works for my PlutoSDR some additional work would be required to make it work with any device. I am sure it is possible though.
Thanks for your help Regards Peter
#!/usr/bin/python
import requests
import json
import argparse
api_url_rx = "http://127.0.0.1:8091/sdrangel/deviceset/0/channel/0/settings"
api_url_tx = "http://127.0.0.1:8091/sdrangel/deviceset/1/channel/0/settings"
api_url_rx2 = "http://127.0.0.1:8091/sdrangel/deviceset/0/device/settings"
api_url_tx2 = "http://127.0.0.1:8091/sdrangel/deviceset/1/device/settings"
parser = argparse.ArgumentParser(description="RX/TX control for sdrangel")
arg_group = parser.add_mutually_exclusive_group(required=True)
arg_group.add_argument('--rx', action='store_true', help='mutes the audio of the SSB modulator (device set 0, channel 0) but does not stop the transmitter (device set 1)')
arg_group.add_argument('--tx', action='store_true', help='mutes the audio of the SSB demodulator (device set 1, channel 0) but does not stop the receiver (device set 0)')
parser.add_argument('--txoffs', type=float, default=0, help='offset (in Hz) between SSB modulator and demodulator delta frequencies: TX ssb_mod = RX ssb_demod + TXOFFS')
parser.add_argument('--txrxoffs', type=float, default=0, help='offset (in Hz) between TX and RX central frequencies: TX cent.freq = RX cent.freq + TXRXOFFS, works only with the pluto sdr!')
args = parser.parse_args()
# query demodulator properties
rx_config_req = requests.get(api_url_rx)
rx_config = rx_config_req.json()
# query modulator properties
tx_config_req = requests.get(api_url_tx)
tx_config = tx_config_req.json()
# query sampling device RX properties
rx_config_req2 = requests.get(api_url_rx2)
rx_config2 = rx_config_req2.json()
# query sampling device TXproperties
tx_config_req2 = requests.get(api_url_tx2)
tx_config2 = tx_config_req2.json()
if args.tx:
tx_config['SSBModSettings']['inputFrequencyOffset'] = rx_config['SSBDemodSettings']['inputFrequencyOffset'] + args.txoffs
rx_config['SSBDemodSettings']['audioMute'] = 1
tx_config['SSBModSettings']['audioMute'] = 0
tx_config2['plutoSdrOutputSettings']['centerFrequency'] = rx_config2['plutoSdrInputSettings']['centerFrequency'] + args.txrxoffs
if args.rx:
rx_config['SSBDemodSettings']['audioMute'] = 0
tx_config['SSBModSettings']['audioMute'] = 1
requests.patch(api_url_rx, data=json.dumps(rx_config))
requests.patch(api_url_tx, data=json.dumps(tx_config))
requests.patch(api_url_tx2, data=json.dumps(tx_config2))
Dear Peter,
for the specific use case of QO-100, the full transponder fits inside the receiver bandwidth with a fixed LO frequency, and therefore only modulator/demodulator offset changes are required. I operate the transponder like this and QO-100 precisely what made me write this script. The same should go for the SSB slots on most amateur radio bands.
AFAIK the REST API does not provide a device-agnostic way of setting the center frequency and I'd rather not implement a bunch of device-specific options at the moment.
Congrats on getting it to work with the PlutoSDR for your use case anyways :)
Hi Stefan,
I guess I have just understood what this offset frequency really means. I got the point. This was anyway an interesting exercise for me. I don't really use yet my plutosdr with sdrangel, still on the learning curve. Thanks for you help anyway
It would be very useful if you could modify your scrip to offer the possibility to have the TX frequency track the RX frequency +/- an offset. For instance to work OSCAR 100, I need listen to the output of the LNB converted around 750 Mhz and I need to TX on 2400 Mhz (so that makes an positive offset of about 1650Mhz).
It would be great if you could add a "-txrxoffs" parameter to your script so it is possible to set an offset between tx and rx frequency. Of course If txrxoffs would not be specified, then there would be no TX/RX synchronisation
For instance:
angeltrack --tx --txoffs 1000 --txrxoffs 1650
Would switch to transmit with an offset of 1000 Hz on the SSB modulator and would set an offset of +1.65 Ghz on the central TX frequency compared to the RX one. So if the rx is tuned on 750 Mhz, the tx would be tuned on 2.4 Ghz at the time I switch to tx (when issuing the command).
Many thanks Regards Peter