Topics

Python script for controlling relays using SDRAngel reverse API


James Dallas
 

Hi everyone:

Here is my first stab at a script for controlling USB relay control boards using the SDRAngel reverse API.


I have only tested it on Linux (Ubuntu 18.04).

So far, I have been able to control both a single-channel CH341 "LCUS-1" device as well as a four-channel FTDI FT245R "1982-USB4CH" device (eg. Sainsmart).

It seems to switch within a few milliseconds of hitting "play."

Here are some things that I think ought to be done/ added in the future, and which I will work on in my spare time:

1. Actually testing this in Windows. I have read that the ftd2xx module for Python does work on Windows, but I didn't actually try it.

2. Refactor the code a bit so that it is a little more universal, rather than tied to the two boards I tried it on. For example, I think there are multi-channel CH340 devices out there.

3. Maybe add some sort of delay so that, for example, a transmit amplifier doesn't kick on until an antenna switch has had a few milliseconds to switch. This is a pretty important safety feature that ought to be implemented.

4. Better documentation. I wrote this up quickly and I am not sure all the ideas are well-explained.

73s,
James AD5NL


James Dallas
 

Addendum: I have since added a delay and also a PROCESS pseudo-relay type, so you can run third-party processes (either for unsupported hardware, or to do things like log transmissions). I still need to test on Windows...

On Sat, Mar 16, 2019 at 4:37 PM James Dallas via Groups.Io <jim.dallas=gmail.com@groups.io> wrote:
Hi everyone:

Here is my first stab at a script for controlling USB relay control boards using the SDRAngel reverse API.


I have only tested it on Linux (Ubuntu 18.04).

So far, I have been able to control both a single-channel CH341 "LCUS-1" device as well as a four-channel FTDI FT245R "1982-USB4CH" device (eg. Sainsmart).

It seems to switch within a few milliseconds of hitting "play."

Here are some things that I think ought to be done/ added in the future, and which I will work on in my spare time:

1. Actually testing this in Windows. I have read that the ftd2xx module for Python does work on Windows, but I didn't actually try it.

2. Refactor the code a bit so that it is a little more universal, rather than tied to the two boards I tried it on. For example, I think there are multi-channel CH340 devices out there.

3. Maybe add some sort of delay so that, for example, a transmit amplifier doesn't kick on until an antenna switch has had a few milliseconds to switch. This is a pretty important safety feature that ought to be implemented.

4. Better documentation. I wrote this up quickly and I am not sure all the ideas are well-explained.

73s,
James AD5NL


Marty Wittrock
 

James,

When you get a chance, can you tell me how this connects to SDRAngel and from what actions in 'Angel can certain events (like PTT) can be performed? I would also like to know if there's a way to apply some sort of app-to-app communication such that when WSJT-X wants to transmit off a COM port that specific event can trigger 'Angel to go into transmit and then take the audio off the port selected by WSJT-X. Is any of this even remotely possible? Please let me know - thanks,

73 de Marty, KN0CK


James Dallas
 

Hi Marty,

My intent is to develop a YouTube video explaining all of this in the near future.


On Tue, Mar 19, 2019 at 1:00 PM Marty Wittrock <martywittrock@...> wrote:
James,

When you get a chance, can you tell me how this connects to SDRAngel and from what actions in 'Angel can certain events (like PTT) can be performed? I would also like to know if there's a way to apply some sort of app-to-app communication such that when WSJT-X wants to transmit off a COM port that specific event can trigger 'Angel to go into transmit and then take the audio off the port selected by WSJT-X. Is any of this even remotely possible? Please let me know - thanks,

73 de Marty, KN0CK


Giuseppe Teodosio
 

Hi James,
I am extremely interested in the possibility of being able to control relays with sdrangel to use small external amplifiers and change antenna. Could you tell me if it is currently possible on windows + sdrangel system? You were talking about a video on youtube, did you by any chance publish it? Thanks, I await your reply.
73 de IZ8NVV Joe


James Dallas
 

Hi Joe,

I never made the video. I think I moved on to some other hobby project.

The basic idea would have been to use a bash or python script to control a USB relay board and then also trigger transmitting using the web api for sdrangel.

It is probably possible, but I don't have any working demo for you at the moment.


On Mon, Dec 28, 2020 at 12:36 PM Giuseppe Teodosio <iz8nvv@...> wrote:
Hi James,
I am extremely interested in the possibility of being able to control relays with sdrangel to use small external amplifiers and change antenna. Could you tell me if it is currently possible on windows + sdrangel system? You were talking about a video on youtube, did you by any chance publish it? Thanks, I await your reply.
73 de IZ8NVV Joe


James Dallas
 

Here is what I put up on github a while back:

GitHub - texasyojimbo/relayngel



On Tue, Dec 29, 2020 at 1:55 PM James Dallas <jim.dallas@...> wrote:
Hi Joe,

I never made the video. I think I moved on to some other hobby project.

The basic idea would have been to use a bash or python script to control a USB relay board and then also trigger transmitting using the web api for sdrangel.

It is probably possible, but I don't have any working demo for you at the moment.

On Mon, Dec 28, 2020 at 12:36 PM Giuseppe Teodosio <iz8nvv@...> wrote:
Hi James,
I am extremely interested in the possibility of being able to control relays with sdrangel to use small external amplifiers and change antenna. Could you tell me if it is currently possible on windows + sdrangel system? You were talking about a video on youtube, did you by any chance publish it? Thanks, I await your reply.
73 de IZ8NVV Joe


Giuseppe Teodosio
 

Thanks for the reply James. I had already visited the page relating to the link you posted. Unfortunately I don't understand anything about programming, so in spite of myself I will be forced to wait for the implementation of the use of relays via usb on Sdr-Angel, if ever it will be inserted in the future. SDR-Console, on the other hand, has been implementing it for some time, but it does not allow to transmit with the HackRF One, which instead would be quite convenient for me because it can be used in HF. Thanks James, I wish you and your family happy holidays.
 
Greetings from IZ8NVV Joe